File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727
2828#define CLIP8 (v ) ((v) <= 0 ? 0 : (v) < 256 ? (v) : 255)
2929
30+ #define CLIP16 (v ) ((v) <= 0 ? 0 : (v) < 65536 ? (v) : 65535)
31+
3032/* This is to work around a bug in GCC prior 4.9 in 64 bit mode.
3133 GCC generates code with partial dependency which is 3 times slower.
3234 See: https://stackoverflow.com/a/26588074/253146 */
Original file line number Diff line number Diff line change @@ -492,12 +492,7 @@ ImagingResampleHorizontal_16bpc(
492492 << 8 )) *
493493 k [x ];
494494 }
495- ss_int = ROUND_UP (ss );
496- if (ss_int < 0 ) {
497- ss_int = 0 ;
498- } else if (ss_int > 65535 ) {
499- ss_int = 65535 ;
500- }
495+ ss_int = CLIP16 (ROUND_UP (ss ));
501496 imOut -> image8 [yy ][xx * 2 + (bigendian ? 1 : 0 )] = ss_int & 0xFF ;
502497 imOut -> image8 [yy ][xx * 2 + (bigendian ? 0 : 1 )] = ss_int >> 8 ;
503498 }
@@ -536,12 +531,7 @@ ImagingResampleVertical_16bpc(
536531 (imIn -> image8 [y + ymin ][xx * 2 + (bigendian ? 0 : 1 )] << 8 )) *
537532 k [y ];
538533 }
539- ss_int = ROUND_UP (ss );
540- if (ss_int < 0 ) {
541- ss_int = 0 ;
542- } else if (ss_int > 65535 ) {
543- ss_int = 65535 ;
544- }
534+ ss_int = CLIP16 (ROUND_UP (ss ));
545535 imOut -> image8 [yy ][xx * 2 + (bigendian ? 1 : 0 )] = ss_int & 0xFF ;
546536 imOut -> image8 [yy ][xx * 2 + (bigendian ? 0 : 1 )] = ss_int >> 8 ;
547537 }
You can’t perform that action at this time.
0 commit comments