Mercurial > libavcodec.hg
comparison mpegvideo.c @ 7456:211cca1e3f39 libavcodec
fix mpeg 4:2:2 vis_qp and vis_mb_type debug, fix issue #471
author | bcoudurier |
---|---|
date | Thu, 31 Jul 2008 19:51:19 +0000 |
parents | 3f819263176e |
children | 8195c970d077 |
comparison
equal
deleted
inserted
replaced
7455:0e9e36d55e5e | 7456:211cca1e3f39 |
---|---|
558 CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE); | 558 CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE); |
559 | 559 |
560 s->parse_context.state= -1; | 560 s->parse_context.state= -1; |
561 if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ | 561 if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ |
562 s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); | 562 s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); |
563 s->visualization_buffer[1] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH); | 563 s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); |
564 s->visualization_buffer[2] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH); | 564 s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); |
565 } | 565 } |
566 | 566 |
567 s->context_initialized = 1; | 567 s->context_initialized = 1; |
568 | 568 |
569 s->thread_context[0]= s; | 569 s->thread_context[0]= s; |
1162 if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ | 1162 if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ |
1163 const int shift= 1 + s->quarter_sample; | 1163 const int shift= 1 + s->quarter_sample; |
1164 int mb_y; | 1164 int mb_y; |
1165 uint8_t *ptr; | 1165 uint8_t *ptr; |
1166 int i; | 1166 int i; |
1167 int h_chroma_shift, v_chroma_shift; | 1167 int h_chroma_shift, v_chroma_shift, block_height; |
1168 const int width = s->avctx->width; | 1168 const int width = s->avctx->width; |
1169 const int height= s->avctx->height; | 1169 const int height= s->avctx->height; |
1170 const int mv_sample_log2= 4 - pict->motion_subsample_log2; | 1170 const int mv_sample_log2= 4 - pict->motion_subsample_log2; |
1171 const int mv_stride= (s->mb_width << mv_sample_log2) + (s->codec_id == CODEC_ID_H264 ? 0 : 1); | 1171 const int mv_stride= (s->mb_width << mv_sample_log2) + (s->codec_id == CODEC_ID_H264 ? 0 : 1); |
1172 s->low_delay=0; //needed to see the vectors without trashing the buffers | 1172 s->low_delay=0; //needed to see the vectors without trashing the buffers |
1176 memcpy(s->visualization_buffer[i], pict->data[i], (i==0) ? pict->linesize[i]*height:pict->linesize[i]*height >> v_chroma_shift); | 1176 memcpy(s->visualization_buffer[i], pict->data[i], (i==0) ? pict->linesize[i]*height:pict->linesize[i]*height >> v_chroma_shift); |
1177 pict->data[i]= s->visualization_buffer[i]; | 1177 pict->data[i]= s->visualization_buffer[i]; |
1178 } | 1178 } |
1179 pict->type= FF_BUFFER_TYPE_COPY; | 1179 pict->type= FF_BUFFER_TYPE_COPY; |
1180 ptr= pict->data[0]; | 1180 ptr= pict->data[0]; |
1181 block_height = 16>>v_chroma_shift; | |
1181 | 1182 |
1182 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 1183 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
1183 int mb_x; | 1184 int mb_x; |
1184 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 1185 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
1185 const int mb_index= mb_x + mb_y*s->mb_stride; | 1186 const int mb_index= mb_x + mb_y*s->mb_stride; |
1253 } | 1254 } |
1254 } | 1255 } |
1255 if((s->avctx->debug&FF_DEBUG_VIS_QP) && pict->motion_val){ | 1256 if((s->avctx->debug&FF_DEBUG_VIS_QP) && pict->motion_val){ |
1256 uint64_t c= (pict->qscale_table[mb_index]*128/31) * 0x0101010101010101ULL; | 1257 uint64_t c= (pict->qscale_table[mb_index]*128/31) * 0x0101010101010101ULL; |
1257 int y; | 1258 int y; |
1258 for(y=0; y<8; y++){ | 1259 for(y=0; y<block_height; y++){ |
1259 *(uint64_t*)(pict->data[1] + 8*mb_x + (8*mb_y + y)*pict->linesize[1])= c; | 1260 *(uint64_t*)(pict->data[1] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[1])= c; |
1260 *(uint64_t*)(pict->data[2] + 8*mb_x + (8*mb_y + y)*pict->linesize[2])= c; | 1261 *(uint64_t*)(pict->data[2] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[2])= c; |
1261 } | 1262 } |
1262 } | 1263 } |
1263 if((s->avctx->debug&FF_DEBUG_VIS_MB_TYPE) && pict->motion_val){ | 1264 if((s->avctx->debug&FF_DEBUG_VIS_MB_TYPE) && pict->motion_val){ |
1264 int mb_type= pict->mb_type[mb_index]; | 1265 int mb_type= pict->mb_type[mb_index]; |
1265 uint64_t u,v; | 1266 uint64_t u,v; |
1295 COLOR(300,48) | 1296 COLOR(300,48) |
1296 } | 1297 } |
1297 | 1298 |
1298 u*= 0x0101010101010101ULL; | 1299 u*= 0x0101010101010101ULL; |
1299 v*= 0x0101010101010101ULL; | 1300 v*= 0x0101010101010101ULL; |
1300 for(y=0; y<8; y++){ | 1301 for(y=0; y<block_height; y++){ |
1301 *(uint64_t*)(pict->data[1] + 8*mb_x + (8*mb_y + y)*pict->linesize[1])= u; | 1302 *(uint64_t*)(pict->data[1] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[1])= u; |
1302 *(uint64_t*)(pict->data[2] + 8*mb_x + (8*mb_y + y)*pict->linesize[2])= v; | 1303 *(uint64_t*)(pict->data[2] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[2])= v; |
1303 } | 1304 } |
1304 | 1305 |
1305 //segmentation | 1306 //segmentation |
1306 if(IS_8X8(mb_type) || IS_16X8(mb_type)){ | 1307 if(IS_8X8(mb_type) || IS_16X8(mb_type)){ |
1307 *(uint64_t*)(pict->data[0] + 16*mb_x + 0 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL; | 1308 *(uint64_t*)(pict->data[0] + 16*mb_x + 0 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL; |