postproc: add basic deblock filter visualization support

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/86/head
Michael Niedermayer 10 years ago
parent 266b3d4fe4
commit ac682955e9
  1. 3
      doc/APIchanges
  2. 20
      libpostproc/postprocess.c
  3. 1
      libpostproc/postprocess_internal.h
  4. 14
      libpostproc/postprocess_template.c
  5. 2
      libpostproc/version.h

@ -15,6 +15,9 @@ libavutil: 2014-08-09
API changes, most recent first:
2014-09-24 - xxxxxxx - libpostproc 53.1.100
Add vissualization support
2014-09-xx - xxxxxxx - lavc 56.1.101 - dv_profile.h
deprecate avpriv_dv_frame_profile2(), which was made public by accident.

@ -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;
}

@ -69,6 +69,7 @@
#define TEMP_NOISE_FILTER 0x100000
#define FORCE_QUANT 0x200000
#define BITEXACT 0x1000000
#define VISUALIZE 0x2000000
//use if you want a faster postprocessing code
//cannot differentiate between chroma & luma filters (both on or both off)

@ -2544,7 +2544,7 @@ Switch between
/**
* accurate deblock filter
*/
static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, const PPContext *c){
static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, const PPContext *c, int mode){
int64_t dc_mask, eq_mask, both_masks;
int64_t sums[10*8*2];
src+= step*3; // src points to begin of the 8x8 Block
@ -3272,6 +3272,12 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
uint8_t * const tempDst= (dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride) + 32;
//const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
if (mode & VISUALIZE){
if(!(mode & (V_A_DEBLOCK | H_A_DEBLOCK)) || TEMPLATE_PP_MMX) {
av_log(c2, AV_LOG_WARNING, "Visualization is currently only supported with the accurate deblock filter without SIMD\n");
}
}
#if TEMPLATE_PP_MMX
for(i=0; i<57; i++){
int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
@ -3566,7 +3572,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
else if(t==2)
RENAME(doVertDefFilter)(dstBlock, stride, &c);
}else if(mode & V_A_DEBLOCK){
RENAME(do_a_deblock)(dstBlock, stride, 1, &c);
RENAME(do_a_deblock)(dstBlock, stride, 1, &c, mode);
}
}
@ -3587,7 +3593,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
else if(t==2)
RENAME(doVertDefFilter)(tempBlock1, 16, &c);
}else if(mode & H_A_DEBLOCK){
RENAME(do_a_deblock)(tempBlock1, 16, 1, &c);
RENAME(do_a_deblock)(tempBlock1, 16, 1, &c, mode);
}
RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
@ -3619,7 +3625,7 @@ static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[
RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
#endif
}else if(mode & H_A_DEBLOCK){
RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c, mode);
}
#endif //TEMPLATE_PP_MMX
if(mode & DERING){

@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#define LIBPOSTPROC_VERSION_MAJOR 53
#define LIBPOSTPROC_VERSION_MINOR 0
#define LIBPOSTPROC_VERSION_MINOR 1
#define LIBPOSTPROC_VERSION_MICRO 100
#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \

Loading…
Cancel
Save