Check-in [5210e44e87]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:scan with invertion, recent presentations
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5210e44e876bf49bcb913d9cf17bcfdc5c368c8b
User & Date: bernd 2019-01-02 19:02:39
Context
2019-01-02
20:23
Scan improvements check-in: acf8d9ca22 user: bernd tags: trunk
19:02
scan with invertion, recent presentations check-in: 5210e44e87 user: bernd tags: trunk
00:28
Debug 35c3 presentation (after doing it) check-in: d633a07f28 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to android/qrscan-android.fs.

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
does> ( n -- ) swap sfloats + sf@ ;
Variable sat%-state

: draw-cam ( -- )
    0>framebuffer saturate% sf@ { f: sat }
    camera-init screen-orientation 1e 1e draw-scan sync
    cam-w cam-h scan-fb-raw >framebuffer
    sat%-state @ 3 and sat%s saturate% sf!  1 sat%-state +!
    Saturate 1 saturate% glUniform1fv
    1 1e 1e draw-scan
    scan-tex-raw linear-mipmap mipmap
    sat saturate% sf!
    Saturate 1 saturate% glUniform1fv ;

previous previous

0 [IF]
Local Variables:
forth-local-words:
    (







<
<

|
<
<







29
30
31
32
33
34
35


36
37


38
39
40
41
42
43
44
does> ( n -- ) swap sfloats + sf@ ;
Variable sat%-state

: draw-cam ( -- )
    0>framebuffer saturate% sf@ { f: sat }
    camera-init screen-orientation 1e 1e draw-scan sync
    cam-w cam-h scan-fb-raw >framebuffer


    1 1e 1e draw-scan
    scan-tex-raw linear-mipmap mipmap ;



previous previous

0 [IF]
Local Variables:
forth-local-words:
    (

Changes to doc/cloudcalypse-16-9.jpg.

cannot compute difference between binary files

Changes to qrscan.fs.

172
173
174
175
176
177
178








179
180
181
182
183

184
185
186
187
188
189
190
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
...
290
291
292
293
294
295
296

297
298
299

300
301
302
303
304
305
306
...
335
336
337
338
339
340
341



342
343
344
345
346
347
348
349
350
351
...
373
374
375
376
377
378
379
380


381
382
383



384
385
386
387
388
389
390
...
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424







425
426
427
428
429
430
431
[ELSE]
    ' < alias ??
[THEN]

: rgb@ ( addr -- r g b )
    >r r@ c@ r@ 1+ c@ r> 2 + c@ ;









: extract-strip ( addr u step -- strip ) rgbas { step }
    0 -rot bounds U+DO
	I rgb@ drop 2>r
	2* r> green-level# ?? -
	2* r> red-level#   ?? -

    step +LOOP ;

$51 buffer: guessbuf
guessbuf $40 + Constant guessecc
guessecc $10 + Constant guesstag

scan-w 3 rshift Constant scan-step
................................................................................
    THEN  2drop rdrop ;

: search-corners ( -- )
    init-xy p0 !  p0 p0 cell+ 7 cells cmove \ fill all with the same contents
    scan-buf0 $@ drop
    scan-w dup negate DO
	scan-w dup negate DO
	    dup rgb@ blue-level#  < IF
		green-level#     < 2*
		swap red-level#  < - 3 and 2 xor
		2* cells p0 + I J rot min²!
	    ELSE
		2drop
	    THEN
	    rgba+
	LOOP
    LOOP  drop ;

: ?legit ( -- flag )
    p0 2@ init-xy dup d<>
................................................................................
: scan-grab-buf ( addr -- )
    scan-w 2* dup rot scan-grab ;
: scan-grab-cam ( addr -- )
    cam-w cam-h rot scan-grab ;

tex: scan-tex-raw
tex: scan-tex


0 Value scan-fb-raw
0 Value scan-fb


: scan-grab-raw ( -- )
    cam-w cam-h scan-fb-raw >framebuffer scan-buf-raw scan-grab-cam ;
: scan-grab0 ( -- )
    scan-buf0 scan-grab-buf ;
: scan-grab1 ( -- )
    scan-buf1 scan-grab-buf ;
................................................................................

: new-scantex-raw ( -- )
    scan-tex-raw 0>clear
    cam-w cam-h GL_RGBA new-textbuffer to scan-fb-raw ;
: new-scantex ( -- )
    scan-tex 0>clear
    scan-w 2* dup GL_RGBA new-textbuffer to scan-fb ;



: new-scantexes ( -- )
    scan-fb 0= IF
	new-scantex-raw new-scantex 0>framebuffer
    THEN ;
: scale+rotate ( -- )
    p1 2@ p0 2@ p- p3 2@ p2 2@ p- p+ p2/
    s>f y-scansize f/ y-rots sf!  s>f x-scansize f/ x-scl sf!
    p0 2@ p2 2@ p- p1 2@ p3 2@ p- p+ p2/
    s>f y-scansize f/ y-scl sf!  s>f x-scansize f/ x-rots sf! ;
: set-scan' ( -- )
................................................................................
    >guessecc tag@ guesstag c!
    2dup guessecc $10 ecc-ok? ;

: tex-frame ( -- )
    program init-program set-uniforms
    unit-matrix MVPMatrix set-matrix
    unit-matrix MVMatrix set-matrix ;
: draw-scaled ( -- )


    tex-frame scan-w 2* dup scan-fb >framebuffer
    scan-tex-raw linear-mipmap 0 scan-xy draw-scan
    scan-grab0 ;




previous

[IFDEF] android
    require android/qrscan-android.fs
    also android
[ELSE]
................................................................................
	    dist0 @ s>f [ 18 18 * ]L fm/ f>s . dist0-min ? dist0-max ? space
	    dist1 @ s>f [ 18 18 * ]L fm/ f>s . dist1-min ? dist1-max ? cr
	[THEN]
	) ;
[THEN]

: adapt-rgb ( -- )
    scan-buf0 $@ get-minmax-rgb
    over - 2/ 2/   + to blue-level#   \ blue level is 1/4 of total
    over - 2 5 */  + to green-level#  \ green at 40% of total
    over - 2/      + to red-level# ;  \ red at 50% of total

: scan-once ( -- )
    draw-cam
    !time draw-scaled adapt-rgb
    search-corners
    ?legit IF  scan-legit? IF
	    guessecc $10 + c@ scan-result qr( ." took: " .time cr )
	    qr( save-png1 1 +to scan# )
	ELSE  2drop  THEN
    THEN







    ekey? IF  ekey dup k-volup = swap bl = or  IF  save-pngs  THEN  THEN ;
: scan-loop ( -- )
    1 level# +!@ >r  BEGIN  scan-once >looper level# @ r@ <= UNTIL
    rdrop ;

: scan-qr ( -- )
    [IFDEF] lastscan$  lastscan$ $free  [THEN]







>
>
>
>
>
>
>
>


<
<
<
>







 







|
<
<


|







 







>



>







 







>
>
>


|







 







|
>
>


|
>
>
>







 







|
|
|
|

|
<
<





|
>
>
>
>
>
>
>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188



189
190
191
192
193
194
195
196
...
247
248
249
250
251
252
253
254


255
256
257
258
259
260
261
262
263
264
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
...
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
...
418
419
420
421
422
423
424
425
426
427
428
429
430


431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
[ELSE]
    ' < alias ??
[THEN]

: rgb@ ( addr -- r g b )
    >r r@ c@ r@ 1+ c@ r> 2 + c@ ;

0 Value strip-xor

: rgb? ( addr -- rgbbit )
    rgb@
    blue-level#  ?? negate 2* swap
    green-level# ?? - 2* swap
    red-level#   ?? - strip-xor xor ;

: extract-strip ( addr u step -- strip ) rgbas { step }
    0 -rot bounds U+DO



	2* 2* I rgb? 3 and +
    step +LOOP ;

$51 buffer: guessbuf
guessbuf $40 + Constant guessecc
guessecc $10 + Constant guesstag

scan-w 3 rshift Constant scan-step
................................................................................
    THEN  2drop rdrop ;

: search-corners ( -- )
    init-xy p0 !  p0 p0 cell+ 7 cells cmove \ fill all with the same contents
    scan-buf0 $@ drop
    scan-w dup negate DO
	scan-w dup negate DO
	    dup rgb dup 4 and IF  3 and 2 xor


		2* cells p0 + I J rot min²!
	    ELSE
		drop
	    THEN
	    rgba+
	LOOP
    LOOP  drop ;

: ?legit ( -- flag )
    p0 2@ init-xy dup d<>
................................................................................
: scan-grab-buf ( addr -- )
    scan-w 2* dup rot scan-grab ;
: scan-grab-cam ( addr -- )
    cam-w cam-h rot scan-grab ;

tex: scan-tex-raw
tex: scan-tex
tex: scan-tex-final

0 Value scan-fb-raw
0 Value scan-fb
0 Value scan-fb-final

: scan-grab-raw ( -- )
    cam-w cam-h scan-fb-raw >framebuffer scan-buf-raw scan-grab-cam ;
: scan-grab0 ( -- )
    scan-buf0 scan-grab-buf ;
: scan-grab1 ( -- )
    scan-buf1 scan-grab-buf ;
................................................................................

: new-scantex-raw ( -- )
    scan-tex-raw 0>clear
    cam-w cam-h GL_RGBA new-textbuffer to scan-fb-raw ;
: new-scantex ( -- )
    scan-tex 0>clear
    scan-w 2* dup GL_RGBA new-textbuffer to scan-fb ;
: new-scantex-final ( -- )
    scan-tex-final 0>clear
    scan-w 2* dup GL_RGBA new-textbuffer to scan-fb-final ;
: new-scantexes ( -- )
    scan-fb 0= IF
	new-scantex-raw new-scantex new-scantex-final 0>framebuffer
    THEN ;
: scale+rotate ( -- )
    p1 2@ p0 2@ p- p3 2@ p2 2@ p- p+ p2/
    s>f y-scansize f/ y-rots sf!  s>f x-scansize f/ x-scl sf!
    p0 2@ p2 2@ p- p1 2@ p3 2@ p- p+ p2/
    s>f y-scansize f/ y-scl sf!  s>f x-scansize f/ x-rots sf! ;
: set-scan' ( -- )
................................................................................
    >guessecc tag@ guesstag c!
    2dup guessecc $10 ecc-ok? ;

: tex-frame ( -- )
    program init-program set-uniforms
    unit-matrix MVPMatrix set-matrix
    unit-matrix MVMatrix set-matrix ;
: draw-scaled ( i -- )
    3 and sat%s saturate% sf!
    Saturate 1 saturate% glUniform1fv
    tex-frame scan-w 2* dup scan-fb >framebuffer
    scan-tex-raw linear-mipmap 0 scan-xy draw-scan
    scan-grab0  scan-fb-final >framebuffer ;
: sat-reset ( -- )
    sat saturate% sf!
    Saturate 1 saturate% glUniform1fv ;

previous

[IFDEF] android
    require android/qrscan-android.fs
    also android
[ELSE]
................................................................................
	    dist0 @ s>f [ 18 18 * ]L fm/ f>s . dist0-min ? dist0-max ? space
	    dist1 @ s>f [ 18 18 * ]L fm/ f>s . dist1-min ? dist1-max ? cr
	[THEN]
	) ;
[THEN]

: adapt-rgb ( -- )
    scan-buf0 $@ get-minmax-rgb { d: r d: g d: b }
    b over - 2/ 2/   + to blue-level#    \ blue level is 1/4 of total
    g over - 2 5 */  + to green-level#   \ green at 40% of total
    r over - 2/      + to red-level# ;   \ red at 50% of total

: scan-it ( -- )


    search-corners
    ?legit IF  scan-legit? IF
	    guessecc $10 + c@ scan-result qr( ." took: " .time cr )
	    qr( save-png1 1 +to scan# )
	ELSE  2drop  THEN
    THEN ;

: scan-once ( -- )
    draw-cam qr( !time ) 3 0 DO
	I draw-scaled adapt-rgb
	7 to rgb-xor scan-it
	0 to rgb-xor scan-it
    LOOP  sat-reset
    ekey? IF  ekey dup k-volup = swap bl = or  IF  save-pngs  THEN  THEN ;
: scan-loop ( -- )
    1 level# +!@ >r  BEGIN  scan-once >looper level# @ r@ <= UNTIL
    rdrop ;

: scan-qr ( -- )
    [IFDEF] lastscan$  lastscan$ $free  [THEN]

Changes to wiki/net2o.md.

94
95
96
97
98
99
100

101





102
103
104
105
106
107
108
+ [EuroForth 2013 — net2o application layer](https://wiki.forth-ev.de/doku.php/events:euroforth-2013:n2oal)
+ [EuroForth 2014 — net2o command language](https://wiki.forth-ev.de/doku.php/events:euroforth-2014:net2ocl)
+ [31c3](31c3.md) presentation
+ [32c3](32c3.md) presentation
+ [EuroForth 2016](https://wiki.forth-ev.de/doku.php/events:euroforth-2016:using-net2o) presentation
+ [33c3](33c3.md) presentation
+ [EuroForth 2017](https://wiki.forth-ev.de/lib/exe/fetch.php/events:ef2017:minos2.mp4) presentation (MINOΣ 2)

+ [34c3](34c3.md) presentation (alternative source: [Chaos West's capture](https://media.ccc.de/v/34c3-ChaosWest-15-net2o_gui_realtime_mixnet_and_ethical_micropayment_with_efficient_blockchain))






Discussions
-----------

* The [pki](pki.md) problem
* [Client authentication](client-auth.md)
* [Handover](handover.wiki)







>
|
>
>
>
>
>







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
+ [EuroForth 2013 — net2o application layer](https://wiki.forth-ev.de/doku.php/events:euroforth-2013:n2oal)
+ [EuroForth 2014 — net2o command language](https://wiki.forth-ev.de/doku.php/events:euroforth-2014:net2ocl)
+ [31c3](31c3.md) presentation
+ [32c3](32c3.md) presentation
+ [EuroForth 2016](https://wiki.forth-ev.de/doku.php/events:euroforth-2016:using-net2o) presentation
+ [33c3](33c3.md) presentation
+ [EuroForth 2017](https://wiki.forth-ev.de/lib/exe/fetch.php/events:ef2017:minos2.mp4) presentation (MINOΣ 2)
+ [34c3](34c3.md) presentation (alternative source: [Chaos West's
  capture](https://media.ccc.de/v/34c3-ChaosWest-15-net2o_gui_realtime_mixnet_and_ethical_micropayment_with_efficient_blockchain))
+ [EuroForth 2018](https://wiki.forth-ev.de/doku.php/events:ef2018:net2o)
  presentation (MINOΣ 2 + $quid)
+ [35c3](https://media.ccc.de/v/35c3chaoswest-21-cloudcalypse-it-looks-like-you-ve-reached-the-end-how-to-take-your-data-into-net2o)
  presentation (only Chaos West capture this time, as they did a very
  professional job).

Discussions
-----------

* The [pki](pki.md) problem
* [Client authentication](client-auth.md)
* [Handover](handover.wiki)