676 yfactor = URShift(yfract, 32-8);
677 BL_ACCUM(0);
678 BL_ACCUM(1);
679 BL_ACCUM(2);
680 BL_ACCUM(3);
681 pRes++;
682 pRGB += 4;
683 xfract += dxfract;
684 yfract += dyfract;
685 }
686 }
687
688 #define SAT(val, max) \
689 do { \
690 val &= ~(val >> 31); /* negatives become 0 */ \
691 val -= max; /* only overflows are now positive */ \
692 val &= (val >> 31); /* positives become 0 */ \
693 val += max; /* range is now [0 -> max] */ \
694 } while (0)
695
696 #ifdef __sparc
697 /* For sparc, floating point multiplies are faster than integer */
698 #define BICUBIC_USE_DBL_LUT
699 #else
700 /* For x86, integer multiplies are faster than floating point */
701 /* Note that on x86 Linux the choice of best algorithm varies
702 * depending on the compiler optimization and the processor type.
703 * Currently, the sun/awt x86 Linux builds are not optimized so
704 * all the variations produce mediocre performance.
705 * For now we will use the choice that works best for the Windows
706 * build until the (lack of) optimization issues on Linux are resolved.
707 */
708 #define BICUBIC_USE_INT_MATH
709 #endif
710
711 #ifdef BICUBIC_USE_DBL_CAST
712
713 #define BC_DblToCoeff(v) (v)
714 #define BC_COEFF_ONE 1.0
715 #define BC_TYPE jdouble
716 #define BC_V_HALF 0.5
717 #define BC_CompToV(v) ((jdouble) (v))
718 #define BC_STORE_COMPS(pRes) \
719 do { \
720 jint a = (jint) accumA; \
721 jint r = (jint) accumR; \
722 jint g = (jint) accumG; \
723 jint b = (jint) accumB; \
724 SAT(a, 255); \
725 SAT(r, a); \
726 SAT(g, a); \
727 SAT(b, a); \
728 *pRes = ((a << 24) | (r << 16) | (g << 8) | (b)); \
729 } while (0)
|
676 yfactor = URShift(yfract, 32-8);
677 BL_ACCUM(0);
678 BL_ACCUM(1);
679 BL_ACCUM(2);
680 BL_ACCUM(3);
681 pRes++;
682 pRGB += 4;
683 xfract += dxfract;
684 yfract += dyfract;
685 }
686 }
687
688 #define SAT(val, max) \
689 do { \
690 val &= ~(val >> 31); /* negatives become 0 */ \
691 val -= max; /* only overflows are now positive */ \
692 val &= (val >> 31); /* positives become 0 */ \
693 val += max; /* range is now [0 -> max] */ \
694 } while (0)
695
696 /* For x86, integer multiplies are faster than floating point */
697 /* Note that on x86 Linux the choice of best algorithm varies
698 * depending on the compiler optimization and the processor type.
699 * Currently, the sun/awt x86 Linux builds are not optimized so
700 * all the variations produce mediocre performance.
701 * For now we will use the choice that works best for the Windows
702 * build until the (lack of) optimization issues on Linux are resolved.
703 */
704 #define BICUBIC_USE_INT_MATH
705
706 #ifdef BICUBIC_USE_DBL_CAST
707
708 #define BC_DblToCoeff(v) (v)
709 #define BC_COEFF_ONE 1.0
710 #define BC_TYPE jdouble
711 #define BC_V_HALF 0.5
712 #define BC_CompToV(v) ((jdouble) (v))
713 #define BC_STORE_COMPS(pRes) \
714 do { \
715 jint a = (jint) accumA; \
716 jint r = (jint) accumR; \
717 jint g = (jint) accumG; \
718 jint b = (jint) accumB; \
719 SAT(a, 255); \
720 SAT(r, a); \
721 SAT(g, a); \
722 SAT(b, a); \
723 *pRes = ((a << 24) | (r << 16) | (g << 8) | (b)); \
724 } while (0)
|