Commit 7ac6b83b authored by lorenm's avatar lorenm

vismv for h264 displayed incorrect motion vectors.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3765 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent fe4d569c
...@@ -203,7 +203,7 @@ typedef struct H264Context{ ...@@ -203,7 +203,7 @@ typedef struct H264Context{
uint16_t *mb2b_xy; //FIXME are these 4 a good idea? uint16_t *mb2b_xy; //FIXME are these 4 a good idea?
uint16_t *mb2b8_xy; uint16_t *mb2b8_xy;
int b_stride; int b_stride; //FIXME use s->b4_stride
int b8_stride; int b8_stride;
int halfpel_flag; int halfpel_flag;
...@@ -3035,8 +3035,8 @@ static int decode_slice_header(H264Context *h){ ...@@ -3035,8 +3035,8 @@ static int decode_slice_header(H264Context *h){
s->mb_width= h->sps.mb_width; s->mb_width= h->sps.mb_width;
s->mb_height= h->sps.mb_height; s->mb_height= h->sps.mb_height;
h->b_stride= s->mb_width*4; h->b_stride= s->mb_width*4 + 1;
h->b8_stride= s->mb_width*2; h->b8_stride= s->mb_width*2 + 1;
s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width; s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width;
s->resync_mb_y = s->mb_y = first_mb_in_slice / s->mb_width; //FIXME AFFW s->resync_mb_y = s->mb_y = first_mb_in_slice / s->mb_width; //FIXME AFFW
......
...@@ -1762,6 +1762,8 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ ...@@ -1762,6 +1762,8 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
int h_chroma_shift, v_chroma_shift; int h_chroma_shift, v_chroma_shift;
const int width = s->avctx->width; const int width = s->avctx->width;
const int height= s->avctx->height; const int height= s->avctx->height;
const int mv_sample_log2= 4 - pict->motion_subsample_log2;
const int mv_stride= (s->mb_width << mv_sample_log2) + 1;
s->low_delay=0; //needed to see the vectors without trashing the buffers s->low_delay=0; //needed to see the vectors without trashing the buffers
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
...@@ -1797,13 +1799,12 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ ...@@ -1797,13 +1799,12 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
if(!USES_LIST(pict->mb_type[mb_index], direction)) if(!USES_LIST(pict->mb_type[mb_index], direction))
continue; continue;
//FIXME for h264
if(IS_8X8(pict->mb_type[mb_index])){ if(IS_8X8(pict->mb_type[mb_index])){
int i; int i;
for(i=0; i<4; i++){ for(i=0; i<4; i++){
int sx= mb_x*16 + 4 + 8*(i&1); int sx= mb_x*16 + 4 + 8*(i&1);
int sy= mb_y*16 + 4 + 8*(i>>1); int sy= mb_y*16 + 4 + 8*(i>>1);
int xy= mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*s->b8_stride; int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << mv_sample_log2-1;
int mx= (pict->motion_val[direction][xy][0]>>shift) + sx; int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
int my= (pict->motion_val[direction][xy][1]>>shift) + sy; int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100); draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
...@@ -1813,7 +1814,21 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ ...@@ -1813,7 +1814,21 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
for(i=0; i<2; i++){ for(i=0; i<2; i++){
int sx=mb_x*16 + 8; int sx=mb_x*16 + 8;
int sy=mb_y*16 + 4 + 8*i; int sy=mb_y*16 + 4 + 8*i;
int xy= mb_x*2 + (mb_y*2 + i)*s->b8_stride; int xy= (mb_x*2 + (mb_y*2 + i)*mv_stride) << mv_sample_log2-1;
int mx=(pict->motion_val[direction][xy][0]>>shift);
int my=(pict->motion_val[direction][xy][1]>>shift);
if(IS_INTERLACED(pict->mb_type[mb_index]))
my*=2;
draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100);
}
}else if(IS_8X16(pict->mb_type[mb_index])){
int i;
for(i=0; i<2; i++){
int sx=mb_x*16 + 4 + 8*i;
int sy=mb_y*16 + 8;
int xy= (mb_x*2 + i + mb_y*2*mv_stride) << mv_sample_log2-1;
int mx=(pict->motion_val[direction][xy][0]>>shift); int mx=(pict->motion_val[direction][xy][0]>>shift);
int my=(pict->motion_val[direction][xy][1]>>shift); int my=(pict->motion_val[direction][xy][1]>>shift);
...@@ -1825,7 +1840,7 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ ...@@ -1825,7 +1840,7 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
}else{ }else{
int sx= mb_x*16 + 8; int sx= mb_x*16 + 8;
int sy= mb_y*16 + 8; int sy= mb_y*16 + 8;
int xy= mb_x*2 + mb_y*2*s->b8_stride; int xy= (mb_x + mb_y*mv_stride) << mv_sample_log2;
int mx= (pict->motion_val[direction][xy][0]>>shift) + sx; int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
int my= (pict->motion_val[direction][xy][1]>>shift) + sy; int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100); draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment