21 #ifndef SWSCALE_SWSCALE_INTERNAL_H
22 #define SWSCALE_SWSCALE_INTERNAL_H
40 #define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
42 #define YUVRGB_TABLE_HEADROOM 256
44 #define MAX_FILTER_SIZE SWS_MAX_FILTER_SIZE
49 #define ALT32_CORR (-1)
64 #define RETCODE_USE_CASCADE -12345
79 int srcStride[],
int srcSliceY,
int srcSliceH,
80 uint8_t *dst[],
int dstStride[]);
130 const int16_t *chrFilter,
132 const int16_t **chrUSrc,
133 const int16_t **chrVSrc,
166 const int16_t *chrUSrc[2],
167 const int16_t *chrVSrc[2],
168 const int16_t *alpSrc,
uint8_t *dest,
169 int dstW,
int uvalpha,
int y);
199 const int16_t *chrUSrc[2],
200 const int16_t *chrVSrc[2],
201 const int16_t *alpSrc[2],
203 int dstW,
int yalpha,
int uvalpha,
int y);
231 const int16_t **lumSrc,
int lumFilterSize,
232 const int16_t *chrFilter,
233 const int16_t **chrUSrc,
234 const int16_t **chrVSrc,
int chrFilterSize,
235 const int16_t **alpSrc,
uint8_t *dest,
265 const int16_t **lumSrc,
int lumFilterSize,
266 const int16_t *chrFilter,
267 const int16_t **chrUSrc,
268 const int16_t **chrVSrc,
int chrFilterSize,
269 const int16_t **alpSrc,
uint8_t **dest,
395 #define RGB2YUV_SHIFT 15
420 #define RED_DITHER "0*8"
421 #define GREEN_DITHER "1*8"
422 #define BLUE_DITHER "2*8"
423 #define Y_COEFF "3*8"
424 #define VR_COEFF "4*8"
425 #define UB_COEFF "5*8"
426 #define VG_COEFF "6*8"
427 #define UG_COEFF "7*8"
428 #define Y_OFFSET "8*8"
429 #define U_OFFSET "9*8"
430 #define V_OFFSET "10*8"
431 #define LUM_MMX_FILTER_OFFSET "11*8"
432 #define CHR_MMX_FILTER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)
433 #define DSTW_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2"
434 #define ESP_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+8"
435 #define VROUNDER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+16"
436 #define U_TEMP "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+24"
437 #define V_TEMP "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+32"
438 #define Y_TEMP "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+40"
439 #define ALP_MMX_FILTER_OFFSET "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*2+48"
440 #define UV_OFF_PX "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+48"
441 #define UV_OFF_BYTE "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+56"
442 #define DITHER16 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+64"
443 #define DITHER32 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+80"
444 #define DITHER32_INT (11*8+4*4*MAX_FILTER_SIZE*3+80) // value equal to above, used for checking that the struct hasn't been changed by mistake
478 vector
signed short CY;
479 vector
signed short CRV;
480 vector
signed short CBU;
481 vector
signed short CGU;
482 vector
signed short CGV;
483 vector
signed short OY;
484 vector
unsigned short CSHIFT;
485 vector
signed short *vYCoeffsBank, *vCCoeffsBank;
491 #define XYZ_GAMMA (2.6f)
492 #define RGB_GAMMA (2.2f)
511 int width, uint32_t *pal);
514 int width, uint32_t *pal);
518 int width, uint32_t *pal);
551 int16_t *dst,
int dstWidth,
554 int16_t *dst1, int16_t *dst2,
int dstWidth,
592 const int32_t *filterPos,
int filterSize);
595 const int32_t *filterPos,
int filterSize);
638 #define isNBPS(x) is9_OR_10BPS(x)
670 (!(av_pix_fmt_desc_get(x)->flags & AV_PIX_FMT_FLAG_PAL) && \
671 av_pix_fmt_desc_get(x)->nb_components <= 2)
674 ((x) == AV_PIX_FMT_GRAY8 || \
675 (x) == AV_PIX_FMT_YA8 || \
676 (x) == AV_PIX_FMT_GRAY16BE || \
677 (x) == AV_PIX_FMT_GRAY16LE || \
678 (x) == AV_PIX_FMT_YA16BE || \
679 (x) == AV_PIX_FMT_YA16LE)
682 #define isRGBinInt(x) \
684 (x) == AV_PIX_FMT_RGB48BE || \
685 (x) == AV_PIX_FMT_RGB48LE || \
686 (x) == AV_PIX_FMT_RGB32 || \
687 (x) == AV_PIX_FMT_RGB32_1 || \
688 (x) == AV_PIX_FMT_RGB24 || \
689 (x) == AV_PIX_FMT_RGB565BE || \
690 (x) == AV_PIX_FMT_RGB565LE || \
691 (x) == AV_PIX_FMT_RGB555BE || \
692 (x) == AV_PIX_FMT_RGB555LE || \
693 (x) == AV_PIX_FMT_RGB444BE || \
694 (x) == AV_PIX_FMT_RGB444LE || \
695 (x) == AV_PIX_FMT_RGB8 || \
696 (x) == AV_PIX_FMT_RGB4 || \
697 (x) == AV_PIX_FMT_RGB4_BYTE || \
698 (x) == AV_PIX_FMT_RGBA64BE || \
699 (x) == AV_PIX_FMT_RGBA64LE || \
700 (x) == AV_PIX_FMT_MONOBLACK || \
701 (x) == AV_PIX_FMT_MONOWHITE \
703 #define isBGRinInt(x) \
705 (x) == AV_PIX_FMT_BGR48BE || \
706 (x) == AV_PIX_FMT_BGR48LE || \
707 (x) == AV_PIX_FMT_BGR32 || \
708 (x) == AV_PIX_FMT_BGR32_1 || \
709 (x) == AV_PIX_FMT_BGR24 || \
710 (x) == AV_PIX_FMT_BGR565BE || \
711 (x) == AV_PIX_FMT_BGR565LE || \
712 (x) == AV_PIX_FMT_BGR555BE || \
713 (x) == AV_PIX_FMT_BGR555LE || \
714 (x) == AV_PIX_FMT_BGR444BE || \
715 (x) == AV_PIX_FMT_BGR444LE || \
716 (x) == AV_PIX_FMT_BGR8 || \
717 (x) == AV_PIX_FMT_BGR4 || \
718 (x) == AV_PIX_FMT_BGR4_BYTE || \
719 (x) == AV_PIX_FMT_BGRA64BE || \
720 (x) == AV_PIX_FMT_BGRA64LE || \
721 (x) == AV_PIX_FMT_MONOBLACK || \
722 (x) == AV_PIX_FMT_MONOWHITE \
725 #define isRGBinBytes(x) ( \
726 (x) == AV_PIX_FMT_RGB48BE \
727 || (x) == AV_PIX_FMT_RGB48LE \
728 || (x) == AV_PIX_FMT_RGBA64BE \
729 || (x) == AV_PIX_FMT_RGBA64LE \
730 || (x) == AV_PIX_FMT_RGBA \
731 || (x) == AV_PIX_FMT_ARGB \
732 || (x) == AV_PIX_FMT_RGB24 \
734 #define isBGRinBytes(x) ( \
735 (x) == AV_PIX_FMT_BGR48BE \
736 || (x) == AV_PIX_FMT_BGR48LE \
737 || (x) == AV_PIX_FMT_BGRA64BE \
738 || (x) == AV_PIX_FMT_BGRA64LE \
739 || (x) == AV_PIX_FMT_BGRA \
740 || (x) == AV_PIX_FMT_ABGR \
741 || (x) == AV_PIX_FMT_BGR24 \
744 #define isBayer(x) ( \
745 (x)==AV_PIX_FMT_BAYER_BGGR8 \
746 || (x)==AV_PIX_FMT_BAYER_BGGR16LE \
747 || (x)==AV_PIX_FMT_BAYER_BGGR16BE \
748 || (x)==AV_PIX_FMT_BAYER_RGGB8 \
749 || (x)==AV_PIX_FMT_BAYER_RGGB16LE \
750 || (x)==AV_PIX_FMT_BAYER_RGGB16BE \
751 || (x)==AV_PIX_FMT_BAYER_GBRG8 \
752 || (x)==AV_PIX_FMT_BAYER_GBRG16LE \
753 || (x)==AV_PIX_FMT_BAYER_GBRG16BE \
754 || (x)==AV_PIX_FMT_BAYER_GRBG8 \
755 || (x)==AV_PIX_FMT_BAYER_GRBG16LE \
756 || (x)==AV_PIX_FMT_BAYER_GRBG16BE \
759 #define isAnyRGB(x) \
777 #define isPacked(x) ( \
778 (x)==AV_PIX_FMT_PAL8 \
779 || (x)==AV_PIX_FMT_YUYV422 \
780 || (x)==AV_PIX_FMT_YVYU422 \
781 || (x)==AV_PIX_FMT_UYVY422 \
782 || (x)==AV_PIX_FMT_YA8 \
783 || (x)==AV_PIX_FMT_YA16LE \
784 || (x)==AV_PIX_FMT_YA16BE \
871 int dstWidth,
const uint8_t *src1,
880 int dstWidth,
const uint8_t *src1,
884 int alpha,
int bits,
const int big_endian)
888 int v = alpha ? 0xFFFF>>(15-
bits) : (1<<bits);
889 for (i = 0; i <
height; i++) {
890 #define FILL(wfunc) \
891 for (j = 0; j < width; j++) {\