diff options
Diffstat (limited to 'libswscale/swscale_unscaled.c')
-rw-r--r-- | libswscale/swscale_unscaled.c | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 595edf8ae1..2351f96ed0 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -125,7 +125,7 @@ static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[], copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, dstParam[0], dstStride[0]); - if (c->dstFormat == PIX_FMT_NV12) + if (c->dstFormat == AV_PIX_FMT_NV12) interleaveBytes(src[1], src[2], dst, c->srcW / 2, srcSliceH / 2, srcStride[1], srcStride[2], dstStride[0]); else @@ -302,31 +302,31 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { - const enum PixelFormat srcFormat = c->srcFormat; - const enum PixelFormat dstFormat = c->dstFormat; + const enum AVPixelFormat srcFormat = c->srcFormat; + const enum AVPixelFormat dstFormat = c->dstFormat; void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette) = NULL; int i; uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; const uint8_t *srcPtr = src[0]; - if (srcFormat == PIX_FMT_Y400A) { + if (srcFormat == AV_PIX_FMT_Y400A) { switch (dstFormat) { - case PIX_FMT_RGB32 : conv = gray8aToPacked32; break; - case PIX_FMT_BGR32 : conv = gray8aToPacked32; break; - case PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break; - case PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break; - case PIX_FMT_RGB24 : conv = gray8aToPacked24; break; - case PIX_FMT_BGR24 : conv = gray8aToPacked24; break; + case AV_PIX_FMT_RGB32 : conv = gray8aToPacked32; break; + case AV_PIX_FMT_BGR32 : conv = gray8aToPacked32; break; + case AV_PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break; + case AV_PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break; + case AV_PIX_FMT_RGB24 : conv = gray8aToPacked24; break; + case AV_PIX_FMT_BGR24 : conv = gray8aToPacked24; break; } } else if (usePal(srcFormat)) { switch (dstFormat) { - case PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break; - case PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break; - case PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break; - case PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break; - case PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break; - case PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break; + case AV_PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break; + case AV_PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break; + case AV_PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break; + case AV_PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break; + case AV_PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break; + case AV_PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break; } } @@ -396,7 +396,7 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[], uint8_t *dst[], int dstStride[]) { int alpha_first = 0; - if (c->srcFormat != PIX_FMT_GBRP) { + if (c->srcFormat != AV_PIX_FMT_GBRP) { av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat)); @@ -404,32 +404,32 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[], } switch (c->dstFormat) { - case PIX_FMT_BGR24: + case AV_PIX_FMT_BGR24: gbr24ptopacked24((const uint8_t *[]) { src[1], src[0], src[2] }, (int []) { srcStride[1], srcStride[0], srcStride[2] }, dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); break; - case PIX_FMT_RGB24: + case AV_PIX_FMT_RGB24: gbr24ptopacked24((const uint8_t *[]) { src[2], src[0], src[1] }, (int []) { srcStride[2], srcStride[0], srcStride[1] }, dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); break; - case PIX_FMT_ARGB: + case AV_PIX_FMT_ARGB: alpha_first = 1; - case PIX_FMT_RGBA: + case AV_PIX_FMT_RGBA: gbr24ptopacked32((const uint8_t *[]) { src[2], src[0], src[1] }, (int []) { srcStride[2], srcStride[0], srcStride[1] }, dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); break; - case PIX_FMT_ABGR: + case AV_PIX_FMT_ABGR: alpha_first = 1; - case PIX_FMT_BGRA: + case AV_PIX_FMT_BGRA: gbr24ptopacked32((const uint8_t *[]) { src[1], src[0], src[2] }, (int []) { srcStride[1], srcStride[0], srcStride[2] }, dst[0] + srcSliceY * dstStride[0], dstStride[0], @@ -447,18 +447,18 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[], } #define isRGBA32(x) ( \ - (x) == PIX_FMT_ARGB \ - || (x) == PIX_FMT_RGBA \ - || (x) == PIX_FMT_BGRA \ - || (x) == PIX_FMT_ABGR \ + (x) == AV_PIX_FMT_ARGB \ + || (x) == AV_PIX_FMT_RGBA \ + || (x) == AV_PIX_FMT_BGRA \ + || (x) == AV_PIX_FMT_ABGR \ ) /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int); static rgbConvFn findRgbConvFn(SwsContext *c) { - const enum PixelFormat srcFormat = c->srcFormat; - const enum PixelFormat dstFormat = c->dstFormat; + const enum AVPixelFormat srcFormat = c->srcFormat; + const enum AVPixelFormat dstFormat = c->dstFormat; const int srcId = c->srcFormatBpp; const int dstId = c->dstFormatBpp; rgbConvFn conv = NULL; @@ -471,7 +471,7 @@ static rgbConvFn findRgbConvFn(SwsContext *c) if (IS_NOT_NE(srcId, srcFormat) || IS_NOT_NE(dstId, dstFormat)) return NULL; -#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst) +#define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) { if ( CONV_IS(ABGR, RGBA) @@ -536,8 +536,8 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int dstStride[]) { - const enum PixelFormat srcFormat = c->srcFormat; - const enum PixelFormat dstFormat = c->dstFormat; + const enum AVPixelFormat srcFormat = c->srcFormat; + const enum AVPixelFormat dstFormat = c->dstFormat; const int srcBpp = (c->srcFormatBpp + 7) >> 3; const int dstBpp = (c->dstFormatBpp + 7) >> 3; rgbConvFn conv = findRgbConvFn(c); @@ -548,11 +548,11 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], } else { const uint8_t *srcPtr = src[0]; uint8_t *dstPtr = dst[0]; - if ((srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) && + if ((srcFormat == AV_PIX_FMT_RGB32_1 || srcFormat == AV_PIX_FMT_BGR32_1) && !isRGBA32(dstFormat)) srcPtr += ALT32_CORR; - if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) && + if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && !isRGBA32(srcFormat)) dstPtr += ALT32_CORR; @@ -860,8 +860,8 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], void ff_get_unscaled_swscale(SwsContext *c) { - const enum PixelFormat srcFormat = c->srcFormat; - const enum PixelFormat dstFormat = c->dstFormat; + const enum AVPixelFormat srcFormat = c->srcFormat; + const enum AVPixelFormat dstFormat = c->dstFormat; const int flags = c->flags; const int dstH = c->dstH; int needsDither; @@ -871,26 +871,26 @@ void ff_get_unscaled_swscale(SwsContext *c) (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat))); /* yv12_to_nv12 */ - if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && - (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) { + if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && + (dstFormat == AV_PIX_FMT_NV12 || dstFormat == AV_PIX_FMT_NV21)) { c->swScale = planarToNv12Wrapper; } /* yuv2bgr */ - if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUV422P || - srcFormat == PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && + if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P || + srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && !(flags & SWS_ACCURATE_RND) && !(dstH & 1)) { c->swScale = ff_yuv2rgb_get_func_ptr(c); } - if (srcFormat == PIX_FMT_YUV410P && - (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P) && + if (srcFormat == AV_PIX_FMT_YUV410P && + (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) { c->swScale = yvu9ToYv12Wrapper; } /* bgr24toYV12 */ - if (srcFormat == PIX_FMT_BGR24 && - (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P) && + if (srcFormat == AV_PIX_FMT_BGR24 && + (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND)) c->swScale = bgr24ToYv12Wrapper; @@ -903,66 +903,66 @@ void ff_get_unscaled_swscale(SwsContext *c) c->swScale = planarRgbToRgbWrapper; /* bswap 16 bits per pixel/component packed formats */ - if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR444) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR48) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR555) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR565) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_GRAY16) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB444) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB48) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB555) || - IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB565)) + if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR444) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR48) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB48) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB555) || + IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB565)) c->swScale = packed_16bpc_bswap; if ((usePal(srcFormat) && ( - dstFormat == PIX_FMT_RGB32 || - dstFormat == PIX_FMT_RGB32_1 || - dstFormat == PIX_FMT_RGB24 || - dstFormat == PIX_FMT_BGR32 || - dstFormat == PIX_FMT_BGR32_1 || - dstFormat == PIX_FMT_BGR24))) + dstFormat == AV_PIX_FMT_RGB32 || + dstFormat == AV_PIX_FMT_RGB32_1 || + dstFormat == AV_PIX_FMT_RGB24 || + dstFormat == AV_PIX_FMT_BGR32 || + dstFormat == AV_PIX_FMT_BGR32_1 || + dstFormat == AV_PIX_FMT_BGR24))) c->swScale = palToRgbWrapper; - if (srcFormat == PIX_FMT_YUV422P) { - if (dstFormat == PIX_FMT_YUYV422) + if (srcFormat == AV_PIX_FMT_YUV422P) { + if (dstFormat == AV_PIX_FMT_YUYV422) c->swScale = yuv422pToYuy2Wrapper; - else if (dstFormat == PIX_FMT_UYVY422) + else if (dstFormat == AV_PIX_FMT_UYVY422) c->swScale = yuv422pToUyvyWrapper; } /* LQ converters if -sws 0 or -sws 4*/ if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) { /* yv12_to_yuy2 */ - if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) { - if (dstFormat == PIX_FMT_YUYV422) + if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) { + if (dstFormat == AV_PIX_FMT_YUYV422) c->swScale = planarToYuy2Wrapper; - else if (dstFormat == PIX_FMT_UYVY422) + else if (dstFormat == AV_PIX_FMT_UYVY422) c->swScale = planarToUyvyWrapper; } } - if (srcFormat == PIX_FMT_YUYV422 && - (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P)) + if (srcFormat == AV_PIX_FMT_YUYV422 && + (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) c->swScale = yuyvToYuv420Wrapper; - if (srcFormat == PIX_FMT_UYVY422 && - (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P)) + if (srcFormat == AV_PIX_FMT_UYVY422 && + (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) c->swScale = uyvyToYuv420Wrapper; - if (srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P) + if (srcFormat == AV_PIX_FMT_YUYV422 && dstFormat == AV_PIX_FMT_YUV422P) c->swScale = yuyvToYuv422Wrapper; - if (srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P) + if (srcFormat == AV_PIX_FMT_UYVY422 && dstFormat == AV_PIX_FMT_YUV422P) c->swScale = uyvyToYuv422Wrapper; /* simple copy */ if ( srcFormat == dstFormat || - (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P) || - (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P) || + (srcFormat == AV_PIX_FMT_YUVA420P && dstFormat == AV_PIX_FMT_YUV420P) || + (srcFormat == AV_PIX_FMT_YUV420P && dstFormat == AV_PIX_FMT_YUVA420P) || (isPlanarYUV(srcFormat) && isGray(dstFormat)) || (isPlanarYUV(dstFormat) && isGray(srcFormat)) || (isGray(dstFormat) && isGray(srcFormat)) || (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) && c->chrDstHSubSample == c->chrSrcHSubSample && c->chrDstVSubSample == c->chrSrcVSubSample && - dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 && - srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21)) + dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && + srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21)) { if (isPacked(c->srcFormat)) c->swScale = packedCopyWrapper; @@ -988,7 +988,7 @@ static void reset_ptr(const uint8_t *src[], int format) } } -static int check_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, +static int check_image_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, const int linesizes[4]) { const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; @@ -1041,28 +1041,28 @@ int attribute_align_arg sws_scale(struct SwsContext *c, if (usePal(c->srcFormat)) { for (i = 0; i < 256; i++) { int p, r, g, b, y, u, v; - if (c->srcFormat == PIX_FMT_PAL8) { + if (c->srcFormat == AV_PIX_FMT_PAL8) { p = ((const uint32_t *)(srcSlice[1]))[i]; r = (p >> 16) & 0xFF; g = (p >> 8) & 0xFF; b = p & 0xFF; - } else if (c->srcFormat == PIX_FMT_RGB8) { + } else if (c->srcFormat == AV_PIX_FMT_RGB8) { r = ( i >> 5 ) * 36; g = ((i >> 2) & 7) * 36; b = ( i & 3) * 85; - } else if (c->srcFormat == PIX_FMT_BGR8) { + } else if (c->srcFormat == AV_PIX_FMT_BGR8) { b = ( i >> 6 ) * 85; g = ((i >> 3) & 7) * 36; r = ( i & 7) * 36; - } else if (c->srcFormat == PIX_FMT_RGB4_BYTE) { + } else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) { r = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; b = ( i & 1) * 255; - } else if (c->srcFormat == PIX_FMT_GRAY8 || - c->srcFormat == PIX_FMT_Y400A) { + } else if (c->srcFormat == AV_PIX_FMT_GRAY8 || + c->srcFormat == AV_PIX_FMT_Y400A) { r = g = b = i; } else { - assert(c->srcFormat == PIX_FMT_BGR4_BYTE); + assert(c->srcFormat == AV_PIX_FMT_BGR4_BYTE); b = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; r = ( i & 1) * 255; @@ -1073,27 +1073,27 @@ int attribute_align_arg sws_scale(struct SwsContext *c, c->pal_yuv[i] = y + (u << 8) + (v << 16); switch (c->dstFormat) { - case PIX_FMT_BGR32: + case AV_PIX_FMT_BGR32: #if !HAVE_BIGENDIAN - case PIX_FMT_RGB24: + case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i] = r + (g << 8) + (b << 16); break; - case PIX_FMT_BGR32_1: + case AV_PIX_FMT_BGR32_1: #if HAVE_BIGENDIAN - case PIX_FMT_BGR24: + case AV_PIX_FMT_BGR24: #endif c->pal_rgb[i] = (r + (g << 8) + (b << 16)) << 8; break; - case PIX_FMT_RGB32_1: + case AV_PIX_FMT_RGB32_1: #if HAVE_BIGENDIAN - case PIX_FMT_RGB24: + case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i] = (b + (g << 8) + (r << 16)) << 8; break; - case PIX_FMT_RGB32: + case AV_PIX_FMT_RGB32: #if !HAVE_BIGENDIAN - case PIX_FMT_BGR24: + case AV_PIX_FMT_BGR24: #endif default: c->pal_rgb[i] = b + (g << 8) + (r << 16); |