mirror of https://git.ffmpeg.org/ffmpeg.git
mb type & qp vissualization
Originally committed as revision 2603 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
11dffbe1da
commit
864119b6ca
|
@ -1140,6 +1140,8 @@ typedef struct AVCodecContext {
|
|||
#define FF_DEBUG_ER 0x00000400
|
||||
#define FF_DEBUG_MMCO 0x00000800
|
||||
#define FF_DEBUG_BUGS 0x00001000
|
||||
#define FF_DEBUG_VIS_QP 0x00002000
|
||||
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
|
||||
|
||||
/**
|
||||
* error.
|
||||
|
|
|
@ -1413,7 +1413,7 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){
|
|||
}
|
||||
}
|
||||
|
||||
if((s->avctx->debug&FF_DEBUG_VIS_MV) && pict->motion_val){
|
||||
if(s->avctx->debug&(FF_DEBUG_VIS_MV|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)){
|
||||
const int shift= 1 + s->quarter_sample;
|
||||
int mb_y;
|
||||
uint8_t *ptr= pict->data[0];
|
||||
|
@ -1423,7 +1423,8 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){
|
|||
int mb_x;
|
||||
for(mb_x=0; mb_x<s->mb_width; mb_x++){
|
||||
const int mb_index= mb_x + mb_y*s->mb_stride;
|
||||
if(IS_8X8(pict->mb_type[mb_index])){
|
||||
if((s->avctx->debug&FF_DEBUG_VIS_MV) && pict->motion_val){
|
||||
if(IS_8X8(pict->mb_type[mb_index])){
|
||||
int i;
|
||||
for(i=0; i<4; i++){
|
||||
int sx= mb_x*16 + 4 + 8*(i&1);
|
||||
|
@ -1433,7 +1434,7 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){
|
|||
int my= (pict->motion_val[0][xy][1]>>shift) + sy;
|
||||
draw_arrow(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
|
||||
}
|
||||
}else if(IS_16X8(pict->mb_type[mb_index])){
|
||||
}else if(IS_16X8(pict->mb_type[mb_index])){
|
||||
int i;
|
||||
for(i=0; i<2; i++){
|
||||
int sx=mb_x*16 + 8;
|
||||
|
@ -1443,13 +1444,78 @@ void ff_print_debug_info(MpegEncContext *s, Picture *pict){
|
|||
int my=(pict->motion_val[0][xy][1]>>shift) + sy;
|
||||
draw_arrow(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
|
||||
}
|
||||
}else{
|
||||
}else{
|
||||
int sx= mb_x*16 + 8;
|
||||
int sy= mb_y*16 + 8;
|
||||
int xy= 1 + mb_x*2 + (mb_y*2 + 1)*(s->mb_width*2 + 2);
|
||||
int mx= (pict->motion_val[0][xy][0]>>shift) + sx;
|
||||
int my= (pict->motion_val[0][xy][1]>>shift) + sy;
|
||||
draw_arrow(ptr, sx, sy, mx, my, s->width, s->height, s->linesize, 100);
|
||||
}
|
||||
}
|
||||
if((s->avctx->debug&FF_DEBUG_VIS_QP) && pict->motion_val){
|
||||
uint64_t c= (pict->qscale_table[mb_index]*128/31) * 0x0101010101010101ULL;
|
||||
int y;
|
||||
for(y=0; y<8; y++){
|
||||
*(uint64_t*)(pict->data[1] + 8*mb_x + (8*mb_y + y)*pict->linesize[1])= c;
|
||||
*(uint64_t*)(pict->data[2] + 8*mb_x + (8*mb_y + y)*pict->linesize[2])= c;
|
||||
}
|
||||
}
|
||||
if((s->avctx->debug&FF_DEBUG_VIS_MB_TYPE) && pict->motion_val){
|
||||
int mb_type= pict->mb_type[mb_index];
|
||||
uint64_t u,v;
|
||||
int y;
|
||||
#define COLOR(theta, r)\
|
||||
u= (int)(128 + r*cos(theta*3.141592/180));\
|
||||
v= (int)(128 + r*sin(theta*3.141592/180));
|
||||
|
||||
|
||||
u=v=128;
|
||||
if(IS_PCM(mb_type)){
|
||||
COLOR(120,48)
|
||||
}else if((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) || IS_INTRA16x16(mb_type)){
|
||||
COLOR(30,48)
|
||||
}else if(IS_INTRA4x4(mb_type)){
|
||||
COLOR(90,48)
|
||||
}else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type)){
|
||||
// COLOR(120,48)
|
||||
}else if(IS_DIRECT(mb_type)){
|
||||
COLOR(150,48)
|
||||
}else if(IS_GMC(mb_type) && IS_SKIP(mb_type)){
|
||||
COLOR(170,48)
|
||||
}else if(IS_GMC(mb_type)){
|
||||
COLOR(190,48)
|
||||
}else if(IS_SKIP(mb_type)){
|
||||
// COLOR(180,48)
|
||||
}else if(!USES_LIST(mb_type, 1)){
|
||||
COLOR(240,48)
|
||||
}else if(!USES_LIST(mb_type, 0)){
|
||||
COLOR(0,48)
|
||||
}else{
|
||||
assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
|
||||
COLOR(300,48)
|
||||
}
|
||||
|
||||
u*= 0x0101010101010101ULL;
|
||||
v*= 0x0101010101010101ULL;
|
||||
for(y=0; y<8; y++){
|
||||
*(uint64_t*)(pict->data[1] + 8*mb_x + (8*mb_y + y)*pict->linesize[1])= u;
|
||||
*(uint64_t*)(pict->data[2] + 8*mb_x + (8*mb_y + y)*pict->linesize[2])= v;
|
||||
}
|
||||
|
||||
//segmentation
|
||||
if(IS_8X8(mb_type) || IS_16X8(mb_type)){
|
||||
*(uint64_t*)(pict->data[0] + 16*mb_x + 0 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL;
|
||||
*(uint64_t*)(pict->data[0] + 16*mb_x + 8 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL;
|
||||
}
|
||||
if(IS_8X8(mb_type) || IS_8X16(mb_type)){
|
||||
for(y=0; y<16; y++)
|
||||
pict->data[0][16*mb_x + 8 + (16*mb_y + y)*pict->linesize[0]]^= 0x80;
|
||||
}
|
||||
|
||||
if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264){
|
||||
// hmm
|
||||
}
|
||||
}
|
||||
s->mbskip_table[mb_index]=0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue