Commit 5427e242 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

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
parent 5d5fef0a
......@@ -84,13 +84,15 @@ extern void yvu9_to_yuy2(const uint8_t *src1, const uint8_t *src2, const uint8_t
#define MODE_RGB 0x1
#define MODE_BGR 0x2
typedef void (* yuv2rgb_fun) (uint8_t * image, uint8_t * py,
static void yuv2rgb(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);
int rgb_stride, int y_stride, int uv_stride){
printf("broken, this should use the swscaler\n");
}
extern yuv2rgb_fun yuv2rgb;
void yuv2rgb_init (unsigned bpp, int mode);
static void yuv2rgb_init (unsigned bpp, int mode){
printf("broken, this should use the swscaler\n");
}
#endif
/*
Copyright (C) 2001-2002 Michael Niedermayer <michaelni@gmx.at>
Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -62,6 +62,7 @@ untested special converters
#include <stdlib.h>
#endif
#include "swscale.h"
#include "swscale_internal.h"
#include "../cpudetect.h"
#include "../bswap.h"
#include "../libvo/img_format.h"
......@@ -147,7 +148,6 @@ add support for Y8 output
optimize bgr24 & bgr32
add BGR4 output support
write special BGR->BGR scaler
deglobalize yuv2rgb*.c
*/
#define ABS(a) ((a) > 0 ? (a) : (-(a)))
......@@ -230,8 +230,6 @@ void (*swScale)(SwsContext *context, uint8_t* src[], int srcStride[], int srcSli
int srcSliceH, uint8_t* dst[], int dstStride[])=NULL;
static SwsVector *getConvVec(SwsVector *a, SwsVector *b);
static inline void orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]);
void *yuv2rgb_c_init (unsigned bpp, int mode, void *table_rV[256], void *table_gU[256], int table_gV[256], void *table_bU[256]);
extern const uint8_t dither_2x2_4[2][8];
extern const uint8_t dither_2x2_8[2][8];
......@@ -1634,18 +1632,6 @@ static void PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[],
interleaveBytes( src[2],src[1],dst,c->srcW,srcSliceH,srcStride[2],srcStride[1],dstStride[0] );
}
/* Warper functions for yuv2bgr */
static void planarYuvToBgr(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[]){
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
if(c->srcFormat==IMGFMT_YV12)
yuv2rgb( dst,src[0],src[1],src[2],c->srcW,srcSliceH,dstStride[0],srcStride[0],srcStride[1] );
else /* I420 & IYUV */
yuv2rgb( dst,src[0],src[2],src[1],c->srcW,srcSliceH,dstStride[0],srcStride[0],srcStride[1] );
}
static void PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStride[]){
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
......@@ -1773,7 +1759,7 @@ static void yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in
/**
* bring pointers in YUV order instead of YVU
*/
static inline void orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
if(format == IMGFMT_YV12 || format == IMGFMT_YVU9
|| format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){
sortedP[0]= p[0];
......@@ -1814,8 +1800,8 @@ static void simpleCopy(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[],
uint8_t *src[3];
uint8_t *dst[3];
orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
if(isPacked(c->srcFormat))
{
......@@ -1923,41 +1909,51 @@ static void getSubSampleFactors(int *h, int *v, int format){
}
}
static uint16_t roundToInt16(float f){
if(f<-0x7FFF) f= -0x7FFF;
else if(f> 0x7FFF) f= 0x7FFF;
return (int)floor(f + 0.5);
static uint16_t roundToInt16(int64_t f){
int r= (f + (1<<15))>>16;
if(r<-0x7FFF) return 0x8000;
else if(r> 0x7FFF) return 0x7FFF;
else return r;
}
/**
* @param colorspace colorspace
* @param inv_table the yuv2rgb coeffs, normally Inverse_Table_6_9[x]
* @param fullRange if 1 then the luma range is 0..255 if 0 its 16..235
* @return -1 if not supported
*/
void setInputColorspaceDetails(SwsContext *c, int colorspace, int fullRange, float brightness, float contrast, float saturation){
float crv = Inverse_Table_6_9[colorspace][0]/65536.0;
float cbu = Inverse_Table_6_9[colorspace][1]/65536.0;
float cgu = -Inverse_Table_6_9[colorspace][2]/65536.0;
float cgv = -Inverse_Table_6_9[colorspace][3]/65536.0;
float cy = 1.0;
float oy = 0;
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation){
int64_t crv = inv_table[0];
int64_t cbu = inv_table[1];
int64_t cgu = -inv_table[2];
int64_t cgv = -inv_table[3];
int64_t cy = 1<<16;
int64_t oy = 0;
if(isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4);
memcpy(c->dstColorspaceTable, table, sizeof(int)*4);
c->brightness= brightness;
c->contrast = contrast;
c->saturation= saturation;
c->srcRange = srcRange;
c->dstRange = dstRange;
c->uOffset= 0x0400040004000400LL;
c->vOffset= 0x0400040004000400LL;
if(!fullRange){
cy= (cy*255.0) / 219.0;
oy= 16.0;
if(!srcRange){
cy= (cy*255) / 219;
oy= 16<<16;
}
cy *= contrast;
crv*= contrast * saturation;
cbu*= contrast * saturation;
cgu*= contrast * saturation;
cgv*= contrast * saturation;
cy = (cy *contrast )>>16;
crv= (crv*contrast * saturation)>>32;
cbu= (cbu*contrast * saturation)>>32;
cgu= (cgu*contrast * saturation)>>32;
cgv= (cgv*contrast * saturation)>>32;
oy -= 256.0*brightness;
oy -= 256*brightness;
c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL;
c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL;
......@@ -1965,6 +1961,28 @@ void setInputColorspaceDetails(SwsContext *c, int colorspace, int fullRange, flo
c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL;
c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL;
c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL;
yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
//FIXME factorize
return 0;
}
/**
* @return -1 if not supported
*/
int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation){
if(isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
*inv_table = c->srcColorspaceTable;
*table = c->dstColorspaceTable;
*srcRange = c->srcRange;
*dstRange = c->dstRange;
*brightness= c->brightness;
*contrast = c->contrast;
*saturation= c->saturation;
return 0;
}
SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
......@@ -2026,8 +2044,6 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
c->dstFormat= dstFormat;
c->srcFormat= srcFormat;
setInputColorspaceDetails(c, SWS_CS_DEFAULT, 0, 0.0, 1.0, 1.0);
usesFilter=0;
if(dstFilter->lumV!=NULL && dstFilter->lumV->length>1) usesFilter=1;
if(dstFilter->lumH!=NULL && dstFilter->lumH->length>1) usesFilter=1;
......@@ -2054,17 +2070,14 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
c->chrIntHSubSample= c->chrDstHSubSample;
c->chrIntVSubSample= c->chrSrcVSubSample;
// note the -((-x)>>y) is so that we allways round toward +inf
c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
if(isBGR(dstFormat))
c->yuvTable= yuv2rgb_c_init(dstFormat & 0xFF, MODE_RGB, c->table_rV, c->table_gU, c->table_gV, c->table_bU);
if(isRGB(dstFormat))
c->yuvTable= yuv2rgb_c_init(dstFormat & 0xFF, MODE_BGR, c->table_rV, c->table_gU, c->table_gV, c->table_bU);
sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], 0, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, 0, 0, 1<<16, 1<<16);
/* unscaled special Cases */
if(unscaled && !usesFilter)
......@@ -2075,19 +2088,9 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
c->swScale= PlanarToNV12Wrapper;
}
/* yuv2bgr */
if((srcFormat==IMGFMT_YV12 || srcFormat==IMGFMT_I420) && isBGR(dstFormat))
if((srcFormat==IMGFMT_YV12 || srcFormat==IMGFMT_I420 || srcFormat==IMGFMT_422P) && (isBGR(dstFormat) || isRGB(dstFormat)))
{
// FIXME multiple yuv2rgb converters wont work that way cuz that thing is full of globals&statics
//FIXME rgb vs. bgr ?
#ifdef WORDS_BIGENDIAN
if(dstFormat==IMGFMT_BGR32)
yuv2rgb_init( dstFormat&0xFF /* =bpp */, MODE_BGR);
else
yuv2rgb_init( dstFormat&0xFF /* =bpp */, MODE_RGB);
#else
yuv2rgb_init( dstFormat&0xFF /* =bpp */, MODE_RGB);
#endif
c->swScale= planarYuvToBgr;
c->swScale= yuv2rgb_get_func_ptr(c);
}
if( srcFormat==IMGFMT_YVU9 && (dstFormat==IMGFMT_YV12 || dstFormat==IMGFMT_I420) )
......
/*
Copyright (C) 2001-2002 Michael Niedermayer <michaelni@gmx.at>
Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -16,6 +16,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SWSCALE_H
#define SWSCALE_H
#include "swscale_internal.h" //FIXME HACK REMOVE
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
......@@ -44,8 +49,6 @@
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define MAX_FILTER_SIZE 256
#define SWS_MAX_REDUCE_CUTOFF 0.002
#define SWS_CS_ITU709 1
......@@ -56,97 +59,6 @@
#define SWS_CS_SMPTE240M 7
#define SWS_CS_DEFAULT 5
/* this struct should be aligned on at least 32-byte boundary */
typedef struct SwsContext{
int srcW, srcH, dstH;
int chrSrcW, chrSrcH, chrDstW, chrDstH;
int lumXInc, chrXInc;
int lumYInc, chrYInc;
int dstFormat, srcFormat;
int chrSrcHSubSample, chrSrcVSubSample;
int chrIntHSubSample, chrIntVSubSample;
int chrDstHSubSample, chrDstVSubSample;
int vChrDrop;
int16_t **lumPixBuf;
int16_t **chrPixBuf;
int16_t *hLumFilter;
int16_t *hLumFilterPos;
int16_t *hChrFilter;
int16_t *hChrFilterPos;
int16_t *vLumFilter;
int16_t *vLumFilterPos;
int16_t *vChrFilter;
int16_t *vChrFilterPos;
uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
int hLumFilterSize;
int hChrFilterSize;
int vLumFilterSize;
int vChrFilterSize;
int vLumBufSize;
int vChrBufSize;
uint8_t __attribute__((aligned(32))) funnyYCode[10000];
uint8_t __attribute__((aligned(32))) funnyUVCode[10000];
int32_t *lumMmx2FilterPos;
int32_t *chrMmx2FilterPos;
int16_t *lumMmx2Filter;
int16_t *chrMmx2Filter;
int canMMX2BeUsed;
int lastInLumBuf;
int lastInChrBuf;
int lumBufIndex;
int chrBufIndex;
int dstY;
int flags;
void * yuvTable;
void * table_rV[256];
void * table_gU[256];
int table_gV[256];
void * table_bU[256];
void (*swScale)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]);
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
#define BLUE_DITHER "2*8"
#define Y_COEFF "3*8"
#define VR_COEFF "4*8"
#define UB_COEFF "5*8"
#define VG_COEFF "6*8"
#define UG_COEFF "7*8"
#define Y_OFFSET "8*8"
#define U_OFFSET "9*8"
#define V_OFFSET "10*8"
#define LUM_MMX_FILTER_OFFSET "11*8"
#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
#define DSTW_OFFSET "11*8+4*4*256*2"
#define ESP_OFFSET "11*8+4*4*256*2+4"
uint64_t redDither __attribute__((aligned(8)));
uint64_t greenDither __attribute__((aligned(8)));
uint64_t blueDither __attribute__((aligned(8)));
uint64_t yCoeff __attribute__((aligned(8)));
uint64_t vrCoeff __attribute__((aligned(8)));
uint64_t ubCoeff __attribute__((aligned(8)));
uint64_t vgCoeff __attribute__((aligned(8)));
uint64_t ugCoeff __attribute__((aligned(8)));
uint64_t yOffset __attribute__((aligned(8)));
uint64_t uOffset __attribute__((aligned(8)));
uint64_t vOffset __attribute__((aligned(8)));
int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
int dstW;
int esp;
} SwsContext;
//FIXME check init (where 0)
//FIXME split private & public
// when used for filters they must have an odd number of elements
......@@ -185,6 +97,9 @@ SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH,
SwsFilter *srcFilter, SwsFilter *dstFilter);
void swsGetFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation);
int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation);
SwsVector *getGaussianVec(double variance, double quality);
SwsVector *getConstVec(double c, int length);
SwsVector *getIdentityVec(void);
......@@ -199,3 +114,4 @@ SwsVector *cloneVec(SwsVector *a);
void printVec(SwsVector *a);
void freeVec(SwsVector *a);
#endif
/*
Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SWSCALE_INTERNAL_H
#define SWSCALE_INTERNAL_H
#define MAX_FILTER_SIZE 256
struct SwsContext;
typedef void (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]);
/* this struct should be aligned on at least 32-byte boundary */
typedef struct SwsContext{
int srcW, srcH, dstH;
int chrSrcW, chrSrcH, chrDstW, chrDstH;
int lumXInc, chrXInc;
int lumYInc, chrYInc;
int dstFormat, srcFormat;
int chrSrcHSubSample, chrSrcVSubSample;
int chrIntHSubSample, chrIntVSubSample;
int chrDstHSubSample, chrDstVSubSample;
int vChrDrop;
int16_t **lumPixBuf;
int16_t **chrPixBuf;
int16_t *hLumFilter;
int16_t *hLumFilterPos;
int16_t *hChrFilter;
int16_t *hChrFilterPos;
int16_t *vLumFilter;
int16_t *vLumFilterPos;
int16_t *vChrFilter;
int16_t *vChrFilterPos;
uint8_t formatConvBuffer[4000]; //FIXME dynamic alloc, but we have to change alot of code for this to be usefull
int hLumFilterSize;
int hChrFilterSize;
int vLumFilterSize;
int vChrFilterSize;
int vLumBufSize;
int vChrBufSize;
uint8_t __attribute__((aligned(32))) funnyYCode[10000];
uint8_t __attribute__((aligned(32))) funnyUVCode[10000];
int32_t *lumMmx2FilterPos;
int32_t *chrMmx2FilterPos;
int16_t *lumMmx2Filter;
int16_t *chrMmx2Filter;
int canMMX2BeUsed;
int lastInLumBuf;
int lastInChrBuf;
int lumBufIndex;
int chrBufIndex;
int dstY;
int flags;
void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
void * table_rV[256];
void * table_gU[256];
int table_gV[256];
void * table_bU[256];
//Colorspace stuff
int contrast, brightness, saturation; // for sws_getColorspaceDetails
int srcColorspaceTable[4];
int dstColorspaceTable[4];
int srcRange, dstRange;
SwsFunc swScale;
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
#define BLUE_DITHER "2*8"
#define Y_COEFF "3*8"
#define VR_COEFF "4*8"
#define UB_COEFF "5*8"
#define VG_COEFF "6*8"
#define UG_COEFF "7*8"
#define Y_OFFSET "8*8"
#define U_OFFSET "9*8"
#define V_OFFSET "10*8"
#define LUM_MMX_FILTER_OFFSET "11*8"
#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
#define DSTW_OFFSET "11*8+4*4*256*2"
#define ESP_OFFSET "11*8+4*4*256*2+4"
uint64_t redDither __attribute__((aligned(8)));
uint64_t greenDither __attribute__((aligned(8)));
uint64_t blueDither __attribute__((aligned(8)));
uint64_t yCoeff __attribute__((aligned(8)));
uint64_t vrCoeff __attribute__((aligned(8)));
uint64_t ubCoeff __attribute__((aligned(8)));
uint64_t vgCoeff __attribute__((aligned(8)));
uint64_t ugCoeff __attribute__((aligned(8)));
uint64_t yOffset __attribute__((aligned(8)));
uint64_t uOffset __attribute__((aligned(8)));
uint64_t vOffset __attribute__((aligned(8)));
int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
int dstW;
int esp;
} SwsContext;
//FIXME check init (where 0)
//FIXME split private & public
inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]);
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
#endif
/*
Copyright (C) 2001-2002 Michael Niedermayer <michaelni@gmx.at>
Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -741,7 +741,6 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t *
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
{
int dummy=0;
#ifdef HAVE_MMX
if(uDest != NULL)
{
......@@ -2553,8 +2552,8 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStridePar
uint8_t *src[3];
uint8_t *dst[3];
orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
if(isPacked(c->srcFormat)){
src[0]=
......
This diff is collapsed.
......@@ -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]);
}