summaryrefslogtreecommitdiffstats
path: root/postproc
diff options
context:
space:
mode:
authormichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-05 19:10:42 +0000
committermichael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-05 19:10:42 +0000
commitafe814841c5d86714b7fd9026bb209c6a54a21c4 (patch)
treefcaecbf45dfee486fe496e8029e83908569c80cd /postproc
parentb0a644a306560d440ef26a4943901f764dc27e84 (diff)
downloadmpv-afe814841c5d86714b7fd9026bb209c6a54a21c4.tar.bz2
mpv-afe814841c5d86714b7fd9026bb209c6a54a21c4.tar.xz
YUV 411/422/444 support for pp
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8806 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r--postproc/postprocess.c12
-rw-r--r--postproc/postprocess.h8
-rw-r--r--postproc/postprocess_internal.h3
-rw-r--r--postproc/postprocess_template.c11
4 files changed, 26 insertions, 8 deletions
diff --git a/postproc/postprocess.c b/postproc/postprocess.c
index 5fc0b7c102..222c39db00 100644
--- a/postproc/postprocess.c
+++ b/postproc/postprocess.c
@@ -753,6 +753,13 @@ pp_context_t *pp_get_context(int width, int height, int cpuCaps){
memset(c, 0, sizeof(PPContext));
c->cpuCaps= cpuCaps;
+ if(cpuCaps&PP_FORMAT){
+ c->hChromaSubSample= cpuCaps&0x3;
+ c->vChromaSubSample= (cpuCaps>>4)&0x3;
+ }else{
+ c->hChromaSubSample= 1;
+ c->vChromaSubSample= 1;
+ }
reallocBuffers(c, width, height, stride);
@@ -795,7 +802,6 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3],
if(c->stride < minStride)
reallocBuffers(c, width, height, minStride);
-
if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
{
@@ -840,8 +846,8 @@ for(y=0; y<mbHeight; y++){
postProcess(src[0], srcStride[0], dst[0], dstStride[0],
width, height, QP_store, QPStride, 0, mode, c);
- width = (width +1)>>1;
- height = (height+1)>>1;
+ width = (width )>>c->hChromaSubSample;
+ height = (height)>>c->vChromaSubSample;
if(mode->chromMode)
{
diff --git a/postproc/postprocess.h b/postproc/postprocess.h
index 929cf3afbe..6726fca0b2 100644
--- a/postproc/postprocess.h
+++ b/postproc/postprocess.h
@@ -43,11 +43,17 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3],
pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality);
void pp_free_mode(pp_mode_t *mode);
-pp_context_t *pp_get_context(int width, int height, int cpuCaps);
+pp_context_t *pp_get_context(int width, int height, int flags);
void pp_free_context(pp_context_t *ppContext);
#define PP_CPU_CAPS_MMX 0x80000000
#define PP_CPU_CAPS_MMX2 0x20000000
#define PP_CPU_CAPS_3DNOW 0x40000000
+#define PP_FORMAT 0x00000008
+#define PP_FORMAT_420 (0x00000011|PP_FORMAT)
+#define PP_FORMAT_422 (0x00000001|PP_FORMAT)
+#define PP_FORMAT_411 (0x00000002|PP_FORMAT)
+#define PP_FORMAT_444 (0x00000000|PP_FORMAT)
+
#endif
diff --git a/postproc/postprocess_internal.h b/postproc/postprocess_internal.h
index e95e5e76de..f45a0cf85b 100644
--- a/postproc/postprocess_internal.h
+++ b/postproc/postprocess_internal.h
@@ -119,6 +119,9 @@ typedef struct PPContext{
int cpuCaps;
int stride; //size of some buffers (needed to realloc them if needed)
+
+ int hChromaSubSample;
+ int vChromaSubSample;
PPMode ppMode;
} PPContext;
diff --git a/postproc/postprocess_template.c b/postproc/postprocess_template.c
index 092d8c6626..df54e6f09c 100644
--- a/postproc/postprocess_template.c
+++ b/postproc/postprocess_template.c
@@ -2663,6 +2663,9 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
int i;
#endif
+ const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
+ const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
+
//FIXME remove
uint64_t * const yHistogram= c.yHistogram;
uint8_t * const tempSrc= c.tempSrc;
@@ -2846,8 +2849,8 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
uint8_t *tempBlock1= c.tempBlocks;
uint8_t *tempBlock2= c.tempBlocks + 8;
#endif
- int8_t *QPptr= isColor ? &QPs[(y>>3)*QPStride] :&QPs[(y>>4)*QPStride];
- int8_t *nonBQPptr= isColor ? &c.nonBQPTable[(y>>3)*mbWidth] :&c.nonBQPTable[(y>>4)*mbWidth];
+ int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
+ int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*mbWidth];
int QP=0;
/* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
if not than use a temporary buffer */
@@ -2886,8 +2889,8 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int
#endif
if(isColor)
{
- QP= QPptr[x>>3];
- c.nonBQP= nonBQPptr[x>>3];
+ QP= QPptr[x>>qpHShift];
+ c.nonBQP= nonBQPptr[x>>qpHShift];
}
else
{