aboutsummaryrefslogtreecommitdiffstats
path: root/postproc/yuv2rgb_mlib.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-02-21 20:35:18 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-02-21 20:35:18 +0000
commit5427e24291e6264b7c2104f9f4ce89236158b5df (patch)
treefc2b64e0be29d79403a423ba910d843618c67a75 /postproc/yuv2rgb_mlib.c
parent5d5fef0af19156972a8283baa8e7970df3199f46 (diff)
downloadffmpeg-5427e24291e6264b7c2104f9f4ce89236158b5df.tar.gz
yuv2rgb brightness/contrast/saturation/different colorspaces support finished
yuv2rgb deglobalize yuv2rgb optimizations / cleanup bugs? Originally committed as revision 9477 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
Diffstat (limited to 'postproc/yuv2rgb_mlib.c')
-rw-r--r--postproc/yuv2rgb_mlib.c94
1 files changed, 57 insertions, 37 deletions
diff --git a/postproc/yuv2rgb_mlib.c b/postproc/yuv2rgb_mlib.c
index a75cf4de9b..142aa1deb0 100644
--- a/postproc/yuv2rgb_mlib.c
+++ b/postproc/yuv2rgb_mlib.c
@@ -26,52 +26,72 @@
#include <mlib_status.h>
#include <mlib_sys.h>
#include <mlib_video.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <assert.h>
-static void mlib_YUV2ARGB420_32(uint8_t* image, uint8_t* py,
- uint8_t* pu, uint8_t* pv,
- unsigned h_size, unsigned v_size,
- int rgb_stride, int y_stride, int uv_stride)
-{
- mlib_VideoColorYUV2ARGB420(image, py, pu, pv, h_size,
- v_size, rgb_stride, y_stride, uv_stride);
-}
+#include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff
+#include "swscale.h"
-static void mlib_YUV2ABGR420_32(uint8_t* image, uint8_t* py,
- uint8_t* pu, uint8_t* pv,
- unsigned h_size, unsigned v_size,
- int rgb_stride, int y_stride, int uv_stride)
-{
- mlib_VideoColorYUV2ABGR420(image, py, pu, pv, h_size,
- v_size, rgb_stride, y_stride, uv_stride);
+static void mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
+ uint8_t *src[3];
+ int srcStride[3];
+
+ sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
+ }
+
+ assert(srcStride[1] == srcStride[2]);
+
+ mlib_VideoColorYUV2ARGB420(dst[0], src[0], src[1], src[2], c->dstW,
+ c->dstH, dstStride[0], srcStride[0], srcStride[1]);
}
-static void mlib_YUV2RGB420_24(uint8_t* image, uint8_t* py,
- uint8_t* pu, uint8_t* pv,
- unsigned h_size, unsigned v_size,
- int rgb_stride, int y_stride, int uv_stride)
-{
- mlib_VideoColorYUV2RGB420(image, py, pu, pv, h_size,
- v_size, rgb_stride, y_stride, uv_stride);
+static void mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
+ uint8_t *src[3];
+ int srcStride[3];
+
+ sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
+ }
+
+ assert(srcStride[1] == srcStride[2]);
+
+ mlib_VideoColorYUV2ABGR420(dst[0], src[0], src[1], src[2], c->dstW,
+ c->dstH, dstStride[0], srcStride[0], srcStride[1]);
}
+static void mlib_YUV2RGB420_24(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+ int srcSliceH, uint8_t* dst[], int dstStride[]){
+ uint8_t *src[3];
+ int srcStride[3];
-yuv2rgb_fun yuv2rgb_init_mlib(unsigned bpp, int mode)
-{
+ sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
+ if(c->srcFormat == IMGFMT_422P){
+ srcStride[1] *= 2;
+ srcStride[2] *= 2;
+ }
+
+ assert(srcStride[1] == srcStride[2]);
+
+ mlib_VideoColorYUV2RGB420(dst[0], src[0], src[1], src[2], c->dstW,
+ c->dstH, dstStride[0], srcStride[0], srcStride[1]);
+}
- if( bpp == 24 )
- {
- if( mode == MODE_RGB )
- return mlib_YUV2RGB420_24;
- }
- if( bpp == 32 )
- {
- if( mode == MODE_RGB )
- return mlib_YUV2ARGB420_32;
- else if( mode == MODE_BGR )
- return mlib_YUV2ABGR420_32;
+SwsFunc yuv2rgb_init_mlib(SwsContext *c)
+{
+ switch(c->dstFormat){
+ case IMGFMT_RGB24: return mlib_YUV2RGB420_24;
+ case IMGFMT_RGB32: return mlib_YUV2ARGB420_32;
+ case IMGFMT_BGR32: return mlib_YUV2ARGB420_32;
+ default: return NULL;
}
-
- return NULL;
}