forked from dillonhuff/clockwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera_pipeline_extra_buf_glb_compute.h
More file actions
13059 lines (12927 loc) · 407 KB
/
camera_pipeline_extra_buf_glb_compute.h
File metadata and controls
13059 lines (12927 loc) · 407 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
#include "hw_classes.h"
#include "clockwork_standard_compute_units.h"
//store is: hw_input_global_wrapper.glb.stencil((hw_input_global_wrapper_s0_x_x*2), ((hw_input_global_wrapper_s0_y + -4) + 4)) = hw_input.stencil((((hw_input_global_wrapper_s0_x_x + (0*124))*2) + -4), (hw_input_global_wrapper_s0_y + -4))
hw_uint<16> hcompute_hw_input_global_wrapper_glb_stencil(hw_uint<16>& hw_input_stencil) {
uint16_t _hw_input_stencil_1 = (uint16_t) hw_input_stencil.extract<0, 15>();
return _hw_input_stencil_1;
}
//store is: hw_input_global_wrapper.glb.stencil(((hw_input_global_wrapper_s0_x_x*2) + 1), ((hw_input_global_wrapper_s0_y + -4) + 4)) = hw_input.stencil((((hw_input_global_wrapper_s0_x_x + (0*124))*2) + -3), (hw_input_global_wrapper_s0_y + -4))
hw_uint<16> hcompute_hw_input_global_wrapper_glb_stencil_1(hw_uint<16>& hw_input_stencil) {
uint16_t _hw_input_stencil_2 = (uint16_t) hw_input_stencil.extract<0, 15>();
return _hw_input_stencil_2;
}
//store is: hw_input_global_wrapper_global_wrapper.stencil((hw_input_global_wrapper_global_wrapper_s0_x_x*2), ((hw_input_global_wrapper_global_wrapper_s0_y + -4) + 4)) = hw_input_global_wrapper.glb.stencil((hw_input_global_wrapper_global_wrapper_s0_x_x*2), ((hw_input_global_wrapper_global_wrapper_s0_y + -4) + 4))
hw_uint<16> hcompute_hw_input_global_wrapper_global_wrapper_stencil(hw_uint<16>& hw_input_global_wrapper_glb_stencil) {
uint16_t _hw_input_global_wrapper_glb_stencil_1 = (uint16_t) hw_input_global_wrapper_glb_stencil.extract<0, 15>();
return _hw_input_global_wrapper_glb_stencil_1;
}
//store is: hw_input_global_wrapper_global_wrapper.stencil(((hw_input_global_wrapper_global_wrapper_s0_x_x*2) + 1), ((hw_input_global_wrapper_global_wrapper_s0_y + -4) + 4)) = hw_input_global_wrapper.glb.stencil(((hw_input_global_wrapper_global_wrapper_s0_x_x*2) + 1), ((hw_input_global_wrapper_global_wrapper_s0_y + -4) + 4))
hw_uint<16> hcompute_hw_input_global_wrapper_global_wrapper_stencil_1(hw_uint<16>& hw_input_global_wrapper_glb_stencil) {
uint16_t _hw_input_global_wrapper_glb_stencil_2 = (uint16_t) hw_input_global_wrapper_glb_stencil.extract<0, 15>();
return _hw_input_global_wrapper_glb_stencil_2;
}
//store is: denoised$1.stencil((denoised_1_s0_x_x*2), ((denoised_1_s0_y + -2) + 2)) = min(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 2), ((denoised_1_s0_y + -2) + 4)), max(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 2), ((denoised_1_s0_y + -2) + 6)), max(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 2), ((denoised_1_s0_y + -2) + 2)), max(hw_input_global_wrapper_global_wrapper.stencil((denoised_1_s0_x_x*2), ((denoised_1_s0_y + -2) + 4)), hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 4), ((denoised_1_s0_y + -2) + 4))))))
hw_uint<16> hcompute_denoised_1_stencil(hw_uint<80>& hw_input_global_wrapper_global_wrapper_stencil) {
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_1 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<0, 15>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_2 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<16, 31>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_3 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<32, 47>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_4 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<48, 63>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_5 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<64, 79>();
uint16_t _351 = max(_hw_input_global_wrapper_global_wrapper_stencil_4, _hw_input_global_wrapper_global_wrapper_stencil_5);
uint16_t _352 = max(_hw_input_global_wrapper_global_wrapper_stencil_3, _351);
uint16_t _353 = max(_hw_input_global_wrapper_global_wrapper_stencil_2, _352);
uint16_t _354 = min(_hw_input_global_wrapper_global_wrapper_stencil_1, _353);
return _354;
}
//store is: denoised$1.stencil(((denoised_1_s0_x_x*2) + 1), ((denoised_1_s0_y + -2) + 2)) = min(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 3), ((denoised_1_s0_y + -2) + 4)), max(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 3), ((denoised_1_s0_y + -2) + 6)), max(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 3), ((denoised_1_s0_y + -2) + 2)), max(hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 1), ((denoised_1_s0_y + -2) + 4)), hw_input_global_wrapper_global_wrapper.stencil(((denoised_1_s0_x_x*2) + 5), ((denoised_1_s0_y + -2) + 4))))))
hw_uint<16> hcompute_denoised_1_stencil_1(hw_uint<80>& hw_input_global_wrapper_global_wrapper_stencil) {
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_10 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<0, 15>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_6 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<16, 31>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_7 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<32, 47>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_8 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<48, 63>();
uint16_t _hw_input_global_wrapper_global_wrapper_stencil_9 = (uint16_t) hw_input_global_wrapper_global_wrapper_stencil.extract<64, 79>();
uint16_t _375 = max(_hw_input_global_wrapper_global_wrapper_stencil_9, _hw_input_global_wrapper_global_wrapper_stencil_10);
uint16_t _376 = max(_hw_input_global_wrapper_global_wrapper_stencil_8, _375);
uint16_t _377 = max(_hw_input_global_wrapper_global_wrapper_stencil_7, _376);
uint16_t _378 = min(_hw_input_global_wrapper_global_wrapper_stencil_6, _377);
return _378;
}
//store is: b_b.stencil((b_b_s0_x_x*2), ((b_b_s0_y + -1) + 1)) = denoised$1.stencil(((b_b_s0_x_x*4) + 2), (((b_b_s0_y + -1)*2) + 3))
hw_uint<16> hcompute_b_b_stencil(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_1 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_1;
}
//store is: b_b.stencil(((b_b_s0_x_x*2) + 1), ((b_b_s0_y + -1) + 1)) = denoised$1.stencil(((b_b_s0_x_x*4) + 4), (((b_b_s0_y + -1)*2) + 3))
hw_uint<16> hcompute_b_b_stencil_1(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_2 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_2;
}
//store is: g_gb.stencil((g_gb_s0_x_x*2), ((g_gb_s0_y + -1) + 1)) = denoised$1.stencil(((g_gb_s0_x_x*4) + 1), (((g_gb_s0_y + -1)*2) + 3))
hw_uint<16> hcompute_g_gb_stencil(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_3 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_3;
}
//store is: g_gb.stencil(((g_gb_s0_x_x*2) + 1), ((g_gb_s0_y + -1) + 1)) = denoised$1.stencil(((g_gb_s0_x_x*4) + 3), (((g_gb_s0_y + -1)*2) + 3))
hw_uint<16> hcompute_g_gb_stencil_1(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_4 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_4;
}
//store is: g_gr.stencil((g_gr_s0_x_x*2), ((g_gr_s0_y + -1) + 1)) = denoised$1.stencil((g_gr_s0_x_x*4), (((g_gr_s0_y + -1)*2) + 2))
hw_uint<16> hcompute_g_gr_stencil(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_5 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_5;
}
//store is: g_gr.stencil(((g_gr_s0_x_x*2) + 1), ((g_gr_s0_y + -1) + 1)) = denoised$1.stencil(((g_gr_s0_x_x*4) + 2), (((g_gr_s0_y + -1)*2) + 2))
hw_uint<16> hcompute_g_gr_stencil_1(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_6 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_6;
}
//store is: g_b.stencil(g_b_s0_x, ((g_b_s0_y + -1) + 1)) = select((absd(g_gb.stencil(g_b_s0_x, ((g_b_s0_y + -1) + 1)), g_gb.stencil((g_b_s0_x + 1), ((g_b_s0_y + -1) + 1))) < absd(g_gr.stencil((g_b_s0_x + 1), ((g_b_s0_y + -1) + 2)), g_gr.stencil((g_b_s0_x + 1), ((g_b_s0_y + -1) + 1)))), ((g_gb.stencil(g_b_s0_x, ((g_b_s0_y + -1) + 1)) + g_gb.stencil((g_b_s0_x + 1), ((g_b_s0_y + -1) + 1)))/(uint16)2), ((g_gr.stencil((g_b_s0_x + 1), ((g_b_s0_y + -1) + 2)) + g_gr.stencil((g_b_s0_x + 1), ((g_b_s0_y + -1) + 1)))/(uint16)2))
hw_uint<16> hcompute_g_b_stencil(hw_uint<32>& g_gb_stencil, hw_uint<32>& g_gr_stencil) {
uint16_t _g_gb_stencil_1 = (uint16_t) g_gb_stencil.extract<0, 15>();
uint16_t _g_gb_stencil_2 = (uint16_t) g_gb_stencil.extract<16, 31>();
uint16_t _g_gr_stencil_1 = (uint16_t) g_gr_stencil.extract<0, 15>();
uint16_t _g_gr_stencil_2 = (uint16_t) g_gr_stencil.extract<16, 31>();
uint16_t _455 = _g_gb_stencil_1 + _g_gb_stencil_2;
uint16_t _456 = (uint16_t)(1);
uint16_t _457 = _455 >> _456;
uint16_t _458 = _g_gr_stencil_1 + _g_gr_stencil_2;
uint16_t _459 = _458 >> _456;
uint16_t _460 = _g_gb_stencil_2 - _g_gb_stencil_1;
uint16_t _461 = _g_gb_stencil_1 - _g_gb_stencil_2;
bool _462 = _g_gb_stencil_1 < _g_gb_stencil_2;
uint16_t _463 = (uint16_t)(_462 ? _460 : _461);
uint16_t _464 = _463;
uint16_t _465 = _g_gr_stencil_2 - _g_gr_stencil_1;
uint16_t _466 = _g_gr_stencil_1 - _g_gr_stencil_2;
bool _467 = _g_gr_stencil_1 < _g_gr_stencil_2;
uint16_t _468 = (uint16_t)(_467 ? _465 : _466);
uint16_t _469 = _468;
bool _470 = _464 < _469;
uint16_t _471 = (uint16_t)(_470 ? _457 : _459);
return _471;
}
//store is: b_gb.stencil(b_gb_s0_x, b_gb_s0_y) = ((g_gb.stencil((b_gb_s0_x + 1), (b_gb_s0_y + 1)) + ((b_b.stencil(b_gb_s0_x, (b_gb_s0_y + 1)) + b_b.stencil((b_gb_s0_x + 1), (b_gb_s0_y + 1)))/(uint16)2)) - ((g_b.stencil(b_gb_s0_x, (b_gb_s0_y + 1)) + g_b.stencil((b_gb_s0_x + 1), (b_gb_s0_y + 1)))/(uint16)2))
hw_uint<16> hcompute_b_gb_stencil(hw_uint<32>& b_b_stencil, hw_uint<32>& g_b_stencil, hw_uint<16>& g_gb_stencil) {
uint16_t _b_b_stencil_1 = (uint16_t) b_b_stencil.extract<0, 15>();
uint16_t _b_b_stencil_2 = (uint16_t) b_b_stencil.extract<16, 31>();
uint16_t _g_b_stencil_1 = (uint16_t) g_b_stencil.extract<0, 15>();
uint16_t _g_b_stencil_2 = (uint16_t) g_b_stencil.extract<16, 31>();
uint16_t _g_gb_stencil_3 = (uint16_t) g_gb_stencil.extract<0, 15>();
uint16_t _507 = _b_b_stencil_1 + _b_b_stencil_2;
uint16_t _508 = (uint16_t)(1);
uint16_t _509 = _507 >> _508;
uint16_t _510 = _g_gb_stencil_3 + _509;
uint16_t _511 = _g_b_stencil_1 + _g_b_stencil_2;
uint16_t _512 = _511 >> _508;
uint16_t _513 = _510 - _512;
return _513;
}
//store is: b_gr.stencil(b_gr_s0_x, b_gr_s0_y) = ((g_gr.stencil((b_gr_s0_x + 1), (b_gr_s0_y + 1)) + ((b_b.stencil(b_gr_s0_x, (b_gr_s0_y + 1)) + b_b.stencil(b_gr_s0_x, b_gr_s0_y))/(uint16)2)) - ((g_b.stencil(b_gr_s0_x, (b_gr_s0_y + 1)) + g_b.stencil(b_gr_s0_x, b_gr_s0_y))/(uint16)2))
hw_uint<16> hcompute_b_gr_stencil(hw_uint<32>& b_b_stencil, hw_uint<32>& g_b_stencil, hw_uint<16>& g_gr_stencil) {
uint16_t _b_b_stencil_3 = (uint16_t) b_b_stencil.extract<0, 15>();
uint16_t _b_b_stencil_4 = (uint16_t) b_b_stencil.extract<16, 31>();
uint16_t _g_b_stencil_3 = (uint16_t) g_b_stencil.extract<0, 15>();
uint16_t _g_b_stencil_4 = (uint16_t) g_b_stencil.extract<16, 31>();
uint16_t _g_gr_stencil_3 = (uint16_t) g_gr_stencil.extract<0, 15>();
uint16_t _536 = _b_b_stencil_3 + _b_b_stencil_4;
uint16_t _537 = (uint16_t)(1);
uint16_t _538 = _536 >> _537;
uint16_t _539 = _g_gr_stencil_3 + _538;
uint16_t _540 = _g_b_stencil_3 + _g_b_stencil_4;
uint16_t _541 = _540 >> _537;
uint16_t _542 = _539 - _541;
return _542;
}
//store is: g_r.stencil(((g_r_s0_x + -1) + 1), g_r_s0_y) = select((absd(g_gr.stencil(((g_r_s0_x + -1) + 2), (g_r_s0_y + 1)), g_gr.stencil(((g_r_s0_x + -1) + 1), (g_r_s0_y + 1))) < absd(g_gb.stencil(((g_r_s0_x + -1) + 1), g_r_s0_y), g_gb.stencil(((g_r_s0_x + -1) + 1), (g_r_s0_y + 1)))), ((g_gr.stencil(((g_r_s0_x + -1) + 2), (g_r_s0_y + 1)) + g_gr.stencil(((g_r_s0_x + -1) + 1), (g_r_s0_y + 1)))/(uint16)2), ((g_gb.stencil(((g_r_s0_x + -1) + 1), g_r_s0_y) + g_gb.stencil(((g_r_s0_x + -1) + 1), (g_r_s0_y + 1)))/(uint16)2))
hw_uint<16> hcompute_g_r_stencil(hw_uint<32>& g_gb_stencil, hw_uint<32>& g_gr_stencil) {
uint16_t _g_gb_stencil_4 = (uint16_t) g_gb_stencil.extract<0, 15>();
uint16_t _g_gb_stencil_5 = (uint16_t) g_gb_stencil.extract<16, 31>();
uint16_t _g_gr_stencil_4 = (uint16_t) g_gr_stencil.extract<0, 15>();
uint16_t _g_gr_stencil_5 = (uint16_t) g_gr_stencil.extract<16, 31>();
uint16_t _566 = _g_gr_stencil_4 + _g_gr_stencil_5;
uint16_t _567 = (uint16_t)(1);
uint16_t _568 = _566 >> _567;
uint16_t _569 = _g_gb_stencil_4 + _g_gb_stencil_5;
uint16_t _570 = _569 >> _567;
uint16_t _571 = _g_gr_stencil_5 - _g_gr_stencil_4;
uint16_t _572 = _g_gr_stencil_4 - _g_gr_stencil_5;
bool _573 = _g_gr_stencil_4 < _g_gr_stencil_5;
uint16_t _574 = (uint16_t)(_573 ? _571 : _572);
uint16_t _575 = _574;
uint16_t _576 = _g_gb_stencil_5 - _g_gb_stencil_4;
uint16_t _577 = _g_gb_stencil_4 - _g_gb_stencil_5;
bool _578 = _g_gb_stencil_4 < _g_gb_stencil_5;
uint16_t _579 = (uint16_t)(_578 ? _576 : _577);
uint16_t _580 = _579;
bool _581 = _575 < _580;
uint16_t _582 = (uint16_t)(_581 ? _568 : _570);
return _582;
}
//store is: b_r.stencil(b_r_s0_x, b_r_s0_y) = select((absd(b_b.stencil(b_r_s0_x, (b_r_s0_y + 1)), b_b.stencil((b_r_s0_x + 1), b_r_s0_y)) < absd(b_b.stencil((b_r_s0_x + 1), (b_r_s0_y + 1)), b_b.stencil(b_r_s0_x, b_r_s0_y))), ((g_r.stencil((b_r_s0_x + 1), b_r_s0_y) + ((b_b.stencil(b_r_s0_x, (b_r_s0_y + 1)) + b_b.stencil((b_r_s0_x + 1), b_r_s0_y))/(uint16)2)) - ((g_b.stencil(b_r_s0_x, (b_r_s0_y + 1)) + g_b.stencil((b_r_s0_x + 1), b_r_s0_y))/(uint16)2)), ((g_r.stencil((b_r_s0_x + 1), b_r_s0_y) + ((b_b.stencil((b_r_s0_x + 1), (b_r_s0_y + 1)) + b_b.stencil(b_r_s0_x, b_r_s0_y))/(uint16)2)) - ((g_b.stencil((b_r_s0_x + 1), (b_r_s0_y + 1)) + g_b.stencil(b_r_s0_x, b_r_s0_y))/(uint16)2)))
hw_uint<16> hcompute_b_r_stencil(hw_uint<64>& b_b_stencil, hw_uint<64>& g_b_stencil, hw_uint<16>& g_r_stencil) {
uint16_t _b_b_stencil_5 = (uint16_t) b_b_stencil.extract<0, 15>();
uint16_t _b_b_stencil_6 = (uint16_t) b_b_stencil.extract<16, 31>();
uint16_t _b_b_stencil_7 = (uint16_t) b_b_stencil.extract<32, 47>();
uint16_t _b_b_stencil_8 = (uint16_t) b_b_stencil.extract<48, 63>();
uint16_t _g_b_stencil_5 = (uint16_t) g_b_stencil.extract<0, 15>();
uint16_t _g_b_stencil_6 = (uint16_t) g_b_stencil.extract<16, 31>();
uint16_t _g_b_stencil_7 = (uint16_t) g_b_stencil.extract<32, 47>();
uint16_t _g_b_stencil_8 = (uint16_t) g_b_stencil.extract<48, 63>();
uint16_t _g_r_stencil_1 = (uint16_t) g_r_stencil.extract<0, 15>();
uint16_t _618 = _b_b_stencil_5 + _b_b_stencil_6;
uint16_t _619 = (uint16_t)(1);
uint16_t _620 = _618 >> _619;
uint16_t _621 = _g_r_stencil_1 + _620;
uint16_t _622 = _g_b_stencil_5 + _g_b_stencil_6;
uint16_t _623 = _622 >> _619;
uint16_t _624 = _621 - _623;
uint16_t _625 = _b_b_stencil_7 + _b_b_stencil_8;
uint16_t _626 = _625 >> _619;
uint16_t _627 = _g_r_stencil_1 + _626;
uint16_t _628 = _g_b_stencil_7 + _g_b_stencil_8;
uint16_t _629 = _628 >> _619;
uint16_t _630 = _627 - _629;
uint16_t _631 = _b_b_stencil_6 - _b_b_stencil_5;
uint16_t _632 = _b_b_stencil_5 - _b_b_stencil_6;
bool _633 = _b_b_stencil_5 < _b_b_stencil_6;
uint16_t _634 = (uint16_t)(_633 ? _631 : _632);
uint16_t _635 = _634;
uint16_t _636 = _b_b_stencil_8 - _b_b_stencil_7;
uint16_t _637 = _b_b_stencil_7 - _b_b_stencil_8;
bool _638 = _b_b_stencil_7 < _b_b_stencil_8;
uint16_t _639 = (uint16_t)(_638 ? _636 : _637);
uint16_t _640 = _639;
bool _641 = _635 < _640;
uint16_t _642 = (uint16_t)(_641 ? _624 : _630);
return _642;
}
//store is: r_r.stencil((r_r_s0_x_x*2), r_r_s0_y) = denoised$1.stencil(((r_r_s0_x_x*4) + 1), ((r_r_s0_y*2) + 2))
hw_uint<16> hcompute_r_r_stencil(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_7 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_7;
}
//store is: r_r.stencil(((r_r_s0_x_x*2) + 1), r_r_s0_y) = denoised$1.stencil(((r_r_s0_x_x*4) + 3), ((r_r_s0_y*2) + 2))
hw_uint<16> hcompute_r_r_stencil_1(hw_uint<16>& denoised_1_stencil) {
uint16_t _denoised_1_stencil_8 = (uint16_t) denoised_1_stencil.extract<0, 15>();
return _denoised_1_stencil_8;
}
//store is: r_b.stencil(r_b_s0_x, r_b_s0_y) = select((absd(r_r.stencil((r_b_s0_x + 1), r_b_s0_y), r_r.stencil(r_b_s0_x, (r_b_s0_y + 1))) < absd(r_r.stencil(r_b_s0_x, r_b_s0_y), r_r.stencil((r_b_s0_x + 1), (r_b_s0_y + 1)))), ((g_b.stencil(r_b_s0_x, (r_b_s0_y + 1)) + ((r_r.stencil((r_b_s0_x + 1), r_b_s0_y) + r_r.stencil(r_b_s0_x, (r_b_s0_y + 1)))/(uint16)2)) - ((g_r.stencil((r_b_s0_x + 1), r_b_s0_y) + g_r.stencil(r_b_s0_x, (r_b_s0_y + 1)))/(uint16)2)), ((g_b.stencil(r_b_s0_x, (r_b_s0_y + 1)) + ((r_r.stencil(r_b_s0_x, r_b_s0_y) + r_r.stencil((r_b_s0_x + 1), (r_b_s0_y + 1)))/(uint16)2)) - ((g_r.stencil(r_b_s0_x, r_b_s0_y) + g_r.stencil((r_b_s0_x + 1), (r_b_s0_y + 1)))/(uint16)2)))
hw_uint<16> hcompute_r_b_stencil(hw_uint<16>& g_b_stencil, hw_uint<64>& g_r_stencil, hw_uint<64>& r_r_stencil) {
uint16_t _g_b_stencil_9 = (uint16_t) g_b_stencil.extract<0, 15>();
uint16_t _g_r_stencil_2 = (uint16_t) g_r_stencil.extract<0, 15>();
uint16_t _g_r_stencil_3 = (uint16_t) g_r_stencil.extract<16, 31>();
uint16_t _g_r_stencil_4 = (uint16_t) g_r_stencil.extract<32, 47>();
uint16_t _g_r_stencil_5 = (uint16_t) g_r_stencil.extract<48, 63>();
uint16_t _r_r_stencil_1 = (uint16_t) r_r_stencil.extract<0, 15>();
uint16_t _r_r_stencil_2 = (uint16_t) r_r_stencil.extract<16, 31>();
uint16_t _r_r_stencil_3 = (uint16_t) r_r_stencil.extract<32, 47>();
uint16_t _r_r_stencil_4 = (uint16_t) r_r_stencil.extract<48, 63>();
uint16_t _710 = _r_r_stencil_1 + _r_r_stencil_2;
uint16_t _711 = (uint16_t)(1);
uint16_t _712 = _710 >> _711;
uint16_t _713 = _g_b_stencil_9 + _712;
uint16_t _714 = _g_r_stencil_2 + _g_r_stencil_3;
uint16_t _715 = _714 >> _711;
uint16_t _716 = _713 - _715;
uint16_t _717 = _r_r_stencil_3 + _r_r_stencil_4;
uint16_t _718 = _717 >> _711;
uint16_t _719 = _g_b_stencil_9 + _718;
uint16_t _720 = _g_r_stencil_4 + _g_r_stencil_5;
uint16_t _721 = _720 >> _711;
uint16_t _722 = _719 - _721;
uint16_t _723 = _r_r_stencil_2 - _r_r_stencil_1;
uint16_t _724 = _r_r_stencil_1 - _r_r_stencil_2;
bool _725 = _r_r_stencil_1 < _r_r_stencil_2;
uint16_t _726 = (uint16_t)(_725 ? _723 : _724);
uint16_t _727 = _726;
uint16_t _728 = _r_r_stencil_4 - _r_r_stencil_3;
uint16_t _729 = _r_r_stencil_3 - _r_r_stencil_4;
bool _730 = _r_r_stencil_3 < _r_r_stencil_4;
uint16_t _731 = (uint16_t)(_730 ? _728 : _729);
uint16_t _732 = _731;
bool _733 = _727 < _732;
uint16_t _734 = (uint16_t)(_733 ? _716 : _722);
return _734;
}
//store is: r_gb.stencil(r_gb_s0_x, r_gb_s0_y) = ((g_gb.stencil((r_gb_s0_x + 1), (r_gb_s0_y + 1)) + ((r_r.stencil((r_gb_s0_x + 1), r_gb_s0_y) + r_r.stencil((r_gb_s0_x + 1), (r_gb_s0_y + 1)))/(uint16)2)) - ((g_r.stencil((r_gb_s0_x + 1), r_gb_s0_y) + g_r.stencil((r_gb_s0_x + 1), (r_gb_s0_y + 1)))/(uint16)2))
hw_uint<16> hcompute_r_gb_stencil(hw_uint<16>& g_gb_stencil, hw_uint<32>& g_r_stencil, hw_uint<32>& r_r_stencil) {
uint16_t _g_gb_stencil_6 = (uint16_t) g_gb_stencil.extract<0, 15>();
uint16_t _g_r_stencil_6 = (uint16_t) g_r_stencil.extract<0, 15>();
uint16_t _g_r_stencil_7 = (uint16_t) g_r_stencil.extract<16, 31>();
uint16_t _r_r_stencil_5 = (uint16_t) r_r_stencil.extract<0, 15>();
uint16_t _r_r_stencil_6 = (uint16_t) r_r_stencil.extract<16, 31>();
uint16_t _789 = _r_r_stencil_5 + _r_r_stencil_6;
uint16_t _790 = (uint16_t)(1);
uint16_t _791 = _789 >> _790;
uint16_t _792 = _g_gb_stencil_6 + _791;
uint16_t _793 = _g_r_stencil_6 + _g_r_stencil_7;
uint16_t _794 = _793 >> _790;
uint16_t _795 = _792 - _794;
return _795;
}
//store is: r_gr.stencil(r_gr_s0_x, r_gr_s0_y) = ((g_gr.stencil((r_gr_s0_x + 1), (r_gr_s0_y + 1)) + ((r_r.stencil(r_gr_s0_x, r_gr_s0_y) + r_r.stencil((r_gr_s0_x + 1), r_gr_s0_y))/(uint16)2)) - ((g_r.stencil((r_gr_s0_x + 1), r_gr_s0_y) + g_r.stencil(r_gr_s0_x, r_gr_s0_y))/(uint16)2))
hw_uint<16> hcompute_r_gr_stencil(hw_uint<16>& g_gr_stencil, hw_uint<32>& g_r_stencil, hw_uint<32>& r_r_stencil) {
uint16_t _g_gr_stencil_6 = (uint16_t) g_gr_stencil.extract<0, 15>();
uint16_t _g_r_stencil_8 = (uint16_t) g_r_stencil.extract<0, 15>();
uint16_t _g_r_stencil_9 = (uint16_t) g_r_stencil.extract<16, 31>();
uint16_t _r_r_stencil_7 = (uint16_t) r_r_stencil.extract<0, 15>();
uint16_t _r_r_stencil_8 = (uint16_t) r_r_stencil.extract<16, 31>();
uint16_t _818 = _r_r_stencil_7 + _r_r_stencil_8;
uint16_t _819 = (uint16_t)(1);
uint16_t _820 = _818 >> _819;
uint16_t _821 = _g_gr_stencil_6 + _820;
uint16_t _822 = _g_r_stencil_8 + _g_r_stencil_9;
uint16_t _823 = _822 >> _819;
uint16_t _824 = _821 - _823;
return _824;
}
//store is: demosaicked$1.stencil((demosaicked_1_s0_x_x*2), demosaicked_1_s0_y, 0) = select(((demosaicked_1_s0_y % 2) == 0), r_gr.stencil(demosaicked_1_s0_x_x, (demosaicked_1_s0_y/2)), r_b.stencil(demosaicked_1_s0_x_x, (demosaicked_1_s0_y/2)))
hw_uint<16> hcompute_demosaicked_1_stencil(hw_uint<16>& r_b_stencil, hw_uint<16>& r_gr_stencil, const int _demosaicked_1_s0_y) {
uint16_t _r_b_stencil_1 = (uint16_t) r_b_stencil.extract<0, 15>();
uint16_t _r_gr_stencil_1 = (uint16_t) r_gr_stencil.extract<0, 15>();
int32_t _846 = _demosaicked_1_s0_y & 1;
bool _847 = _846 == 0;
uint16_t _848 = (uint16_t)(_847 ? _r_gr_stencil_1 : _r_b_stencil_1);
return _848;
}
//store is: demosaicked$1.stencil((demosaicked_1_s0_x_x*2), demosaicked_1_s0_y, 1) = select(((demosaicked_1_s0_y % 2) == 0), g_gr.stencil((demosaicked_1_s0_x_x + 1), ((demosaicked_1_s0_y/2) + 1)), g_b.stencil(demosaicked_1_s0_x_x, ((demosaicked_1_s0_y/2) + 1)))
hw_uint<16> hcompute_demosaicked_1_stencil_1(hw_uint<16>& g_b_stencil, hw_uint<16>& g_gr_stencil, const int _demosaicked_1_s0_y) {
uint16_t _g_b_stencil_10 = (uint16_t) g_b_stencil.extract<0, 15>();
uint16_t _g_gr_stencil_7 = (uint16_t) g_gr_stencil.extract<0, 15>();
int32_t _860 = _demosaicked_1_s0_y & 1;
bool _861 = _860 == 0;
uint16_t _862 = (uint16_t)(_861 ? _g_gr_stencil_7 : _g_b_stencil_10);
return _862;
}
//store is: demosaicked$1.stencil((demosaicked_1_s0_x_x*2), demosaicked_1_s0_y, 2) = select(((demosaicked_1_s0_y % 2) == 0), b_gr.stencil(demosaicked_1_s0_x_x, (demosaicked_1_s0_y/2)), b_b.stencil(demosaicked_1_s0_x_x, ((demosaicked_1_s0_y/2) + 1)))
hw_uint<16> hcompute_demosaicked_1_stencil_2(hw_uint<16>& b_b_stencil, hw_uint<16>& b_gr_stencil, const int _demosaicked_1_s0_y) {
uint16_t _b_b_stencil_9 = (uint16_t) b_b_stencil.extract<0, 15>();
uint16_t _b_gr_stencil_1 = (uint16_t) b_gr_stencil.extract<0, 15>();
int32_t _876 = _demosaicked_1_s0_y & 1;
bool _877 = _876 == 0;
uint16_t _878 = (uint16_t)(_877 ? _b_gr_stencil_1 : _b_b_stencil_9);
return _878;
}
//store is: demosaicked$1.stencil(((demosaicked_1_s0_x_x*2) + 1), demosaicked_1_s0_y, 0) = select(((demosaicked_1_s0_y % 2) == 0), r_r.stencil((demosaicked_1_s0_x_x + 1), (demosaicked_1_s0_y/2)), r_gb.stencil(demosaicked_1_s0_x_x, (demosaicked_1_s0_y/2)))
hw_uint<16> hcompute_demosaicked_1_stencil_3(hw_uint<16>& r_gb_stencil, hw_uint<16>& r_r_stencil, const int _demosaicked_1_s0_y) {
uint16_t _r_gb_stencil_1 = (uint16_t) r_gb_stencil.extract<0, 15>();
uint16_t _r_r_stencil_9 = (uint16_t) r_r_stencil.extract<0, 15>();
int32_t _891 = _demosaicked_1_s0_y & 1;
bool _892 = _891 == 0;
uint16_t _893 = (uint16_t)(_892 ? _r_r_stencil_9 : _r_gb_stencil_1);
return _893;
}
//store is: demosaicked$1.stencil(((demosaicked_1_s0_x_x*2) + 1), demosaicked_1_s0_y, 1) = select(((demosaicked_1_s0_y % 2) == 0), g_r.stencil((demosaicked_1_s0_x_x + 1), (demosaicked_1_s0_y/2)), g_gb.stencil((demosaicked_1_s0_x_x + 1), ((demosaicked_1_s0_y/2) + 1)))
hw_uint<16> hcompute_demosaicked_1_stencil_4(hw_uint<16>& g_gb_stencil, hw_uint<16>& g_r_stencil, const int _demosaicked_1_s0_y) {
uint16_t _g_gb_stencil_7 = (uint16_t) g_gb_stencil.extract<0, 15>();
uint16_t _g_r_stencil_10 = (uint16_t) g_r_stencil.extract<0, 15>();
int32_t _907 = _demosaicked_1_s0_y & 1;
bool _908 = _907 == 0;
uint16_t _909 = (uint16_t)(_908 ? _g_r_stencil_10 : _g_gb_stencil_7);
return _909;
}
//store is: demosaicked$1.stencil(((demosaicked_1_s0_x_x*2) + 1), demosaicked_1_s0_y, 2) = select(((demosaicked_1_s0_y % 2) == 0), b_r.stencil(demosaicked_1_s0_x_x, (demosaicked_1_s0_y/2)), b_gb.stencil(demosaicked_1_s0_x_x, (demosaicked_1_s0_y/2)))
hw_uint<16> hcompute_demosaicked_1_stencil_5(hw_uint<16>& b_gb_stencil, hw_uint<16>& b_r_stencil, const int _demosaicked_1_s0_y) {
uint16_t _b_gb_stencil_1 = (uint16_t) b_gb_stencil.extract<0, 15>();
uint16_t _b_r_stencil_1 = (uint16_t) b_r_stencil.extract<0, 15>();
int32_t _924 = _demosaicked_1_s0_y & 1;
bool _925 = _924 == 0;
uint16_t _926 = (uint16_t)(_925 ? _b_r_stencil_1 : _b_gb_stencil_1);
return _926;
}
//store is: corrected.stencil((corrected_s0_x_x*2), corrected_s0_y, 0) = (((int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x*2), corrected_s0_y, 0), (uint16)10000))*549)/256)) + int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x*2), corrected_s0_y, 1), (uint16)10000))*-103)/256))) + int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x*2), corrected_s0_y, 2), (uint16)10000))*7)/256))) + (int16)-40)
hw_uint<16> hcompute_corrected_stencil(hw_uint<48>& demosaicked_1_stencil) {
uint16_t _demosaicked_1_stencil_1 = (uint16_t) demosaicked_1_stencil.extract<0, 15>();
uint16_t _demosaicked_1_stencil_2 = (uint16_t) demosaicked_1_stencil.extract<16, 31>();
uint16_t _demosaicked_1_stencil_3 = (uint16_t) demosaicked_1_stencil.extract<32, 47>();
uint16_t _939 = (uint16_t)(10000);
uint16_t _940 = min(_demosaicked_1_stencil_1, _939);
int32_t _941 = (int32_t)(_940);
int32_t _942 = _941 * 549;
int32_t _943 = _942 >> 8;
int16_t _944 = (int16_t)(_943);
uint16_t _945 = min(_demosaicked_1_stencil_2, _939);
int32_t _946 = (int32_t)(_945);
int32_t _947 = _946 * -103;
int32_t _948 = _947 >> 8;
int16_t _949 = (int16_t)(_948);
int16_t _950 = _944 + _949;
uint16_t _951 = min(_demosaicked_1_stencil_3, _939);
int32_t _952 = (int32_t)(_951);
int32_t _953 = _952 * 7;
int32_t _954 = _953 >> 8;
int16_t _955 = (int16_t)(_954);
int16_t _956 = _950 + _955;
int16_t _957 = (int16_t)(-40);
int16_t _958 = _956 + _957;
return _958;
}
//store is: corrected.stencil(((corrected_s0_x_x*2) + 1), corrected_s0_y, 0) = (((int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x*2) + 1), corrected_s0_y, 0), (uint16)10000))*549)/256)) + int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x*2) + 1), corrected_s0_y, 1), (uint16)10000))*-103)/256))) + int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x*2) + 1), corrected_s0_y, 2), (uint16)10000))*7)/256))) + (int16)-40)
hw_uint<16> hcompute_corrected_stencil_1(hw_uint<48>& demosaicked_1_stencil) {
uint16_t _demosaicked_1_stencil_4 = (uint16_t) demosaicked_1_stencil.extract<0, 15>();
uint16_t _demosaicked_1_stencil_5 = (uint16_t) demosaicked_1_stencil.extract<16, 31>();
uint16_t _demosaicked_1_stencil_6 = (uint16_t) demosaicked_1_stencil.extract<32, 47>();
uint16_t _997 = (uint16_t)(10000);
uint16_t _998 = min(_demosaicked_1_stencil_4, _997);
int32_t _999 = (int32_t)(_998);
int32_t _1000 = _999 * 549;
int32_t _1001 = _1000 >> 8;
int16_t _1002 = (int16_t)(_1001);
uint16_t _1003 = min(_demosaicked_1_stencil_5, _997);
int32_t _1004 = (int32_t)(_1003);
int32_t _1005 = _1004 * -103;
int32_t _1006 = _1005 >> 8;
int16_t _1007 = (int16_t)(_1006);
int16_t _1008 = _1002 + _1007;
uint16_t _1009 = min(_demosaicked_1_stencil_6, _997);
int32_t _1010 = (int32_t)(_1009);
int32_t _1011 = _1010 * 7;
int32_t _1012 = _1011 >> 8;
int16_t _1013 = (int16_t)(_1012);
int16_t _1014 = _1008 + _1013;
int16_t _1015 = (int16_t)(-40);
int16_t _1016 = _1014 + _1015;
return _1016;
}
//store is: corrected.stencil((corrected_s0_x_x_1*2), corrected_s0_y_1, 1) = (((int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x_1*2), corrected_s0_y_1, 0), (uint16)10000))*-96)/256)) + int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x_1*2), corrected_s0_y_1, 1), (uint16)10000))*373)/256))) + int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x_1*2), corrected_s0_y_1, 2), (uint16)10000))*62)/256))) + (int16)-29)
hw_uint<16> hcompute_corrected_stencil_2(hw_uint<48>& demosaicked_1_stencil) {
uint16_t _demosaicked_1_stencil_7 = (uint16_t) demosaicked_1_stencil.extract<0, 15>();
uint16_t _demosaicked_1_stencil_8 = (uint16_t) demosaicked_1_stencil.extract<16, 31>();
uint16_t _demosaicked_1_stencil_9 = (uint16_t) demosaicked_1_stencil.extract<32, 47>();
uint16_t _1056 = (uint16_t)(10000);
uint16_t _1057 = min(_demosaicked_1_stencil_7, _1056);
int32_t _1058 = (int32_t)(_1057);
int32_t _1059 = _1058 * -96;
int32_t _1060 = _1059 >> 8;
int16_t _1061 = (int16_t)(_1060);
uint16_t _1062 = min(_demosaicked_1_stencil_8, _1056);
int32_t _1063 = (int32_t)(_1062);
int32_t _1064 = _1063 * 373;
int32_t _1065 = _1064 >> 8;
int16_t _1066 = (int16_t)(_1065);
int16_t _1067 = _1061 + _1066;
uint16_t _1068 = min(_demosaicked_1_stencil_9, _1056);
int32_t _1069 = (int32_t)(_1068);
int32_t _1070 = _1069 * 62;
int32_t _1071 = _1070 >> 8;
int16_t _1072 = (int16_t)(_1071);
int16_t _1073 = _1067 + _1072;
int16_t _1074 = (int16_t)(-29);
int16_t _1075 = _1073 + _1074;
return _1075;
}
//store is: corrected.stencil(((corrected_s0_x_x_1*2) + 1), corrected_s0_y_1, 1) = (((int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x_1*2) + 1), corrected_s0_y_1, 0), (uint16)10000))*-96)/256)) + int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x_1*2) + 1), corrected_s0_y_1, 1), (uint16)10000))*373)/256))) + int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x_1*2) + 1), corrected_s0_y_1, 2), (uint16)10000))*62)/256))) + (int16)-29)
hw_uint<16> hcompute_corrected_stencil_3(hw_uint<48>& demosaicked_1_stencil) {
uint16_t _demosaicked_1_stencil_10 = (uint16_t) demosaicked_1_stencil.extract<0, 15>();
uint16_t _demosaicked_1_stencil_11 = (uint16_t) demosaicked_1_stencil.extract<16, 31>();
uint16_t _demosaicked_1_stencil_12 = (uint16_t) demosaicked_1_stencil.extract<32, 47>();
uint16_t _1114 = (uint16_t)(10000);
uint16_t _1115 = min(_demosaicked_1_stencil_10, _1114);
int32_t _1116 = (int32_t)(_1115);
int32_t _1117 = _1116 * -96;
int32_t _1118 = _1117 >> 8;
int16_t _1119 = (int16_t)(_1118);
uint16_t _1120 = min(_demosaicked_1_stencil_11, _1114);
int32_t _1121 = (int32_t)(_1120);
int32_t _1122 = _1121 * 373;
int32_t _1123 = _1122 >> 8;
int16_t _1124 = (int16_t)(_1123);
int16_t _1125 = _1119 + _1124;
uint16_t _1126 = min(_demosaicked_1_stencil_12, _1114);
int32_t _1127 = (int32_t)(_1126);
int32_t _1128 = _1127 * 62;
int32_t _1129 = _1128 >> 8;
int16_t _1130 = (int16_t)(_1129);
int16_t _1131 = _1125 + _1130;
int16_t _1132 = (int16_t)(-29);
int16_t _1133 = _1131 + _1132;
return _1133;
}
//store is: corrected.stencil((corrected_s0_x_x_2*2), corrected_s0_y_2, 2) = (((int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x_2*2), corrected_s0_y_2, 0), (uint16)10000))*-31)/256)) + int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x_2*2), corrected_s0_y_2, 1), (uint16)10000))*-261)/256))) + int16(((int32(min(demosaicked$1.stencil((corrected_s0_x_x_2*2), corrected_s0_y_2, 2), (uint16)10000))*883)/256))) + (int16)-22)
hw_uint<16> hcompute_corrected_stencil_4(hw_uint<48>& demosaicked_1_stencil) {
uint16_t _demosaicked_1_stencil_13 = (uint16_t) demosaicked_1_stencil.extract<0, 15>();
uint16_t _demosaicked_1_stencil_14 = (uint16_t) demosaicked_1_stencil.extract<16, 31>();
uint16_t _demosaicked_1_stencil_15 = (uint16_t) demosaicked_1_stencil.extract<32, 47>();
uint16_t _1173 = (uint16_t)(10000);
uint16_t _1174 = min(_demosaicked_1_stencil_13, _1173);
int32_t _1175 = (int32_t)(_1174);
int32_t _1176 = _1175 * -31;
int32_t _1177 = _1176 >> 8;
int16_t _1178 = (int16_t)(_1177);
uint16_t _1179 = min(_demosaicked_1_stencil_14, _1173);
int32_t _1180 = (int32_t)(_1179);
int32_t _1181 = _1180 * -261;
int32_t _1182 = _1181 >> 8;
int16_t _1183 = (int16_t)(_1182);
int16_t _1184 = _1178 + _1183;
uint16_t _1185 = min(_demosaicked_1_stencil_15, _1173);
int32_t _1186 = (int32_t)(_1185);
int32_t _1187 = _1186 * 883;
int32_t _1188 = _1187 >> 8;
int16_t _1189 = (int16_t)(_1188);
int16_t _1190 = _1184 + _1189;
int16_t _1191 = (int16_t)(-22);
int16_t _1192 = _1190 + _1191;
return _1192;
}
//store is: corrected.stencil(((corrected_s0_x_x_2*2) + 1), corrected_s0_y_2, 2) = (((int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x_2*2) + 1), corrected_s0_y_2, 0), (uint16)10000))*-31)/256)) + int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x_2*2) + 1), corrected_s0_y_2, 1), (uint16)10000))*-261)/256))) + int16(((int32(min(demosaicked$1.stencil(((corrected_s0_x_x_2*2) + 1), corrected_s0_y_2, 2), (uint16)10000))*883)/256))) + (int16)-22)
hw_uint<16> hcompute_corrected_stencil_5(hw_uint<48>& demosaicked_1_stencil) {
uint16_t _demosaicked_1_stencil_16 = (uint16_t) demosaicked_1_stencil.extract<0, 15>();
uint16_t _demosaicked_1_stencil_17 = (uint16_t) demosaicked_1_stencil.extract<16, 31>();
uint16_t _demosaicked_1_stencil_18 = (uint16_t) demosaicked_1_stencil.extract<32, 47>();
uint16_t _1231 = (uint16_t)(10000);
uint16_t _1232 = min(_demosaicked_1_stencil_16, _1231);
int32_t _1233 = (int32_t)(_1232);
int32_t _1234 = _1233 * -31;
int32_t _1235 = _1234 >> 8;
int16_t _1236 = (int16_t)(_1235);
uint16_t _1237 = min(_demosaicked_1_stencil_17, _1231);
int32_t _1238 = (int32_t)(_1237);
int32_t _1239 = _1238 * -261;
int32_t _1240 = _1239 >> 8;
int16_t _1241 = (int16_t)(_1240);
int16_t _1242 = _1236 + _1241;
uint16_t _1243 = min(_demosaicked_1_stencil_18, _1231);
int32_t _1244 = (int32_t)(_1243);
int32_t _1245 = _1244 * 883;
int32_t _1246 = _1245 >> 8;
int16_t _1247 = (int16_t)(_1246);
int16_t _1248 = _1242 + _1247;
int16_t _1249 = (int16_t)(-22);
int16_t _1250 = _1248 + _1249;
return _1250;
}
//store is: curved.stencil((curved_s0_x_x*2), curved_s0_y, 0) = curvea0[int32(uint16(max(min(corrected.stencil((curved_s0_x_x*2), curved_s0_y, 0), (int16)1023), (int16)0)))]
hw_uint<16> hcompute_curved_stencil(hw_uint<16>& corrected_stencil) {
int16_t _corrected_stencil_1 = (int16_t) corrected_stencil.extract<0, 15>();
uint16_t _curvea0[1024];
// produce curvea0
uint16_t _2314 = (uint16_t)(0);
_curvea0[0] = _2314;
uint16_t _2315 = (uint16_t)(4);
_curvea0[1] = _2315;
uint16_t _2316 = (uint16_t)(7);
_curvea0[2] = _2316;
uint16_t _2317 = (uint16_t)(8);
_curvea0[3] = _2317;
uint16_t _2318 = (uint16_t)(10);
_curvea0[4] = _2318;
uint16_t _2319 = (uint16_t)(11);
_curvea0[5] = _2319;
uint16_t _2320 = (uint16_t)(12);
_curvea0[6] = _2320;
uint16_t _2321 = (uint16_t)(13);
_curvea0[7] = _2321;
uint16_t _2322 = (uint16_t)(14);
_curvea0[8] = _2322;
uint16_t _2323 = (uint16_t)(15);
_curvea0[9] = _2323;
uint16_t _2324 = (uint16_t)(16);
_curvea0[10] = _2324;
uint16_t _2325 = (uint16_t)(17);
_curvea0[11] = _2325;
uint16_t _2326 = (uint16_t)(18);
_curvea0[12] = _2326;
uint16_t _2327 = (uint16_t)(19);
_curvea0[13] = _2327;
uint16_t _2328 = (uint16_t)(20);
_curvea0[14] = _2328;
uint16_t _2329 = (uint16_t)(21);
_curvea0[15] = _2329;
uint16_t _2330 = (uint16_t)(22);
_curvea0[16] = _2330;
uint16_t _2331 = (uint16_t)(22);
_curvea0[17] = _2331;
uint16_t _2332 = (uint16_t)(23);
_curvea0[18] = _2332;
uint16_t _2333 = (uint16_t)(24);
_curvea0[19] = _2333;
uint16_t _2334 = (uint16_t)(25);
_curvea0[20] = _2334;
uint16_t _2335 = (uint16_t)(25);
_curvea0[21] = _2335;
uint16_t _2336 = (uint16_t)(26);
_curvea0[22] = _2336;
uint16_t _2337 = (uint16_t)(27);
_curvea0[23] = _2337;
uint16_t _2338 = (uint16_t)(27);
_curvea0[24] = _2338;
uint16_t _2339 = (uint16_t)(28);
_curvea0[25] = _2339;
uint16_t _2340 = (uint16_t)(29);
_curvea0[26] = _2340;
uint16_t _2341 = (uint16_t)(29);
_curvea0[27] = _2341;
uint16_t _2342 = (uint16_t)(30);
_curvea0[28] = _2342;
uint16_t _2343 = (uint16_t)(31);
_curvea0[29] = _2343;
uint16_t _2344 = (uint16_t)(31);
_curvea0[30] = _2344;
uint16_t _2345 = (uint16_t)(32);
_curvea0[31] = _2345;
uint16_t _2346 = (uint16_t)(33);
_curvea0[32] = _2346;
uint16_t _2347 = (uint16_t)(33);
_curvea0[33] = _2347;
uint16_t _2348 = (uint16_t)(34);
_curvea0[34] = _2348;
uint16_t _2349 = (uint16_t)(34);
_curvea0[35] = _2349;
uint16_t _2350 = (uint16_t)(35);
_curvea0[36] = _2350;
uint16_t _2351 = (uint16_t)(36);
_curvea0[37] = _2351;
uint16_t _2352 = (uint16_t)(36);
_curvea0[38] = _2352;
uint16_t _2353 = (uint16_t)(37);
_curvea0[39] = _2353;
uint16_t _2354 = (uint16_t)(37);
_curvea0[40] = _2354;
uint16_t _2355 = (uint16_t)(38);
_curvea0[41] = _2355;
uint16_t _2356 = (uint16_t)(39);
_curvea0[42] = _2356;
uint16_t _2357 = (uint16_t)(39);
_curvea0[43] = _2357;
uint16_t _2358 = (uint16_t)(40);
_curvea0[44] = _2358;
uint16_t _2359 = (uint16_t)(40);
_curvea0[45] = _2359;
uint16_t _2360 = (uint16_t)(41);
_curvea0[46] = _2360;
uint16_t _2361 = (uint16_t)(41);
_curvea0[47] = _2361;
uint16_t _2362 = (uint16_t)(42);
_curvea0[48] = _2362;
uint16_t _2363 = (uint16_t)(42);
_curvea0[49] = _2363;
uint16_t _2364 = (uint16_t)(43);
_curvea0[50] = _2364;
uint16_t _2365 = (uint16_t)(44);
_curvea0[51] = _2365;
uint16_t _2366 = (uint16_t)(44);
_curvea0[52] = _2366;
uint16_t _2367 = (uint16_t)(45);
_curvea0[53] = _2367;
uint16_t _2368 = (uint16_t)(45);
_curvea0[54] = _2368;
uint16_t _2369 = (uint16_t)(46);
_curvea0[55] = _2369;
uint16_t _2370 = (uint16_t)(46);
_curvea0[56] = _2370;
uint16_t _2371 = (uint16_t)(47);
_curvea0[57] = _2371;
uint16_t _2372 = (uint16_t)(47);
_curvea0[58] = _2372;
uint16_t _2373 = (uint16_t)(48);
_curvea0[59] = _2373;
uint16_t _2374 = (uint16_t)(48);
_curvea0[60] = _2374;
uint16_t _2375 = (uint16_t)(49);
_curvea0[61] = _2375;
uint16_t _2376 = (uint16_t)(49);
_curvea0[62] = _2376;
uint16_t _2377 = (uint16_t)(50);
_curvea0[63] = _2377;
uint16_t _2378 = (uint16_t)(50);
_curvea0[64] = _2378;
uint16_t _2379 = (uint16_t)(51);
_curvea0[65] = _2379;
uint16_t _2380 = (uint16_t)(51);
_curvea0[66] = _2380;
uint16_t _2381 = (uint16_t)(52);
_curvea0[67] = _2381;
uint16_t _2382 = (uint16_t)(52);
_curvea0[68] = _2382;
uint16_t _2383 = (uint16_t)(53);
_curvea0[69] = _2383;
uint16_t _2384 = (uint16_t)(53);
_curvea0[70] = _2384;
uint16_t _2385 = (uint16_t)(54);
_curvea0[71] = _2385;
uint16_t _2386 = (uint16_t)(54);
_curvea0[72] = _2386;
uint16_t _2387 = (uint16_t)(55);
_curvea0[73] = _2387;
uint16_t _2388 = (uint16_t)(55);
_curvea0[74] = _2388;
uint16_t _2389 = (uint16_t)(56);
_curvea0[75] = _2389;
uint16_t _2390 = (uint16_t)(56);
_curvea0[76] = _2390;
uint16_t _2391 = (uint16_t)(57);
_curvea0[77] = _2391;
uint16_t _2392 = (uint16_t)(57);
_curvea0[78] = _2392;
uint16_t _2393 = (uint16_t)(58);
_curvea0[79] = _2393;
uint16_t _2394 = (uint16_t)(58);
_curvea0[80] = _2394;
uint16_t _2395 = (uint16_t)(58);
_curvea0[81] = _2395;
uint16_t _2396 = (uint16_t)(59);
_curvea0[82] = _2396;
uint16_t _2397 = (uint16_t)(59);
_curvea0[83] = _2397;
uint16_t _2398 = (uint16_t)(60);
_curvea0[84] = _2398;
uint16_t _2399 = (uint16_t)(60);
_curvea0[85] = _2399;
uint16_t _2400 = (uint16_t)(61);
_curvea0[86] = _2400;
uint16_t _2401 = (uint16_t)(61);
_curvea0[87] = _2401;
uint16_t _2402 = (uint16_t)(62);
_curvea0[88] = _2402;
uint16_t _2403 = (uint16_t)(62);
_curvea0[89] = _2403;
uint16_t _2404 = (uint16_t)(63);
_curvea0[90] = _2404;
uint16_t _2405 = (uint16_t)(63);
_curvea0[91] = _2405;
uint16_t _2406 = (uint16_t)(64);
_curvea0[92] = _2406;
uint16_t _2407 = (uint16_t)(64);
_curvea0[93] = _2407;
uint16_t _2408 = (uint16_t)(64);
_curvea0[94] = _2408;
uint16_t _2409 = (uint16_t)(65);
_curvea0[95] = _2409;
uint16_t _2410 = (uint16_t)(65);
_curvea0[96] = _2410;
uint16_t _2411 = (uint16_t)(66);
_curvea0[97] = _2411;
uint16_t _2412 = (uint16_t)(66);
_curvea0[98] = _2412;
uint16_t _2413 = (uint16_t)(67);
_curvea0[99] = _2413;
uint16_t _2414 = (uint16_t)(67);
_curvea0[100] = _2414;
uint16_t _2415 = (uint16_t)(68);
_curvea0[101] = _2415;
uint16_t _2416 = (uint16_t)(68);
_curvea0[102] = _2416;
uint16_t _2417 = (uint16_t)(68);
_curvea0[103] = _2417;
uint16_t _2418 = (uint16_t)(69);
_curvea0[104] = _2418;
uint16_t _2419 = (uint16_t)(69);
_curvea0[105] = _2419;
uint16_t _2420 = (uint16_t)(70);
_curvea0[106] = _2420;
uint16_t _2421 = (uint16_t)(70);
_curvea0[107] = _2421;
uint16_t _2422 = (uint16_t)(71);
_curvea0[108] = _2422;
uint16_t _2423 = (uint16_t)(71);
_curvea0[109] = _2423;
uint16_t _2424 = (uint16_t)(71);
_curvea0[110] = _2424;
uint16_t _2425 = (uint16_t)(72);
_curvea0[111] = _2425;
uint16_t _2426 = (uint16_t)(72);
_curvea0[112] = _2426;
uint16_t _2427 = (uint16_t)(73);
_curvea0[113] = _2427;
uint16_t _2428 = (uint16_t)(73);
_curvea0[114] = _2428;
uint16_t _2429 = (uint16_t)(74);
_curvea0[115] = _2429;
uint16_t _2430 = (uint16_t)(74);
_curvea0[116] = _2430;
uint16_t _2431 = (uint16_t)(74);
_curvea0[117] = _2431;
uint16_t _2432 = (uint16_t)(75);
_curvea0[118] = _2432;
uint16_t _2433 = (uint16_t)(75);
_curvea0[119] = _2433;
uint16_t _2434 = (uint16_t)(76);
_curvea0[120] = _2434;
uint16_t _2435 = (uint16_t)(76);
_curvea0[121] = _2435;
uint16_t _2436 = (uint16_t)(77);
_curvea0[122] = _2436;
uint16_t _2437 = (uint16_t)(77);
_curvea0[123] = _2437;
uint16_t _2438 = (uint16_t)(77);
_curvea0[124] = _2438;
uint16_t _2439 = (uint16_t)(78);
_curvea0[125] = _2439;
uint16_t _2440 = (uint16_t)(78);
_curvea0[126] = _2440;
uint16_t _2441 = (uint16_t)(79);
_curvea0[127] = _2441;
uint16_t _2442 = (uint16_t)(79);
_curvea0[128] = _2442;
uint16_t _2443 = (uint16_t)(79);
_curvea0[129] = _2443;
uint16_t _2444 = (uint16_t)(80);
_curvea0[130] = _2444;
uint16_t _2445 = (uint16_t)(80);
_curvea0[131] = _2445;
uint16_t _2446 = (uint16_t)(81);
_curvea0[132] = _2446;
uint16_t _2447 = (uint16_t)(81);
_curvea0[133] = _2447;
uint16_t _2448 = (uint16_t)(82);
_curvea0[134] = _2448;
uint16_t _2449 = (uint16_t)(82);
_curvea0[135] = _2449;
uint16_t _2450 = (uint16_t)(82);
_curvea0[136] = _2450;
uint16_t _2451 = (uint16_t)(83);
_curvea0[137] = _2451;
uint16_t _2452 = (uint16_t)(83);
_curvea0[138] = _2452;
uint16_t _2453 = (uint16_t)(84);
_curvea0[139] = _2453;
uint16_t _2454 = (uint16_t)(84);
_curvea0[140] = _2454;
uint16_t _2455 = (uint16_t)(84);
_curvea0[141] = _2455;
uint16_t _2456 = (uint16_t)(85);
_curvea0[142] = _2456;
uint16_t _2457 = (uint16_t)(85);
_curvea0[143] = _2457;
uint16_t _2458 = (uint16_t)(86);
_curvea0[144] = _2458;
uint16_t _2459 = (uint16_t)(86);
_curvea0[145] = _2459;
uint16_t _2460 = (uint16_t)(86);
_curvea0[146] = _2460;
uint16_t _2461 = (uint16_t)(87);
_curvea0[147] = _2461;
uint16_t _2462 = (uint16_t)(87);
_curvea0[148] = _2462;
uint16_t _2463 = (uint16_t)(88);
_curvea0[149] = _2463;
uint16_t _2464 = (uint16_t)(88);
_curvea0[150] = _2464;
uint16_t _2465 = (uint16_t)(88);
_curvea0[151] = _2465;
uint16_t _2466 = (uint16_t)(89);
_curvea0[152] = _2466;
uint16_t _2467 = (uint16_t)(89);
_curvea0[153] = _2467;
uint16_t _2468 = (uint16_t)(90);
_curvea0[154] = _2468;
uint16_t _2469 = (uint16_t)(90);
_curvea0[155] = _2469;
uint16_t _2470 = (uint16_t)(90);
_curvea0[156] = _2470;
uint16_t _2471 = (uint16_t)(91);
_curvea0[157] = _2471;
uint16_t _2472 = (uint16_t)(91);
_curvea0[158] = _2472;
uint16_t _2473 = (uint16_t)(92);
_curvea0[159] = _2473;
uint16_t _2474 = (uint16_t)(92);
_curvea0[160] = _2474;
uint16_t _2475 = (uint16_t)(92);
_curvea0[161] = _2475;
uint16_t _2476 = (uint16_t)(93);
_curvea0[162] = _2476;
uint16_t _2477 = (uint16_t)(93);
_curvea0[163] = _2477;
uint16_t _2478 = (uint16_t)(93);
_curvea0[164] = _2478;
uint16_t _2479 = (uint16_t)(94);
_curvea0[165] = _2479;
uint16_t _2480 = (uint16_t)(94);
_curvea0[166] = _2480;
uint16_t _2481 = (uint16_t)(95);
_curvea0[167] = _2481;
uint16_t _2482 = (uint16_t)(95);
_curvea0[168] = _2482;
uint16_t _2483 = (uint16_t)(95);
_curvea0[169] = _2483;
uint16_t _2484 = (uint16_t)(96);
_curvea0[170] = _2484;
uint16_t _2485 = (uint16_t)(96);
_curvea0[171] = _2485;
uint16_t _2486 = (uint16_t)(97);
_curvea0[172] = _2486;
uint16_t _2487 = (uint16_t)(97);
_curvea0[173] = _2487;
uint16_t _2488 = (uint16_t)(97);
_curvea0[174] = _2488;
uint16_t _2489 = (uint16_t)(98);
_curvea0[175] = _2489;
uint16_t _2490 = (uint16_t)(98);
_curvea0[176] = _2490;
uint16_t _2491 = (uint16_t)(99);
_curvea0[177] = _2491;
uint16_t _2492 = (uint16_t)(99);
_curvea0[178] = _2492;
uint16_t _2493 = (uint16_t)(99);
_curvea0[179] = _2493;
uint16_t _2494 = (uint16_t)(100);
_curvea0[180] = _2494;
uint16_t _2495 = (uint16_t)(100);
_curvea0[181] = _2495;
uint16_t _2496 = (uint16_t)(100);
_curvea0[182] = _2496;
uint16_t _2497 = (uint16_t)(101);
_curvea0[183] = _2497;
uint16_t _2498 = (uint16_t)(101);
_curvea0[184] = _2498;
uint16_t _2499 = (uint16_t)(102);
_curvea0[185] = _2499;
uint16_t _2500 = (uint16_t)(102);
_curvea0[186] = _2500;
uint16_t _2501 = (uint16_t)(102);
_curvea0[187] = _2501;
uint16_t _2502 = (uint16_t)(103);
_curvea0[188] = _2502;
uint16_t _2503 = (uint16_t)(103);
_curvea0[189] = _2503;
uint16_t _2504 = (uint16_t)(103);
_curvea0[190] = _2504;
uint16_t _2505 = (uint16_t)(104);
_curvea0[191] = _2505;
uint16_t _2506 = (uint16_t)(104);
_curvea0[192] = _2506;
uint16_t _2507 = (uint16_t)(105);
_curvea0[193] = _2507;
uint16_t _2508 = (uint16_t)(105);
_curvea0[194] = _2508;
uint16_t _2509 = (uint16_t)(105);
_curvea0[195] = _2509;
uint16_t _2510 = (uint16_t)(106);
_curvea0[196] = _2510;
uint16_t _2511 = (uint16_t)(106);
_curvea0[197] = _2511;
uint16_t _2512 = (uint16_t)(106);
_curvea0[198] = _2512;
uint16_t _2513 = (uint16_t)(107);
_curvea0[199] = _2513;
uint16_t _2514 = (uint16_t)(107);
_curvea0[200] = _2514;
uint16_t _2515 = (uint16_t)(108);
_curvea0[201] = _2515;
uint16_t _2516 = (uint16_t)(108);
_curvea0[202] = _2516;
uint16_t _2517 = (uint16_t)(108);
_curvea0[203] = _2517;
uint16_t _2518 = (uint16_t)(109);