[FFmpeg-cvslog] swscale: add unscaled packed 16 bit per component endianess conversion
Janne Grunau
git at videolan.org
Sat Dec 17 02:23:01 CET 2011
ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Fri Dec 16 00:44:26 2011 +0100| [72cb904453ccb8c42f93a4a02ce9ba9915688722] | committer: Janne Grunau
swscale: add unscaled packed 16 bit per component endianess conversion
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72cb904453ccb8c42f93a4a02ce9ba9915688722
---
libswscale/swscale_unscaled.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 86bc5ac..ec8f1bb 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -252,6 +252,27 @@ static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, c
}
}
+static int packed_16bpc_bswap(SwsContext *c, const uint8_t* src[],
+ int srcStride[], int srcSliceY, int srcSliceH,
+ uint8_t* dst[], int dstStride[])
+{
+ int i, j;
+ int srcstr = srcStride[0] >> 1;
+ int dststr = dstStride[0] >> 1;
+ uint16_t *dstPtr = (uint16_t *)dst[0];
+ const uint16_t *srcPtr = (const uint16_t *)src[0];
+
+ for (i = 0; i < srcSliceH; i++) {
+ for (j = 0; j < srcstr; j++) {
+ dstPtr[j] = av_bswap16(srcPtr[j]);
+ }
+ srcPtr += srcstr;
+ dstPtr += dststr;
+ }
+
+ return srcSliceH;
+}
+
static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[])
{
@@ -697,6 +718,15 @@ void ff_get_unscaled_swscale(SwsContext *c)
if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
c->swScale= bgr24ToYv12Wrapper;
+ /* bswap 16 bits per component packed formats */
+ if ((srcFormat == PIX_FMT_RGB48LE && dstFormat == PIX_FMT_RGB48BE) ||
+ (srcFormat == PIX_FMT_RGB48BE && dstFormat == PIX_FMT_RGB48LE) ||
+ (srcFormat == PIX_FMT_BGR48LE && dstFormat == PIX_FMT_BGR48BE) ||
+ (srcFormat == PIX_FMT_BGR48BE && dstFormat == PIX_FMT_BGR48LE) ||
+ (srcFormat == PIX_FMT_GRAY16LE && dstFormat == PIX_FMT_GRAY16BE) ||
+ (srcFormat == PIX_FMT_GRAY16BE && dstFormat == PIX_FMT_GRAY16LE))
+ c->swScale = packed_16bpc_bswap;
+
/* RGB/BGR -> RGB/BGR (no dither needed forms) */
if ( isAnyRGB(srcFormat)
&& isAnyRGB(dstFormat)
More information about the ffmpeg-cvslog
mailing list