Commit 0f5e3e59 authored by michael's avatar michael

sws_ prefix, more seperation between internal & external swscaler API

sws_scale() returns the number of outputed lines


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@9495 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 020ce57b
This diff is collapsed.
......@@ -19,7 +19,15 @@
#ifndef SWSCALE_H
#define SWSCALE_H
#include "swscale_internal.h" //FIXME HACK REMOVE
/**
* @file swscale.h
* @brief
* external api for the swscale stuff
*/
#ifdef __cplusplus
extern "C" {
#endif
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
......@@ -76,42 +84,47 @@ typedef struct {
SwsVector *chrV;
} SwsFilter;
struct SwsContext;
//typedef struct SwsContext;
// *** bilinear scaling and yuv->rgb & yuv->yuv conversion of yv12 slices:
// *** Note: it's called multiple times while decoding a frame, first time y==0
// dstbpp == 12 -> yv12 output
// will use sws_flags
// deprecated, will be removed
void SwScale_YV12slice(unsigned char* src[],int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride, int dstbpp,
int srcW, int srcH, int dstW, int dstH);
// Obsolete, will be removed soon
void SwScale_Init();
void sws_freeContext(struct SwsContext *swsContext);
void freeSwsContext(SwsContext *swsContext);
SwsContext *getSwsContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
SwsContext *getSwsContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat);
struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
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);
void scaleVec(SwsVector *a, double scalar);
void normalizeVec(SwsVector *a, double height);
void convVec(SwsVector *a, SwsVector *b);
void addVec(SwsVector *a, SwsVector *b);
void subVec(SwsVector *a, SwsVector *b);
void shiftVec(SwsVector *a, int shift);
SwsVector *cloneVec(SwsVector *a);
void printVec(SwsVector *a);
void freeVec(SwsVector *a);
int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]);
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam); //FIXME try to seperate this
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation);
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation);
SwsVector *sws_getGaussianVec(double variance, double quality);
SwsVector *sws_getConstVec(double c, int length);
SwsVector *sws_getIdentityVec(void);
void sws_scaleVec(SwsVector *a, double scalar);
void sws_normalizeVec(SwsVector *a, double height);
void sws_convVec(SwsVector *a, SwsVector *b);
void sws_addVec(SwsVector *a, SwsVector *b);
void sws_subVec(SwsVector *a, SwsVector *b);
void sws_shiftVec(SwsVector *a, int shift);
SwsVector *sws_cloneVec(SwsVector *a);
void sws_printVec(SwsVector *a);
void sws_freeVec(SwsVector *a);
#ifdef __cplusplus
}
#endif
#endif
......@@ -21,13 +21,12 @@
#define MAX_FILTER_SIZE 256
struct SwsContext;
typedef void (*SwsFunc)(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
typedef int (*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{
SwsFunc swScale;
int srcW, srcH, dstH;
int chrSrcW, chrSrcH, chrDstW, chrDstH;
int lumXInc, chrXInc;
......@@ -85,8 +84,6 @@ typedef struct SwsContext{
int dstColorspaceTable[4];
int srcRange, dstRange;
SwsFunc swScale;
#define RED_DITHER "0*8"
#define GREEN_DITHER "1*8"
#define BLUE_DITHER "2*8"
......@@ -121,7 +118,6 @@ typedef struct SwsContext{
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);
......
......@@ -2502,7 +2502,7 @@ FUNNY_UV_CODE
}
}
static void RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static int RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
/* load a few things into local vars to make the code more readable? and faster */
......@@ -2540,6 +2540,7 @@ static void RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStridePar
uint8_t *formatConvBuffer= c->formatConvBuffer;
const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample;
const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample);
int lastDstY;
/* vars whch will change and which we need to storw back in the context */
int dstY= c->dstY;
......@@ -2603,6 +2604,8 @@ i--;
lastInChrBuf= -1;
}
lastDstY= dstY;
for(;dstY < dstH; dstY++){
unsigned char *dest =dst[0]+dstStride[0]*dstY;
const int chrDstY= dstY>>c->chrDstVSubSample;
......@@ -2810,4 +2813,6 @@ i--;
c->chrBufIndex= chrBufIndex;
c->lastInLumBuf= lastInLumBuf;
c->lastInChrBuf= lastInChrBuf;
return dstY - lastDstY;
}
......@@ -262,7 +262,7 @@ 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 void func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, \
static int func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, \
int srcSliceH, uint8_t* dst[], int dstStride[]){\
uint8_t *src[3];\
int srcStride[3];\
......@@ -294,6 +294,7 @@ static void func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[],
dst_2 += dst_delta;\
}\
}\
return srcSliceH;\
}
PROLOG(yuv2rgb_c_32, uint32_t)
......
......@@ -33,7 +33,7 @@
#include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff
#include "swscale.h"
static void mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static int 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];
......@@ -48,9 +48,10 @@ static void mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStrid
mlib_VideoColorYUV2ARGB420(dst[0], src[0], src[1], src[2], c->dstW,
c->dstH, dstStride[0], srcStride[0], srcStride[1]);
return srcSliceH;
}
static void mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static int 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];
......@@ -65,9 +66,10 @@ static void mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStrid
mlib_VideoColorYUV2ABGR420(dst[0], src[0], src[1], src[2], c->dstW,
c->dstH, dstStride[0], srcStride[0], srcStride[1]);
return srcSliceH;
}
static void mlib_YUV2RGB420_24(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static int 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];
......@@ -82,6 +84,7 @@ static void mlib_YUV2RGB420_24(SwsContext *c, uint8_t* srcParam[], int srcStride
mlib_VideoColorYUV2RGB420(dst[0], src[0], src[1], src[2], c->dstW,
c->dstH, dstStride[0], srcStride[0], srcStride[1]);
return srcSliceH;
}
......
......@@ -123,7 +123,7 @@
"punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
static inline void RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
int srcStride[3];
uint8_t *src[3];
......@@ -217,9 +217,11 @@ YUV2RGB
}
__asm__ __volatile__ (EMMS);
return srcSliceH;
}
static inline void RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
int srcStride[3];
uint8_t *src[3];
......@@ -308,9 +310,10 @@ YUV2RGB
}
__asm__ __volatile__ (EMMS);
return srcSliceH;
}
static inline void RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
int srcStride[3];
uint8_t *src[3];
......@@ -456,9 +459,10 @@ YUV2RGB
}
__asm__ __volatile__ (EMMS);
return srcSliceH;
}
static inline void RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]){
int srcStride[3];
uint8_t *src[3];
......@@ -544,4 +548,5 @@ YUV2RGB
}
__asm__ __volatile__ (EMMS);
return srcSliceH;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment