mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-03 13:32:10 +00:00
cleanup
Originally committed as revision 9500 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
This commit is contained in:
parent
8c031d1cbd
commit
3e499f531a
@ -1764,7 +1764,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int
|
||||
/**
|
||||
* bring pointers in YUV order instead of YVU
|
||||
*/
|
||||
inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
|
||||
inline static 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];
|
||||
@ -1797,16 +1797,8 @@ inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], ui
|
||||
}
|
||||
|
||||
/* unscaled copy like stuff (assumes nearly identical formats) */
|
||||
static int simpleCopy(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
|
||||
|
||||
int srcStride[3];
|
||||
int dstStride[3];
|
||||
uint8_t *src[3];
|
||||
uint8_t *dst[3];
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
|
||||
static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
|
||||
if(isPacked(c->srcFormat))
|
||||
{
|
||||
@ -2382,11 +2374,18 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
|
||||
/**
|
||||
* swscale warper, so we dont need to export the SwsContext
|
||||
*/
|
||||
int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
|
||||
int srcStride[3];
|
||||
int dstStride[3];
|
||||
uint8_t *src[3];
|
||||
uint8_t *dst[3];
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
|
||||
//printf("sws: slice %d %d\n", srcSliceY, srcSliceH);
|
||||
return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
|
||||
}
|
||||
//FIXME order YV12/I420 here
|
||||
|
||||
/**
|
||||
* returns a normalized gaussian curve used to filter stuff
|
||||
|
@ -26,6 +26,10 @@ typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride
|
||||
|
||||
/* this struct should be aligned on at least 32-byte boundary */
|
||||
typedef struct SwsContext{
|
||||
/**
|
||||
*
|
||||
* Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
|
||||
*/
|
||||
SwsFunc swScale;
|
||||
int srcW, srcH, dstH;
|
||||
int chrSrcW, chrSrcH, chrDstW, chrDstH;
|
||||
@ -119,7 +123,6 @@ typedef struct SwsContext{
|
||||
} SwsContext;
|
||||
//FIXME check init (where 0)
|
||||
|
||||
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);
|
||||
|
||||
|
@ -1585,7 +1585,7 @@ static inline void RENAME(bgr32ToY)(uint8_t *dst, uint8_t *src, int width)
|
||||
{
|
||||
int b= ((uint32_t*)src)[i]&0xFF;
|
||||
int g= (((uint32_t*)src)[i]>>8)&0xFF;
|
||||
int r= ((uint32_t*)src)[i]>>16;
|
||||
int r= (((uint32_t*)src)[i]>>16)&0xFF;
|
||||
|
||||
dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
|
||||
}
|
||||
@ -1946,7 +1946,7 @@ static inline void RENAME(rgb32ToY)(uint8_t *dst, uint8_t *src, int width)
|
||||
{
|
||||
int r= ((uint32_t*)src)[i]&0xFF;
|
||||
int g= (((uint32_t*)src)[i]>>8)&0xFF;
|
||||
int b= ((uint32_t*)src)[i]>>16;
|
||||
int b= (((uint32_t*)src)[i]>>16)&0xFF;
|
||||
|
||||
dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
|
||||
}
|
||||
@ -2502,8 +2502,8 @@ FUNNY_UV_CODE
|
||||
}
|
||||
}
|
||||
|
||||
static int RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
|
||||
static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
|
||||
/* load a few things into local vars to make the code more readable? and faster */
|
||||
const int srcW= c->srcW;
|
||||
@ -2548,21 +2548,14 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStridePara
|
||||
int chrBufIndex= c->chrBufIndex;
|
||||
int lastInLumBuf= c->lastInLumBuf;
|
||||
int lastInChrBuf= c->lastInChrBuf;
|
||||
int srcStride[3];
|
||||
int dstStride[3];
|
||||
uint8_t *src[3];
|
||||
uint8_t *dst[3];
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
|
||||
|
||||
if(isPacked(c->srcFormat)){
|
||||
src[0]=
|
||||
src[1]=
|
||||
src[2]= srcParam[0];
|
||||
src[2]= src[0];
|
||||
srcStride[0]=
|
||||
srcStride[1]=
|
||||
srcStride[2]= srcStrideParam[0];
|
||||
srcStride[2]= srcStride[0];
|
||||
}
|
||||
srcStride[1]<<= c->vChrDrop;
|
||||
srcStride[2]<<= c->vChrDrop;
|
||||
|
@ -262,13 +262,10 @@ const int32_t Inverse_Table_6_9[8][4] = {
|
||||
dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];
|
||||
|
||||
#define PROLOG(func_name, dst_type) \
|
||||
static int func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, \
|
||||
static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){\
|
||||
uint8_t *src[3];\
|
||||
int srcStride[3];\
|
||||
int y;\
|
||||
\
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);\
|
||||
if(c->srcFormat == IMGFMT_422P){\
|
||||
srcStride[1] *= 2;\
|
||||
srcStride[2] *= 2;\
|
||||
|
@ -33,12 +33,8 @@
|
||||
#include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff
|
||||
#include "swscale.h"
|
||||
|
||||
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], 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;
|
||||
@ -51,12 +47,8 @@ static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStride
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], 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;
|
||||
@ -69,12 +61,8 @@ static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStride
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], 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;
|
||||
|
@ -123,13 +123,10 @@
|
||||
"punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
|
||||
|
||||
|
||||
static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
int srcStride[3];
|
||||
uint8_t *src[3];
|
||||
int y, h_size;
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
if(c->srcFormat == IMGFMT_422P){
|
||||
srcStride[1] *= 2;
|
||||
srcStride[2] *= 2;
|
||||
@ -221,13 +218,10 @@ YUV2RGB
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
int srcStride[3];
|
||||
uint8_t *src[3];
|
||||
int y, h_size;
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
if(c->srcFormat == IMGFMT_422P){
|
||||
srcStride[1] *= 2;
|
||||
srcStride[2] *= 2;
|
||||
@ -313,13 +307,10 @@ YUV2RGB
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
int srcStride[3];
|
||||
uint8_t *src[3];
|
||||
int y, h_size;
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
if(c->srcFormat == IMGFMT_422P){
|
||||
srcStride[1] *= 2;
|
||||
srcStride[2] *= 2;
|
||||
@ -462,13 +453,10 @@ YUV2RGB
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
|
||||
static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
|
||||
int srcSliceH, uint8_t* dst[], int dstStride[]){
|
||||
int srcStride[3];
|
||||
uint8_t *src[3];
|
||||
int y, h_size;
|
||||
|
||||
sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
|
||||
if(c->srcFormat == IMGFMT_422P){
|
||||
srcStride[1] *= 2;
|
||||
srcStride[2] *= 2;
|
||||
|
Loading…
Reference in New Issue
Block a user