forked from dillonhuff/clockwork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera_pipeline_compute.h
2039 lines (2006 loc) · 85.2 KB
/
camera_pipeline_compute.h
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 "conv_3x3.h"
//store is: hw_input_global_wrapper.stencil(hw_input_global_wrapper_s0_x, hw_input_global_wrapper_s0_y) = hw_input.stencil(hw_input_global_wrapper_s0_x, hw_input_global_wrapper_s0_y)
hw_uint<16> hcompute_hw_input_global_wrapper_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: denoised$1.stencil(denoised_1_s0_x, denoised_1_s0_y) = max(min(hw_input_global_wrapper.stencil(denoised_1_s0_x, denoised_1_s0_y), max(hw_input_global_wrapper.stencil(denoised_1_s0_x, (denoised_1_s0_y + 2)), max(hw_input_global_wrapper.stencil(denoised_1_s0_x, (denoised_1_s0_y + -2)), max(hw_input_global_wrapper.stencil((denoised_1_s0_x + -2), denoised_1_s0_y), hw_input_global_wrapper.stencil((denoised_1_s0_x + 2), denoised_1_s0_y))))), min(hw_input_global_wrapper.stencil(denoised_1_s0_x, (denoised_1_s0_y + 2)), min(hw_input_global_wrapper.stencil(denoised_1_s0_x, (denoised_1_s0_y + -2)), min(hw_input_global_wrapper.stencil((denoised_1_s0_x + -2), denoised_1_s0_y), hw_input_global_wrapper.stencil((denoised_1_s0_x + 2), denoised_1_s0_y)))))
hw_uint<16> hcompute_denoised_1_stencil(hw_uint<80>& hw_input_global_wrapper_stencil) {
uint16_t _hw_input_global_wrapper_stencil_1 = (uint16_t) hw_input_global_wrapper_stencil.extract<0, 15>();
uint16_t _hw_input_global_wrapper_stencil_2 = (uint16_t) hw_input_global_wrapper_stencil.extract<16, 31>();
uint16_t _hw_input_global_wrapper_stencil_3 = (uint16_t) hw_input_global_wrapper_stencil.extract<32, 47>();
uint16_t _hw_input_global_wrapper_stencil_4 = (uint16_t) hw_input_global_wrapper_stencil.extract<48, 63>();
uint16_t _hw_input_global_wrapper_stencil_5 = (uint16_t) hw_input_global_wrapper_stencil.extract<64, 79>();
uint16_t _322 = max(_hw_input_global_wrapper_stencil_4, _hw_input_global_wrapper_stencil_5);
uint16_t _323 = max(_hw_input_global_wrapper_stencil_3, _322);
uint16_t _324 = max(_hw_input_global_wrapper_stencil_2, _323);
uint16_t _325 = min(_hw_input_global_wrapper_stencil_1, _324);
uint16_t _326 = min(_hw_input_global_wrapper_stencil_4, _hw_input_global_wrapper_stencil_5);
uint16_t _327 = min(_hw_input_global_wrapper_stencil_3, _326);
uint16_t _328 = min(_hw_input_global_wrapper_stencil_2, _327);
uint16_t _329 = max(_325, _328);
return _329;
}
//store is: demosaicked$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y, 0) = select(((demosaicked_1_s0_y % 2) == 0), select(((demosaicked_1_s0_x % 2) == 0), ((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) + (uint16)1)/(uint16)2)) - (((select((absd(denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) < absd(denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + 1)))), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + 1))) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + -1), demosaicked_1_s0_y)) < absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + 1)))), (((denoised$1.stencil((demosaicked_1_s0_x + -1), demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + 1)) + denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2)), denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)), select(((demosaicked_1_s0_x % 2) == 0), select((absd(denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + -1)), denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) < absd(denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)), denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y))), (((((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2) + select((absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) < absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)))), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2))) - (((select((absd(denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + -1)), denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) < absd(denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + -1)), denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y))), (((denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)) + denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2), (((denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + -1)) + denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + -1), demosaicked_1_s0_y)) < absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + 1)))), (((denoised$1.stencil((demosaicked_1_s0_x + -1), demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + 1)) + denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2)), (((((denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2) + select((absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) < absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)))), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2))) - (((select((absd(denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) < absd(denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + 1)))), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil((demosaicked_1_s0_x + 1), demosaicked_1_s0_y) + denoised$1.stencil((demosaicked_1_s0_x + 1), (demosaicked_1_s0_y + 1))) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)), denoised$1.stencil((demosaicked_1_s0_x + -1), (demosaicked_1_s0_y + -1))) < absd(denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)), denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y))), (((denoised$1.stencil((demosaicked_1_s0_x + -1), (demosaicked_1_s0_y + -1)) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2))), ((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2)) - (((select((absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil((demosaicked_1_s0_x + -1), demosaicked_1_s0_y)) < absd(denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y), denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + 1)))), (((denoised$1.stencil((demosaicked_1_s0_x + -1), demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + 1)) + denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y)) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)), denoised$1.stencil((demosaicked_1_s0_x + -1), (demosaicked_1_s0_y + -1))) < absd(denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1)), denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y))), (((denoised$1.stencil((demosaicked_1_s0_x + -1), (demosaicked_1_s0_y + -1)) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x, demosaicked_1_s0_y) + denoised$1.stencil(demosaicked_1_s0_x, (demosaicked_1_s0_y + -1))) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2))))
hw_uint<16> hcompute_demosaicked_1_stencil(hw_uint<128>& denoised_1_stencil, const int _demosaicked_1_s0_x, const int _demosaicked_1_s0_y) {
uint16_t _denoised_1_stencil_1 = (uint16_t) denoised_1_stencil.extract<0, 15>();
uint16_t _denoised_1_stencil_2 = (uint16_t) denoised_1_stencil.extract<16, 31>();
uint16_t _denoised_1_stencil_3 = (uint16_t) denoised_1_stencil.extract<32, 47>();
uint16_t _denoised_1_stencil_4 = (uint16_t) denoised_1_stencil.extract<48, 63>();
uint16_t _denoised_1_stencil_5 = (uint16_t) denoised_1_stencil.extract<64, 79>();
uint16_t _denoised_1_stencil_6 = (uint16_t) denoised_1_stencil.extract<80, 95>();
uint16_t _denoised_1_stencil_7 = (uint16_t) denoised_1_stencil.extract<96, 111>();
uint16_t _denoised_1_stencil_8 = (uint16_t) denoised_1_stencil.extract<112, 127>();
uint16_t _355 = _denoised_1_stencil_1 + _denoised_1_stencil_2;
uint16_t _356 = (uint16_t)(1);
uint16_t _357 = _355 + _356;
uint16_t _358 = _357 >> _356;
uint16_t _359 = _denoised_1_stencil_1 + _358;
uint16_t _360 = _denoised_1_stencil_2 + _denoised_1_stencil_3;
uint16_t _361 = _360 + _356;
uint16_t _362 = _361 >> _356;
uint16_t _363 = _denoised_1_stencil_1 - _denoised_1_stencil_2;
uint16_t _364 = _denoised_1_stencil_2 - _denoised_1_stencil_1;
bool _365 = _denoised_1_stencil_2 < _denoised_1_stencil_1;
uint16_t _366 = (uint16_t)(_365 ? _363 : _364);
uint16_t _367 = _366;
uint16_t _368 = _denoised_1_stencil_3 - _denoised_1_stencil_2;
uint16_t _369 = _denoised_1_stencil_2 - _denoised_1_stencil_3;
bool _370 = _denoised_1_stencil_2 < _denoised_1_stencil_3;
uint16_t _371 = (uint16_t)(_370 ? _368 : _369);
uint16_t _372 = _371;
bool _373 = _367 < _372;
uint16_t _374 = (uint16_t)(_373 ? _358 : _362);
uint16_t _375 = _denoised_1_stencil_4 + _denoised_1_stencil_1;
uint16_t _376 = _375 + _356;
uint16_t _377 = _376 >> _356;
uint16_t _378 = _denoised_1_stencil_5 + _denoised_1_stencil_1;
uint16_t _379 = _378 + _356;
uint16_t _380 = _379 >> _356;
uint16_t _381 = _denoised_1_stencil_4 - _denoised_1_stencil_1;
uint16_t _382 = _denoised_1_stencil_1 - _denoised_1_stencil_4;
bool _383 = _denoised_1_stencil_1 < _denoised_1_stencil_4;
uint16_t _384 = (uint16_t)(_383 ? _381 : _382);
uint16_t _385 = _384;
uint16_t _386 = _denoised_1_stencil_5 - _denoised_1_stencil_1;
uint16_t _387 = _denoised_1_stencil_1 - _denoised_1_stencil_5;
bool _388 = _denoised_1_stencil_1 < _denoised_1_stencil_5;
uint16_t _389 = (uint16_t)(_388 ? _386 : _387);
uint16_t _390 = _389;
bool _391 = _385 < _390;
uint16_t _392 = (uint16_t)(_391 ? _377 : _380);
uint16_t _393 = _374 + _392;
uint16_t _394 = _393 + _356;
uint16_t _395 = _394 >> _356;
uint16_t _396 = _359 - _395;
int32_t _397 = _demosaicked_1_s0_x & 1;
bool _398 = _397 == 0;
uint16_t _399 = (uint16_t)(_398 ? _396 : _denoised_1_stencil_1);
uint16_t _400 = _denoised_1_stencil_1 + _denoised_1_stencil_6;
uint16_t _401 = _400 + _356;
uint16_t _402 = _401 >> _356;
uint16_t _403 = _denoised_1_stencil_1 + _denoised_1_stencil_7;
uint16_t _404 = _403 + _356;
uint16_t _405 = _404 >> _356;
bool _406 = _denoised_1_stencil_1 < _denoised_1_stencil_2;
uint16_t _407 = (uint16_t)(_406 ? _364 : _363);
uint16_t _408 = _407;
uint16_t _409 = _denoised_1_stencil_7 - _denoised_1_stencil_1;
uint16_t _410 = _denoised_1_stencil_1 - _denoised_1_stencil_7;
bool _411 = _denoised_1_stencil_1 < _denoised_1_stencil_7;
uint16_t _412 = (uint16_t)(_411 ? _409 : _410);
uint16_t _413 = _412;
bool _414 = _408 < _413;
uint16_t _415 = (uint16_t)(_414 ? _358 : _405);
uint16_t _416 = _402 + _415;
uint16_t _417 = _denoised_1_stencil_7 + _denoised_1_stencil_6;
uint16_t _418 = _417 + _356;
uint16_t _419 = _418 >> _356;
uint16_t _420 = _denoised_1_stencil_6 + _denoised_1_stencil_2;
uint16_t _421 = _420 + _356;
uint16_t _422 = _421 >> _356;
uint16_t _423 = _denoised_1_stencil_7 - _denoised_1_stencil_6;
uint16_t _424 = _denoised_1_stencil_6 - _denoised_1_stencil_7;
bool _425 = _denoised_1_stencil_6 < _denoised_1_stencil_7;
uint16_t _426 = (uint16_t)(_425 ? _423 : _424);
uint16_t _427 = _426;
uint16_t _428 = _denoised_1_stencil_2 - _denoised_1_stencil_6;
uint16_t _429 = _denoised_1_stencil_6 - _denoised_1_stencil_2;
bool _430 = _denoised_1_stencil_6 < _denoised_1_stencil_2;
uint16_t _431 = (uint16_t)(_430 ? _428 : _429);
uint16_t _432 = _431;
bool _433 = _427 < _432;
uint16_t _434 = (uint16_t)(_433 ? _419 : _422);
uint16_t _435 = _434 + _392;
uint16_t _436 = _435 + _356;
uint16_t _437 = _436 >> _356;
uint16_t _438 = _416 - _437;
uint16_t _439 = _denoised_1_stencil_2 + _denoised_1_stencil_7;
uint16_t _440 = _439 + _356;
uint16_t _441 = _440 >> _356;
uint16_t _442 = _441 + _415;
uint16_t _443 = _denoised_1_stencil_8 + _denoised_1_stencil_7;
uint16_t _444 = _443 + _356;
uint16_t _445 = _444 >> _356;
uint16_t _446 = _denoised_1_stencil_8 - _denoised_1_stencil_7;
uint16_t _447 = _denoised_1_stencil_7 - _denoised_1_stencil_8;
bool _448 = _denoised_1_stencil_7 < _denoised_1_stencil_8;
uint16_t _449 = (uint16_t)(_448 ? _446 : _447);
uint16_t _450 = _449;
bool _451 = _denoised_1_stencil_7 < _denoised_1_stencil_1;
uint16_t _452 = (uint16_t)(_451 ? _410 : _409);
uint16_t _453 = _452;
bool _454 = _450 < _453;
uint16_t _455 = (uint16_t)(_454 ? _445 : _405);
uint16_t _456 = _374 + _455;
uint16_t _457 = _456 + _356;
uint16_t _458 = _457 >> _356;
uint16_t _459 = _442 - _458;
uint16_t _460 = _denoised_1_stencil_1 - _denoised_1_stencil_6;
uint16_t _461 = _denoised_1_stencil_6 - _denoised_1_stencil_1;
bool _462 = _denoised_1_stencil_6 < _denoised_1_stencil_1;
uint16_t _463 = (uint16_t)(_462 ? _460 : _461);
uint16_t _464 = _463;
uint16_t _465 = _denoised_1_stencil_2 - _denoised_1_stencil_7;
uint16_t _466 = _denoised_1_stencil_7 - _denoised_1_stencil_2;
bool _467 = _denoised_1_stencil_7 < _denoised_1_stencil_2;
uint16_t _468 = (uint16_t)(_467 ? _465 : _466);
uint16_t _469 = _468;
bool _470 = _464 < _469;
uint16_t _471 = (uint16_t)(_470 ? _438 : _459);
uint16_t _472 = _denoised_1_stencil_1 + _405;
uint16_t _473 = _392 + _455;
uint16_t _474 = _473 + _356;
uint16_t _475 = _474 >> _356;
uint16_t _476 = _472 - _475;
uint16_t _477 = (uint16_t)(_398 ? _471 : _476);
int32_t _478 = _demosaicked_1_s0_y & 1;
bool _479 = _478 == 0;
uint16_t _480 = (uint16_t)(_479 ? _399 : _477);
return _480;
}
//store is: demosaicked$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1, 1) = select(((demosaicked_1_s0_y_1 % 2) == 0), select(((demosaicked_1_s0_x_1 % 2) == 0), denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1), select((absd(denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1), denoised$1.stencil((demosaicked_1_s0_x_1 + -1), demosaicked_1_s0_y_1)) < absd(denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1), denoised$1.stencil(demosaicked_1_s0_x_1, (demosaicked_1_s0_y_1 + 1)))), (((denoised$1.stencil((demosaicked_1_s0_x_1 + -1), demosaicked_1_s0_y_1) + denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_1, (demosaicked_1_s0_y_1 + 1)) + denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1)) + (uint16)1)/(uint16)2))), select(((demosaicked_1_s0_x_1 % 2) == 0), select((absd(denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1), denoised$1.stencil((demosaicked_1_s0_x_1 + 1), demosaicked_1_s0_y_1)) < absd(denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1), denoised$1.stencil(demosaicked_1_s0_x_1, (demosaicked_1_s0_y_1 + -1)))), (((denoised$1.stencil((demosaicked_1_s0_x_1 + 1), demosaicked_1_s0_y_1) + denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_1, (demosaicked_1_s0_y_1 + -1)) + denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1)) + (uint16)1)/(uint16)2)), denoised$1.stencil(demosaicked_1_s0_x_1, demosaicked_1_s0_y_1)))
hw_uint<16> hcompute_demosaicked_1_stencil_1(hw_uint<80>& denoised_1_stencil, const int _demosaicked_1_s0_x_1, const int _demosaicked_1_s0_y_1) {
uint16_t _denoised_1_stencil_10 = (uint16_t) denoised_1_stencil.extract<0, 15>();
uint16_t _denoised_1_stencil_11 = (uint16_t) denoised_1_stencil.extract<16, 31>();
uint16_t _denoised_1_stencil_12 = (uint16_t) denoised_1_stencil.extract<32, 47>();
uint16_t _denoised_1_stencil_13 = (uint16_t) denoised_1_stencil.extract<48, 63>();
uint16_t _denoised_1_stencil_9 = (uint16_t) denoised_1_stencil.extract<64, 79>();
uint16_t _702 = _denoised_1_stencil_10 + _denoised_1_stencil_9;
uint16_t _703 = (uint16_t)(1);
uint16_t _704 = _702 + _703;
uint16_t _705 = _704 >> _703;
uint16_t _706 = _denoised_1_stencil_11 + _denoised_1_stencil_9;
uint16_t _707 = _706 + _703;
uint16_t _708 = _707 >> _703;
uint16_t _709 = _denoised_1_stencil_10 - _denoised_1_stencil_9;
uint16_t _710 = _denoised_1_stencil_9 - _denoised_1_stencil_10;
bool _711 = _denoised_1_stencil_9 < _denoised_1_stencil_10;
uint16_t _712 = (uint16_t)(_711 ? _709 : _710);
uint16_t _713 = _712;
uint16_t _714 = _denoised_1_stencil_11 - _denoised_1_stencil_9;
uint16_t _715 = _denoised_1_stencil_9 - _denoised_1_stencil_11;
bool _716 = _denoised_1_stencil_9 < _denoised_1_stencil_11;
uint16_t _717 = (uint16_t)(_716 ? _714 : _715);
uint16_t _718 = _717;
bool _719 = _713 < _718;
uint16_t _720 = (uint16_t)(_719 ? _705 : _708);
int32_t _721 = _demosaicked_1_s0_x_1 & 1;
bool _722 = _721 == 0;
uint16_t _723 = (uint16_t)(_722 ? _denoised_1_stencil_9 : _720);
uint16_t _724 = _denoised_1_stencil_12 + _denoised_1_stencil_9;
uint16_t _725 = _724 + _703;
uint16_t _726 = _725 >> _703;
uint16_t _727 = _denoised_1_stencil_13 + _denoised_1_stencil_9;
uint16_t _728 = _727 + _703;
uint16_t _729 = _728 >> _703;
uint16_t _730 = _denoised_1_stencil_12 - _denoised_1_stencil_9;
uint16_t _731 = _denoised_1_stencil_9 - _denoised_1_stencil_12;
bool _732 = _denoised_1_stencil_9 < _denoised_1_stencil_12;
uint16_t _733 = (uint16_t)(_732 ? _730 : _731);
uint16_t _734 = _733;
uint16_t _735 = _denoised_1_stencil_13 - _denoised_1_stencil_9;
uint16_t _736 = _denoised_1_stencil_9 - _denoised_1_stencil_13;
bool _737 = _denoised_1_stencil_9 < _denoised_1_stencil_13;
uint16_t _738 = (uint16_t)(_737 ? _735 : _736);
uint16_t _739 = _738;
bool _740 = _734 < _739;
uint16_t _741 = (uint16_t)(_740 ? _726 : _729);
uint16_t _742 = (uint16_t)(_722 ? _741 : _denoised_1_stencil_9);
int32_t _743 = _demosaicked_1_s0_y_1 & 1;
bool _744 = _743 == 0;
uint16_t _745 = (uint16_t)(_744 ? _723 : _742);
return _745;
}
//store is: demosaicked$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2, 2) = select(((demosaicked_1_s0_y_2 % 2) == 0), select(((demosaicked_1_s0_x_2 % 2) == 0), ((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2)) - (((select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil((demosaicked_1_s0_x_2 + 1), (demosaicked_1_s0_y_2 + 1))) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2))), (((denoised$1.stencil((demosaicked_1_s0_x_2 + 1), (demosaicked_1_s0_y_2 + 1)) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + 1), demosaicked_1_s0_y_2)) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + -1)))), (((denoised$1.stencil((demosaicked_1_s0_x_2 + 1), demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + -1)) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2)), select((absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2))), (((((denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + 1)) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2) + select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)))), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2))) - (((select((absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) < absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2))), (((denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + 1)) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2), (((denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + 1)) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + 1), demosaicked_1_s0_y_2)) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + -1)))), (((denoised$1.stencil((demosaicked_1_s0_x_2 + 1), demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + -1)) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2)), (((((denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2) + select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)))), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2))) - (((select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil((demosaicked_1_s0_x_2 + 1), (demosaicked_1_s0_y_2 + 1))) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1)), denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2))), (((denoised$1.stencil((demosaicked_1_s0_x_2 + 1), (demosaicked_1_s0_y_2 + 1)) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + 1))) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) < absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + -1)))), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + -1)) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2)))), select(((demosaicked_1_s0_x_2 % 2) == 0), denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), ((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2)) - (((select((absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + 1), demosaicked_1_s0_y_2)) < absd(denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + -1)))), (((denoised$1.stencil((demosaicked_1_s0_x_2 + 1), demosaicked_1_s0_y_2) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil(demosaicked_1_s0_x_2, (demosaicked_1_s0_y_2 + -1)) + denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2)) + select((absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2), denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2)) < absd(denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2), denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + -1)))), (((denoised$1.stencil(demosaicked_1_s0_x_2, demosaicked_1_s0_y_2) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2), (((denoised$1.stencil((demosaicked_1_s0_x_2 + -1), (demosaicked_1_s0_y_2 + -1)) + denoised$1.stencil((demosaicked_1_s0_x_2 + -1), demosaicked_1_s0_y_2)) + (uint16)1)/(uint16)2))) + (uint16)1)/(uint16)2))))
hw_uint<16> hcompute_demosaicked_1_stencil_2(hw_uint<128>& denoised_1_stencil, const int _demosaicked_1_s0_x_2, const int _demosaicked_1_s0_y_2) {
uint16_t _denoised_1_stencil_14 = (uint16_t) denoised_1_stencil.extract<0, 15>();
uint16_t _denoised_1_stencil_15 = (uint16_t) denoised_1_stencil.extract<16, 31>();
uint16_t _denoised_1_stencil_16 = (uint16_t) denoised_1_stencil.extract<32, 47>();
uint16_t _denoised_1_stencil_17 = (uint16_t) denoised_1_stencil.extract<48, 63>();
uint16_t _denoised_1_stencil_18 = (uint16_t) denoised_1_stencil.extract<64, 79>();
uint16_t _denoised_1_stencil_19 = (uint16_t) denoised_1_stencil.extract<80, 95>();
uint16_t _denoised_1_stencil_20 = (uint16_t) denoised_1_stencil.extract<96, 111>();
uint16_t _denoised_1_stencil_21 = (uint16_t) denoised_1_stencil.extract<112, 127>();
uint16_t _828 = _denoised_1_stencil_14 + _denoised_1_stencil_15;
uint16_t _829 = (uint16_t)(1);
uint16_t _830 = _828 + _829;
uint16_t _831 = _830 >> _829;
uint16_t _832 = _denoised_1_stencil_14 + _831;
uint16_t _833 = _denoised_1_stencil_16 + _denoised_1_stencil_15;
uint16_t _834 = _833 + _829;
uint16_t _835 = _834 >> _829;
uint16_t _836 = _denoised_1_stencil_16 - _denoised_1_stencil_15;
uint16_t _837 = _denoised_1_stencil_15 - _denoised_1_stencil_16;
bool _838 = _denoised_1_stencil_15 < _denoised_1_stencil_16;
uint16_t _839 = (uint16_t)(_838 ? _836 : _837);
uint16_t _840 = _839;
uint16_t _841 = _denoised_1_stencil_14 - _denoised_1_stencil_15;
uint16_t _842 = _denoised_1_stencil_15 - _denoised_1_stencil_14;
bool _843 = _denoised_1_stencil_15 < _denoised_1_stencil_14;
uint16_t _844 = (uint16_t)(_843 ? _841 : _842);
uint16_t _845 = _844;
bool _846 = _840 < _845;
uint16_t _847 = (uint16_t)(_846 ? _835 : _831);
uint16_t _848 = _denoised_1_stencil_17 + _denoised_1_stencil_14;
uint16_t _849 = _848 + _829;
uint16_t _850 = _849 >> _829;
uint16_t _851 = _denoised_1_stencil_18 + _denoised_1_stencil_14;
uint16_t _852 = _851 + _829;
uint16_t _853 = _852 >> _829;
uint16_t _854 = _denoised_1_stencil_17 - _denoised_1_stencil_14;
uint16_t _855 = _denoised_1_stencil_14 - _denoised_1_stencil_17;
bool _856 = _denoised_1_stencil_14 < _denoised_1_stencil_17;
uint16_t _857 = (uint16_t)(_856 ? _854 : _855);
uint16_t _858 = _857;
uint16_t _859 = _denoised_1_stencil_18 - _denoised_1_stencil_14;
uint16_t _860 = _denoised_1_stencil_14 - _denoised_1_stencil_18;
bool _861 = _denoised_1_stencil_14 < _denoised_1_stencil_18;
uint16_t _862 = (uint16_t)(_861 ? _859 : _860);
uint16_t _863 = _862;
bool _864 = _858 < _863;
uint16_t _865 = (uint16_t)(_864 ? _850 : _853);
uint16_t _866 = _847 + _865;
uint16_t _867 = _866 + _829;
uint16_t _868 = _867 >> _829;
uint16_t _869 = _832 - _868;
uint16_t _870 = _denoised_1_stencil_19 + _denoised_1_stencil_14;
uint16_t _871 = _870 + _829;
uint16_t _872 = _871 >> _829;
uint16_t _873 = _denoised_1_stencil_14 + _denoised_1_stencil_20;
uint16_t _874 = _873 + _829;
uint16_t _875 = _874 >> _829;
uint16_t _876 = _denoised_1_stencil_20 - _denoised_1_stencil_14;
uint16_t _877 = _denoised_1_stencil_14 - _denoised_1_stencil_20;
bool _878 = _denoised_1_stencil_14 < _denoised_1_stencil_20;
uint16_t _879 = (uint16_t)(_878 ? _876 : _877);
uint16_t _880 = _879;
bool _881 = _denoised_1_stencil_14 < _denoised_1_stencil_15;
uint16_t _882 = (uint16_t)(_881 ? _842 : _841);
uint16_t _883 = _882;
bool _884 = _880 < _883;
uint16_t _885 = (uint16_t)(_884 ? _875 : _831);
uint16_t _886 = _872 + _885;
uint16_t _887 = _denoised_1_stencil_19 + _denoised_1_stencil_15;
uint16_t _888 = _887 + _829;
uint16_t _889 = _888 >> _829;
uint16_t _890 = _denoised_1_stencil_19 + _denoised_1_stencil_20;
uint16_t _891 = _890 + _829;
uint16_t _892 = _891 >> _829;
uint16_t _893 = _denoised_1_stencil_15 - _denoised_1_stencil_19;
uint16_t _894 = _denoised_1_stencil_19 - _denoised_1_stencil_15;
bool _895 = _denoised_1_stencil_19 < _denoised_1_stencil_15;
uint16_t _896 = (uint16_t)(_895 ? _893 : _894);
uint16_t _897 = _896;
uint16_t _898 = _denoised_1_stencil_20 - _denoised_1_stencil_19;
uint16_t _899 = _denoised_1_stencil_19 - _denoised_1_stencil_20;
bool _900 = _denoised_1_stencil_19 < _denoised_1_stencil_20;
uint16_t _901 = (uint16_t)(_900 ? _898 : _899);
uint16_t _902 = _901;
bool _903 = _897 < _902;
uint16_t _904 = (uint16_t)(_903 ? _889 : _892);
uint16_t _905 = _904 + _865;
uint16_t _906 = _905 + _829;
uint16_t _907 = _906 >> _829;
uint16_t _908 = _886 - _907;
uint16_t _909 = _denoised_1_stencil_15 + _denoised_1_stencil_20;
uint16_t _910 = _909 + _829;
uint16_t _911 = _910 >> _829;
uint16_t _912 = _911 + _885;
uint16_t _913 = _denoised_1_stencil_21 + _denoised_1_stencil_20;
uint16_t _914 = _913 + _829;
uint16_t _915 = _914 >> _829;
bool _916 = _denoised_1_stencil_20 < _denoised_1_stencil_14;
uint16_t _917 = (uint16_t)(_916 ? _877 : _876);
uint16_t _918 = _917;
uint16_t _919 = _denoised_1_stencil_21 - _denoised_1_stencil_20;
uint16_t _920 = _denoised_1_stencil_20 - _denoised_1_stencil_21;
bool _921 = _denoised_1_stencil_20 < _denoised_1_stencil_21;
uint16_t _922 = (uint16_t)(_921 ? _919 : _920);
uint16_t _923 = _922;
bool _924 = _918 < _923;
uint16_t _925 = (uint16_t)(_924 ? _875 : _915);
uint16_t _926 = _847 + _925;
uint16_t _927 = _926 + _829;
uint16_t _928 = _927 >> _829;
uint16_t _929 = _912 - _928;
uint16_t _930 = _denoised_1_stencil_14 - _denoised_1_stencil_19;
uint16_t _931 = _denoised_1_stencil_19 - _denoised_1_stencil_14;
bool _932 = _denoised_1_stencil_19 < _denoised_1_stencil_14;
uint16_t _933 = (uint16_t)(_932 ? _930 : _931);
uint16_t _934 = _933;
uint16_t _935 = _denoised_1_stencil_20 - _denoised_1_stencil_15;
uint16_t _936 = _denoised_1_stencil_15 - _denoised_1_stencil_20;
bool _937 = _denoised_1_stencil_15 < _denoised_1_stencil_20;
uint16_t _938 = (uint16_t)(_937 ? _935 : _936);
uint16_t _939 = _938;
bool _940 = _934 < _939;
uint16_t _941 = (uint16_t)(_940 ? _908 : _929);
int32_t _942 = _demosaicked_1_s0_x_2 & 1;
bool _943 = _942 == 0;
uint16_t _944 = (uint16_t)(_943 ? _869 : _941);
uint16_t _945 = _denoised_1_stencil_14 + _875;
uint16_t _946 = _865 + _925;
uint16_t _947 = _946 + _829;
uint16_t _948 = _947 >> _829;
uint16_t _949 = _945 - _948;
uint16_t _950 = (uint16_t)(_943 ? _denoised_1_stencil_14 : _949);
int32_t _951 = _demosaicked_1_s0_y_2 & 1;
bool _952 = _951 == 0;
uint16_t _953 = (uint16_t)(_952 ? _944 : _950);
return _953;
}
//store is: corrected.stencil(corrected_s0_x, corrected_s0_y, 0) = uint16((((((int16(demosaicked$1.stencil(corrected_s0_x, corrected_s0_y, 0))*(int16)200) + (int16(demosaicked$1.stencil(corrected_s0_x, corrected_s0_y, 2))*(int16)17)) - (int16(demosaicked$1.stencil(corrected_s0_x, corrected_s0_y, 1))*(int16)44)) + (int16)-3900)/(int16)256))
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>();
int16_t _1175 = (int16_t)(_demosaicked_1_stencil_1);
int16_t _1176 = (int16_t)(200);
int16_t _1177 = _1175 * _1176;
int16_t _1178 = (int16_t)(_demosaicked_1_stencil_2);
int16_t _1179 = (int16_t)(17);
int16_t _1180 = _1178 * _1179;
int16_t _1181 = _1177 + _1180;
int16_t _1182 = (int16_t)(_demosaicked_1_stencil_3);
int16_t _1183 = (int16_t)(44);
int16_t _1184 = _1182 * _1183;
int16_t _1185 = _1181 - _1184;
int16_t _1186 = (int16_t)(-3900);
int16_t _1187 = _1185 + _1186;
int16_t _1188 = (int16_t)(8);
int16_t _1189 = _1187 >> _1188;
uint16_t _1190 = (uint16_t)(_1189);
return _1190;
}
//store is: corrected.stencil(corrected_s0_x_1, corrected_s0_y_1, 1) = uint16((((((int16(demosaicked$1.stencil(corrected_s0_x_1, corrected_s0_y_1, 1))*(int16)159) - (int16(demosaicked$1.stencil(corrected_s0_x_1, corrected_s0_y_1, 0))*(int16)38)) - (int16(demosaicked$1.stencil(corrected_s0_x_1, corrected_s0_y_1, 2))*(int16)21)) + (int16)-2541)/(int16)256))
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>();
int16_t _1226 = (int16_t)(_demosaicked_1_stencil_4);
int16_t _1227 = (int16_t)(159);
int16_t _1228 = _1226 * _1227;
int16_t _1229 = (int16_t)(_demosaicked_1_stencil_5);
int16_t _1230 = (int16_t)(38);
int16_t _1231 = _1229 * _1230;
int16_t _1232 = _1228 - _1231;
int16_t _1233 = (int16_t)(_demosaicked_1_stencil_6);
int16_t _1234 = (int16_t)(21);
int16_t _1235 = _1233 * _1234;
int16_t _1236 = _1232 - _1235;
int16_t _1237 = (int16_t)(-2541);
int16_t _1238 = _1236 + _1237;
int16_t _1239 = (int16_t)(8);
int16_t _1240 = _1238 >> _1239;
uint16_t _1241 = (uint16_t)(_1240);
return _1241;
}
//store is: corrected.stencil(corrected_s0_x_2, corrected_s0_y_2, 2) = uint16((((((int16(demosaicked$1.stencil(corrected_s0_x_2, corrected_s0_y_2, 2))*(int16)228) - (int16(demosaicked$1.stencil(corrected_s0_x_2, corrected_s0_y_2, 1))*(int16)73)) - (int16(demosaicked$1.stencil(corrected_s0_x_2, corrected_s0_y_2, 0))*(int16)8)) + (int16)-2008)/(int16)256))
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>();
int16_t _1277 = (int16_t)(_demosaicked_1_stencil_7);
int16_t _1278 = (int16_t)(228);
int16_t _1279 = _1277 * _1278;
int16_t _1280 = (int16_t)(_demosaicked_1_stencil_8);
int16_t _1281 = (int16_t)(73);
int16_t _1282 = _1280 * _1281;
int16_t _1283 = _1279 - _1282;
int16_t _1284 = (int16_t)(_demosaicked_1_stencil_9);
int16_t _1285 = (int16_t)(8);
int16_t _1286 = _1284 * _1285;
int16_t _1287 = _1283 - _1286;
int16_t _1288 = (int16_t)(-2008);
int16_t _1289 = _1287 + _1288;
int16_t _1290 = _1289 >> _1285;
uint16_t _1291 = (uint16_t)(_1290);
return _1291;
}
//store is: curved.stencil(curved_s0_x, curved_s0_y, 0) = curvea0[int32(min(corrected.stencil(curved_s0_x, curved_s0_y, 0), (uint16)255))]
hw_uint<16> hcompute_curved_stencil(hw_uint<16>& corrected_stencil) {
uint16_t _corrected_stencil_1 = (uint16_t) corrected_stencil.extract<0, 15>();
uint16_t _curvea0[256];
// produce curvea0
uint16_t _1582 = (uint16_t)(0);
_curvea0[0] = _1582;
uint16_t _1583 = (uint16_t)(0);
_curvea0[1] = _1583;
uint16_t _1584 = (uint16_t)(0);
_curvea0[2] = _1584;
uint16_t _1585 = (uint16_t)(0);
_curvea0[3] = _1585;
uint16_t _1586 = (uint16_t)(0);
_curvea0[4] = _1586;
uint16_t _1587 = (uint16_t)(1);
_curvea0[5] = _1587;
uint16_t _1588 = (uint16_t)(1);
_curvea0[6] = _1588;
uint16_t _1589 = (uint16_t)(1);
_curvea0[7] = _1589;
uint16_t _1590 = (uint16_t)(1);
_curvea0[8] = _1590;
uint16_t _1591 = (uint16_t)(2);
_curvea0[9] = _1591;
uint16_t _1592 = (uint16_t)(2);
_curvea0[10] = _1592;
uint16_t _1593 = (uint16_t)(2);
_curvea0[11] = _1593;
uint16_t _1594 = (uint16_t)(2);
_curvea0[12] = _1594;
uint16_t _1595 = (uint16_t)(3);
_curvea0[13] = _1595;
uint16_t _1596 = (uint16_t)(3);
_curvea0[14] = _1596;
uint16_t _1597 = (uint16_t)(3);
_curvea0[15] = _1597;
uint16_t _1598 = (uint16_t)(3);
_curvea0[16] = _1598;
uint16_t _1599 = (uint16_t)(4);
_curvea0[17] = _1599;
uint16_t _1600 = (uint16_t)(4);
_curvea0[18] = _1600;
uint16_t _1601 = (uint16_t)(4);
_curvea0[19] = _1601;
uint16_t _1602 = (uint16_t)(4);
_curvea0[20] = _1602;
uint16_t _1603 = (uint16_t)(5);
_curvea0[21] = _1603;
uint16_t _1604 = (uint16_t)(5);
_curvea0[22] = _1604;
uint16_t _1605 = (uint16_t)(5);
_curvea0[23] = _1605;
uint16_t _1606 = (uint16_t)(5);
_curvea0[24] = _1606;
uint16_t _1607 = (uint16_t)(6);
_curvea0[25] = _1607;
uint16_t _1608 = (uint16_t)(6);
_curvea0[26] = _1608;
uint16_t _1609 = (uint16_t)(6);
_curvea0[27] = _1609;
uint16_t _1610 = (uint16_t)(6);
_curvea0[28] = _1610;
uint16_t _1611 = (uint16_t)(7);
_curvea0[29] = _1611;
uint16_t _1612 = (uint16_t)(7);
_curvea0[30] = _1612;
uint16_t _1613 = (uint16_t)(7);
_curvea0[31] = _1613;
uint16_t _1614 = (uint16_t)(7);
_curvea0[32] = _1614;
uint16_t _1615 = (uint16_t)(8);
_curvea0[33] = _1615;
uint16_t _1616 = (uint16_t)(8);
_curvea0[34] = _1616;
uint16_t _1617 = (uint16_t)(8);
_curvea0[35] = _1617;
uint16_t _1618 = (uint16_t)(8);
_curvea0[36] = _1618;
uint16_t _1619 = (uint16_t)(9);
_curvea0[37] = _1619;
uint16_t _1620 = (uint16_t)(9);
_curvea0[38] = _1620;
uint16_t _1621 = (uint16_t)(9);
_curvea0[39] = _1621;
uint16_t _1622 = (uint16_t)(9);
_curvea0[40] = _1622;
uint16_t _1623 = (uint16_t)(10);
_curvea0[41] = _1623;
uint16_t _1624 = (uint16_t)(10);
_curvea0[42] = _1624;
uint16_t _1625 = (uint16_t)(10);
_curvea0[43] = _1625;
uint16_t _1626 = (uint16_t)(10);
_curvea0[44] = _1626;
uint16_t _1627 = (uint16_t)(11);
_curvea0[45] = _1627;
uint16_t _1628 = (uint16_t)(11);
_curvea0[46] = _1628;
uint16_t _1629 = (uint16_t)(11);
_curvea0[47] = _1629;
uint16_t _1630 = (uint16_t)(11);
_curvea0[48] = _1630;
uint16_t _1631 = (uint16_t)(12);
_curvea0[49] = _1631;
uint16_t _1632 = (uint16_t)(12);
_curvea0[50] = _1632;
uint16_t _1633 = (uint16_t)(12);
_curvea0[51] = _1633;
uint16_t _1634 = (uint16_t)(12);
_curvea0[52] = _1634;
uint16_t _1635 = (uint16_t)(13);
_curvea0[53] = _1635;
uint16_t _1636 = (uint16_t)(13);
_curvea0[54] = _1636;
uint16_t _1637 = (uint16_t)(13);
_curvea0[55] = _1637;
uint16_t _1638 = (uint16_t)(13);
_curvea0[56] = _1638;
uint16_t _1639 = (uint16_t)(14);
_curvea0[57] = _1639;
uint16_t _1640 = (uint16_t)(14);
_curvea0[58] = _1640;
uint16_t _1641 = (uint16_t)(14);
_curvea0[59] = _1641;
uint16_t _1642 = (uint16_t)(14);
_curvea0[60] = _1642;
uint16_t _1643 = (uint16_t)(15);
_curvea0[61] = _1643;
uint16_t _1644 = (uint16_t)(15);
_curvea0[62] = _1644;
uint16_t _1645 = (uint16_t)(15);
_curvea0[63] = _1645;
uint16_t _1646 = (uint16_t)(15);
_curvea0[64] = _1646;
uint16_t _1647 = (uint16_t)(16);
_curvea0[65] = _1647;
uint16_t _1648 = (uint16_t)(16);
_curvea0[66] = _1648;
uint16_t _1649 = (uint16_t)(16);
_curvea0[67] = _1649;
uint16_t _1650 = (uint16_t)(16);
_curvea0[68] = _1650;
uint16_t _1651 = (uint16_t)(17);
_curvea0[69] = _1651;
uint16_t _1652 = (uint16_t)(17);
_curvea0[70] = _1652;
uint16_t _1653 = (uint16_t)(17);
_curvea0[71] = _1653;
uint16_t _1654 = (uint16_t)(17);
_curvea0[72] = _1654;
uint16_t _1655 = (uint16_t)(18);
_curvea0[73] = _1655;
uint16_t _1656 = (uint16_t)(18);
_curvea0[74] = _1656;
uint16_t _1657 = (uint16_t)(18);
_curvea0[75] = _1657;
uint16_t _1658 = (uint16_t)(18);
_curvea0[76] = _1658;
uint16_t _1659 = (uint16_t)(19);
_curvea0[77] = _1659;
uint16_t _1660 = (uint16_t)(19);
_curvea0[78] = _1660;
uint16_t _1661 = (uint16_t)(19);
_curvea0[79] = _1661;
uint16_t _1662 = (uint16_t)(19);
_curvea0[80] = _1662;
uint16_t _1663 = (uint16_t)(20);
_curvea0[81] = _1663;
uint16_t _1664 = (uint16_t)(20);
_curvea0[82] = _1664;
uint16_t _1665 = (uint16_t)(20);
_curvea0[83] = _1665;
uint16_t _1666 = (uint16_t)(20);
_curvea0[84] = _1666;
uint16_t _1667 = (uint16_t)(21);
_curvea0[85] = _1667;
uint16_t _1668 = (uint16_t)(21);
_curvea0[86] = _1668;
uint16_t _1669 = (uint16_t)(21);
_curvea0[87] = _1669;
uint16_t _1670 = (uint16_t)(21);
_curvea0[88] = _1670;
uint16_t _1671 = (uint16_t)(22);
_curvea0[89] = _1671;
uint16_t _1672 = (uint16_t)(22);
_curvea0[90] = _1672;
uint16_t _1673 = (uint16_t)(22);
_curvea0[91] = _1673;
uint16_t _1674 = (uint16_t)(22);
_curvea0[92] = _1674;
uint16_t _1675 = (uint16_t)(23);
_curvea0[93] = _1675;
uint16_t _1676 = (uint16_t)(23);
_curvea0[94] = _1676;
uint16_t _1677 = (uint16_t)(23);
_curvea0[95] = _1677;
uint16_t _1678 = (uint16_t)(23);
_curvea0[96] = _1678;
uint16_t _1679 = (uint16_t)(24);
_curvea0[97] = _1679;
uint16_t _1680 = (uint16_t)(24);
_curvea0[98] = _1680;
uint16_t _1681 = (uint16_t)(24);
_curvea0[99] = _1681;
uint16_t _1682 = (uint16_t)(24);
_curvea0[100] = _1682;
uint16_t _1683 = (uint16_t)(25);
_curvea0[101] = _1683;
uint16_t _1684 = (uint16_t)(25);
_curvea0[102] = _1684;
uint16_t _1685 = (uint16_t)(25);
_curvea0[103] = _1685;
uint16_t _1686 = (uint16_t)(25);
_curvea0[104] = _1686;
uint16_t _1687 = (uint16_t)(26);
_curvea0[105] = _1687;
uint16_t _1688 = (uint16_t)(26);
_curvea0[106] = _1688;
uint16_t _1689 = (uint16_t)(26);
_curvea0[107] = _1689;
uint16_t _1690 = (uint16_t)(26);
_curvea0[108] = _1690;
uint16_t _1691 = (uint16_t)(27);
_curvea0[109] = _1691;
uint16_t _1692 = (uint16_t)(27);
_curvea0[110] = _1692;
uint16_t _1693 = (uint16_t)(27);
_curvea0[111] = _1693;
uint16_t _1694 = (uint16_t)(27);
_curvea0[112] = _1694;
uint16_t _1695 = (uint16_t)(28);
_curvea0[113] = _1695;
uint16_t _1696 = (uint16_t)(28);
_curvea0[114] = _1696;
uint16_t _1697 = (uint16_t)(28);
_curvea0[115] = _1697;
uint16_t _1698 = (uint16_t)(28);
_curvea0[116] = _1698;
uint16_t _1699 = (uint16_t)(29);
_curvea0[117] = _1699;
uint16_t _1700 = (uint16_t)(29);
_curvea0[118] = _1700;
uint16_t _1701 = (uint16_t)(29);
_curvea0[119] = _1701;
uint16_t _1702 = (uint16_t)(29);
_curvea0[120] = _1702;
uint16_t _1703 = (uint16_t)(30);
_curvea0[121] = _1703;
uint16_t _1704 = (uint16_t)(30);
_curvea0[122] = _1704;
uint16_t _1705 = (uint16_t)(30);
_curvea0[123] = _1705;
uint16_t _1706 = (uint16_t)(30);
_curvea0[124] = _1706;
uint16_t _1707 = (uint16_t)(31);
_curvea0[125] = _1707;
uint16_t _1708 = (uint16_t)(31);
_curvea0[126] = _1708;
uint16_t _1709 = (uint16_t)(31);
_curvea0[127] = _1709;
uint16_t _1710 = (uint16_t)(31);
_curvea0[128] = _1710;
uint16_t _1711 = (uint16_t)(32);
_curvea0[129] = _1711;
uint16_t _1712 = (uint16_t)(32);
_curvea0[130] = _1712;
uint16_t _1713 = (uint16_t)(32);
_curvea0[131] = _1713;
uint16_t _1714 = (uint16_t)(32);
_curvea0[132] = _1714;
uint16_t _1715 = (uint16_t)(33);
_curvea0[133] = _1715;
uint16_t _1716 = (uint16_t)(33);
_curvea0[134] = _1716;
uint16_t _1717 = (uint16_t)(33);
_curvea0[135] = _1717;
uint16_t _1718 = (uint16_t)(33);
_curvea0[136] = _1718;
uint16_t _1719 = (uint16_t)(34);
_curvea0[137] = _1719;
uint16_t _1720 = (uint16_t)(34);
_curvea0[138] = _1720;
uint16_t _1721 = (uint16_t)(34);
_curvea0[139] = _1721;
uint16_t _1722 = (uint16_t)(34);
_curvea0[140] = _1722;
uint16_t _1723 = (uint16_t)(35);
_curvea0[141] = _1723;
uint16_t _1724 = (uint16_t)(35);
_curvea0[142] = _1724;
uint16_t _1725 = (uint16_t)(35);
_curvea0[143] = _1725;
uint16_t _1726 = (uint16_t)(35);
_curvea0[144] = _1726;
uint16_t _1727 = (uint16_t)(36);
_curvea0[145] = _1727;
uint16_t _1728 = (uint16_t)(36);
_curvea0[146] = _1728;
uint16_t _1729 = (uint16_t)(36);
_curvea0[147] = _1729;
uint16_t _1730 = (uint16_t)(36);
_curvea0[148] = _1730;
uint16_t _1731 = (uint16_t)(37);
_curvea0[149] = _1731;
uint16_t _1732 = (uint16_t)(37);
_curvea0[150] = _1732;
uint16_t _1733 = (uint16_t)(37);
_curvea0[151] = _1733;
uint16_t _1734 = (uint16_t)(37);
_curvea0[152] = _1734;
uint16_t _1735 = (uint16_t)(38);
_curvea0[153] = _1735;
uint16_t _1736 = (uint16_t)(38);
_curvea0[154] = _1736;
uint16_t _1737 = (uint16_t)(38);
_curvea0[155] = _1737;
uint16_t _1738 = (uint16_t)(38);
_curvea0[156] = _1738;
uint16_t _1739 = (uint16_t)(39);
_curvea0[157] = _1739;
uint16_t _1740 = (uint16_t)(39);
_curvea0[158] = _1740;
uint16_t _1741 = (uint16_t)(39);
_curvea0[159] = _1741;
uint16_t _1742 = (uint16_t)(39);
_curvea0[160] = _1742;
uint16_t _1743 = (uint16_t)(40);
_curvea0[161] = _1743;
uint16_t _1744 = (uint16_t)(40);
_curvea0[162] = _1744;
uint16_t _1745 = (uint16_t)(40);
_curvea0[163] = _1745;
uint16_t _1746 = (uint16_t)(40);
_curvea0[164] = _1746;
uint16_t _1747 = (uint16_t)(41);
_curvea0[165] = _1747;
uint16_t _1748 = (uint16_t)(41);
_curvea0[166] = _1748;
uint16_t _1749 = (uint16_t)(41);
_curvea0[167] = _1749;
uint16_t _1750 = (uint16_t)(41);
_curvea0[168] = _1750;
uint16_t _1751 = (uint16_t)(42);
_curvea0[169] = _1751;
uint16_t _1752 = (uint16_t)(42);
_curvea0[170] = _1752;
uint16_t _1753 = (uint16_t)(42);
_curvea0[171] = _1753;
uint16_t _1754 = (uint16_t)(42);
_curvea0[172] = _1754;
uint16_t _1755 = (uint16_t)(43);
_curvea0[173] = _1755;
uint16_t _1756 = (uint16_t)(43);
_curvea0[174] = _1756;
uint16_t _1757 = (uint16_t)(43);
_curvea0[175] = _1757;
uint16_t _1758 = (uint16_t)(43);
_curvea0[176] = _1758;
uint16_t _1759 = (uint16_t)(44);
_curvea0[177] = _1759;
uint16_t _1760 = (uint16_t)(44);
_curvea0[178] = _1760;
uint16_t _1761 = (uint16_t)(44);
_curvea0[179] = _1761;
uint16_t _1762 = (uint16_t)(44);
_curvea0[180] = _1762;
uint16_t _1763 = (uint16_t)(45);
_curvea0[181] = _1763;
uint16_t _1764 = (uint16_t)(45);
_curvea0[182] = _1764;
uint16_t _1765 = (uint16_t)(45);
_curvea0[183] = _1765;
uint16_t _1766 = (uint16_t)(45);
_curvea0[184] = _1766;
uint16_t _1767 = (uint16_t)(46);
_curvea0[185] = _1767;
uint16_t _1768 = (uint16_t)(46);
_curvea0[186] = _1768;
uint16_t _1769 = (uint16_t)(46);
_curvea0[187] = _1769;
uint16_t _1770 = (uint16_t)(46);
_curvea0[188] = _1770;
uint16_t _1771 = (uint16_t)(47);
_curvea0[189] = _1771;
uint16_t _1772 = (uint16_t)(47);
_curvea0[190] = _1772;
uint16_t _1773 = (uint16_t)(47);
_curvea0[191] = _1773;
uint16_t _1774 = (uint16_t)(47);
_curvea0[192] = _1774;
uint16_t _1775 = (uint16_t)(48);
_curvea0[193] = _1775;
uint16_t _1776 = (uint16_t)(48);
_curvea0[194] = _1776;
uint16_t _1777 = (uint16_t)(48);
_curvea0[195] = _1777;
uint16_t _1778 = (uint16_t)(48);
_curvea0[196] = _1778;
uint16_t _1779 = (uint16_t)(49);
_curvea0[197] = _1779;
uint16_t _1780 = (uint16_t)(49);
_curvea0[198] = _1780;
uint16_t _1781 = (uint16_t)(49);
_curvea0[199] = _1781;
uint16_t _1782 = (uint16_t)(49);
_curvea0[200] = _1782;
uint16_t _1783 = (uint16_t)(50);
_curvea0[201] = _1783;
uint16_t _1784 = (uint16_t)(50);
_curvea0[202] = _1784;
uint16_t _1785 = (uint16_t)(50);
_curvea0[203] = _1785;
uint16_t _1786 = (uint16_t)(50);
_curvea0[204] = _1786;
uint16_t _1787 = (uint16_t)(51);
_curvea0[205] = _1787;
uint16_t _1788 = (uint16_t)(51);
_curvea0[206] = _1788;
uint16_t _1789 = (uint16_t)(51);
_curvea0[207] = _1789;
uint16_t _1790 = (uint16_t)(51);
_curvea0[208] = _1790;
uint16_t _1791 = (uint16_t)(52);
_curvea0[209] = _1791;
uint16_t _1792 = (uint16_t)(52);
_curvea0[210] = _1792;
uint16_t _1793 = (uint16_t)(52);
_curvea0[211] = _1793;
uint16_t _1794 = (uint16_t)(52);
_curvea0[212] = _1794;
uint16_t _1795 = (uint16_t)(53);
_curvea0[213] = _1795;
uint16_t _1796 = (uint16_t)(53);
_curvea0[214] = _1796;
uint16_t _1797 = (uint16_t)(53);
_curvea0[215] = _1797;
uint16_t _1798 = (uint16_t)(53);
_curvea0[216] = _1798;
uint16_t _1799 = (uint16_t)(54);
_curvea0[217] = _1799;
uint16_t _1800 = (uint16_t)(54);
_curvea0[218] = _1800;
uint16_t _1801 = (uint16_t)(54);
_curvea0[219] = _1801;
uint16_t _1802 = (uint16_t)(54);
_curvea0[220] = _1802;
uint16_t _1803 = (uint16_t)(55);
_curvea0[221] = _1803;
uint16_t _1804 = (uint16_t)(55);
_curvea0[222] = _1804;
uint16_t _1805 = (uint16_t)(55);
_curvea0[223] = _1805;
uint16_t _1806 = (uint16_t)(55);
_curvea0[224] = _1806;
uint16_t _1807 = (uint16_t)(56);
_curvea0[225] = _1807;
uint16_t _1808 = (uint16_t)(56);
_curvea0[226] = _1808;
uint16_t _1809 = (uint16_t)(56);
_curvea0[227] = _1809;
uint16_t _1810 = (uint16_t)(56);
_curvea0[228] = _1810;
uint16_t _1811 = (uint16_t)(57);
_curvea0[229] = _1811;
uint16_t _1812 = (uint16_t)(57);
_curvea0[230] = _1812;
uint16_t _1813 = (uint16_t)(57);
_curvea0[231] = _1813;
uint16_t _1814 = (uint16_t)(57);
_curvea0[232] = _1814;
uint16_t _1815 = (uint16_t)(58);
_curvea0[233] = _1815;
uint16_t _1816 = (uint16_t)(58);
_curvea0[234] = _1816;
uint16_t _1817 = (uint16_t)(58);
_curvea0[235] = _1817;
uint16_t _1818 = (uint16_t)(58);
_curvea0[236] = _1818;
uint16_t _1819 = (uint16_t)(59);
_curvea0[237] = _1819;
uint16_t _1820 = (uint16_t)(59);
_curvea0[238] = _1820;
uint16_t _1821 = (uint16_t)(59);
_curvea0[239] = _1821;
uint16_t _1822 = (uint16_t)(59);
_curvea0[240] = _1822;
uint16_t _1823 = (uint16_t)(60);
_curvea0[241] = _1823;
uint16_t _1824 = (uint16_t)(60);
_curvea0[242] = _1824;
uint16_t _1825 = (uint16_t)(60);
_curvea0[243] = _1825;
uint16_t _1826 = (uint16_t)(60);
_curvea0[244] = _1826;
uint16_t _1827 = (uint16_t)(61);
_curvea0[245] = _1827;
uint16_t _1828 = (uint16_t)(61);
_curvea0[246] = _1828;
uint16_t _1829 = (uint16_t)(61);
_curvea0[247] = _1829;
uint16_t _1830 = (uint16_t)(61);
_curvea0[248] = _1830;
uint16_t _1831 = (uint16_t)(62);
_curvea0[249] = _1831;
uint16_t _1832 = (uint16_t)(62);
_curvea0[250] = _1832;
uint16_t _1833 = (uint16_t)(62);
_curvea0[251] = _1833;
uint16_t _1834 = (uint16_t)(62);
_curvea0[252] = _1834;
uint16_t _1835 = (uint16_t)(63);
_curvea0[253] = _1835;
uint16_t _1836 = (uint16_t)(63);
_curvea0[254] = _1836;
uint16_t _1837 = (uint16_t)(63);
_curvea0[255] = _1837;
uint16_t _1838 = (uint16_t)(255);
uint16_t _1839 = min(_corrected_stencil_1, _1838);
int32_t _1840 = (int32_t)(_1839);
uint16_t _1841 = ((const uint16_t *)_curvea0)[_1840];
return _1841;
}
//store is: curved.stencil(curved_s0_x_1, curved_s0_y_1, 1) = curvea0[int32(min(corrected.stencil(curved_s0_x_1, curved_s0_y_1, 1), (uint16)255))]
hw_uint<16> hcompute_curved_stencil_1(hw_uint<16>& corrected_stencil) {
uint16_t _corrected_stencil_2 = (uint16_t) corrected_stencil.extract<0, 15>();
uint16_t _curvea0[256];
// produce curvea0
uint16_t _1851 = (uint16_t)(0);
_curvea0[0] = _1851;
uint16_t _1852 = (uint16_t)(0);
_curvea0[1] = _1852;
uint16_t _1853 = (uint16_t)(0);
_curvea0[2] = _1853;
uint16_t _1854 = (uint16_t)(0);
_curvea0[3] = _1854;
uint16_t _1855 = (uint16_t)(0);
_curvea0[4] = _1855;
uint16_t _1856 = (uint16_t)(1);
_curvea0[5] = _1856;
uint16_t _1857 = (uint16_t)(1);
_curvea0[6] = _1857;
uint16_t _1858 = (uint16_t)(1);
_curvea0[7] = _1858;
uint16_t _1859 = (uint16_t)(1);
_curvea0[8] = _1859;
uint16_t _1860 = (uint16_t)(2);
_curvea0[9] = _1860;
uint16_t _1861 = (uint16_t)(2);
_curvea0[10] = _1861;
uint16_t _1862 = (uint16_t)(2);
_curvea0[11] = _1862;
uint16_t _1863 = (uint16_t)(2);
_curvea0[12] = _1863;
uint16_t _1864 = (uint16_t)(3);
_curvea0[13] = _1864;