summaryrefslogtreecommitdiff
path: root/libpostproc/postprocess.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-19 15:21:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-24 16:58:47 +0200
commitac682955e90a29de9b515004af7e24d06bfa6994 (patch)
treec8c95e5b55d153be9ff5ebff8ee5d34426158daf /libpostproc/postprocess.c
parent266b3d4fe48af53acff454ca59c507bc7d05885f (diff)
postproc: add basic deblock filter visualization support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libpostproc/postprocess.c')
-rw-r--r--libpostproc/postprocess.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index e06c29b084..bb6a3b4e61 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -151,6 +151,7 @@ static const struct PPFilter filters[]=
{"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER},
{"fq", "forcequant", 1, 0, 0, FORCE_QUANT},
{"be", "bitexact", 1, 0, 0, BITEXACT},
+ {"vi", "visualize", 1, 0, 0, VISUALIZE},
{NULL, NULL,0,0,0,0} //End Marker
};
@@ -430,7 +431,7 @@ static inline void horizX1Filter(uint8_t *src, int stride, int QP)
* accurate deblock filter
*/
static av_always_inline void do_a_deblock_C(uint8_t *src, int step,
- int stride, const PPContext *c)
+ int stride, const PPContext *c, int mode)
{
int y;
const int QP= c->QP;
@@ -485,6 +486,16 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step,
sums[8] = sums[7] - src[3*step] + last;
sums[9] = sums[8] - src[4*step] + last;
+ if (mode & VISUALIZE) {
+ src[0*step] =
+ src[1*step] =
+ src[2*step] =
+ src[3*step] =
+ src[4*step] =
+ src[5*step] =
+ src[6*step] =
+ src[7*step] = 128;
+ }
src[0*step]= (sums[0] + sums[2] + 2*src[0*step])>>4;
src[1*step]= (sums[1] + sums[3] + 2*src[1*step])>>4;
src[2*step]= (sums[2] + sums[4] + 2*src[2*step])>>4;
@@ -516,6 +527,13 @@ static av_always_inline void do_a_deblock_C(uint8_t *src, int step,
d = FFMAX(d, q);
}
+ if ((mode & VISUALIZE) && d) {
+ d= (d < 0) ? 32 : -32;
+ src[3*step]= av_clip_uint8(src[3*step] - d);
+ src[4*step]= av_clip_uint8(src[4*step] + d);
+ d = 0;
+ }
+
src[3*step]-= d;
src[4*step]+= d;
}