00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <mlib_types.h>
00024 #include <mlib_status.h>
00025 #include <mlib_sys.h>
00026 #include <mlib_video.h>
00027 #include <inttypes.h>
00028 #include <stdlib.h>
00029 #include <assert.h>
00030
00031 #include "libswscale/swscale.h"
00032 #include "libswscale/swscale_internal.h"
00033
00034 static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00035 int srcSliceH, uint8_t* dst[], int dstStride[])
00036 {
00037 if(c->srcFormat == PIX_FMT_YUV422P) {
00038 srcStride[1] *= 2;
00039 srcStride[2] *= 2;
00040 }
00041
00042 assert(srcStride[1] == srcStride[2]);
00043
00044 mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
00045 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
00046 return srcSliceH;
00047 }
00048
00049 static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00050 int srcSliceH, uint8_t* dst[], int dstStride[])
00051 {
00052 if(c->srcFormat == PIX_FMT_YUV422P) {
00053 srcStride[1] *= 2;
00054 srcStride[2] *= 2;
00055 }
00056
00057 assert(srcStride[1] == srcStride[2]);
00058
00059 mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
00060 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
00061 return srcSliceH;
00062 }
00063
00064 static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
00065 int srcSliceH, uint8_t* dst[], int dstStride[])
00066 {
00067 if(c->srcFormat == PIX_FMT_YUV422P) {
00068 srcStride[1] *= 2;
00069 srcStride[2] *= 2;
00070 }
00071
00072 assert(srcStride[1] == srcStride[2]);
00073
00074 mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
00075 srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
00076 return srcSliceH;
00077 }
00078
00079
00080 SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c)
00081 {
00082 switch(c->dstFormat) {
00083 case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
00084 case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
00085 case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
00086 default: return NULL;
00087 }
00088 }
00089