diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-12 14:23:07 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-12 14:23:07 +0400 |
commit | 53fd4f559429cc17e6aa78eb90e099947294a86b (patch) | |
tree | 4d7d497a8131ef1c1bef149f33760bce85e860b7 /libavcodec | |
parent | 6ae43725323b02520fa0926422b52d2ce7fd7973 (diff) |
avcodec: fix motion vector vissualization
was broken by the buffer ref stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h261dec.c | 2 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 4 | ||||
-rw-r--r-- | libavcodec/h264.c | 2 | ||||
-rw-r--r-- | libavcodec/mpeg12.c | 4 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 18 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 4 | ||||
-rw-r--r-- | libavcodec/rv10.c | 4 | ||||
-rw-r--r-- | libavcodec/rv34.c | 4 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 4 |
9 files changed, 21 insertions, 25 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index f4f4dfb320..03770be3cd 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -634,7 +634,7 @@ retry: if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr); + ff_print_debug_info(s, s->current_picture_ptr, pict); *got_frame = 1; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 4f3168256c..084ae45248 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -749,11 +749,11 @@ intrax8_decoded: if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr); + ff_print_debug_info(s, s->current_picture_ptr, pict); } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr); + ff_print_debug_info(s, s->last_picture_ptr, pict); } if(s->last_picture_ptr || s->low_delay){ diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 1826cedf91..9dd4ceb352 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4920,7 +4920,7 @@ not_extra: *got_frame = 1; if (CONFIG_MPEGVIDEO) { ff_print_debug_info2(h->avctx, h->next_output_pic, pict, h->er.mbskip_table, - h->visualization_buffer, &h->low_delay, + &h->low_delay, h->mb_width, h->mb_height, h->mb_stride, 1); } } diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index bf23e07a7a..634f971d8a 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1989,7 +1989,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) int ret = av_frame_ref(pict, &s->current_picture_ptr->f); if (ret < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr); + ff_print_debug_info(s, s->current_picture_ptr, pict); } else { if (avctx->active_thread_type & FF_THREAD_FRAME) s->picture_number++; @@ -1999,7 +1999,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) int ret = av_frame_ref(pict, &s->last_picture_ptr->f); if (ret < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr); + ff_print_debug_info(s, s->last_picture_ptr, pict); } } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index b4c3c99393..a8a8f0bbed 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1914,7 +1914,7 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, * Print debugging info for the given picture. */ void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint8_t *mbskip_table, - uint8_t *visualization_buffer[3], int *low_delay, + int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample) { if (avctx->hwaccel || !p || !p->mb_type @@ -2001,20 +2001,16 @@ void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint int h_chroma_shift, v_chroma_shift, block_height; const int width = avctx->width; const int height = avctx->height; - const int mv_sample_log2 = 4 - pict->motion_subsample_log2; + const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_SVQ3 ? 2 : 1; const int mv_stride = (mb_width << mv_sample_log2) + (avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1); + *low_delay = 0; // needed to see the vectors without trashing the buffers avcodec_get_chroma_sub_sample(avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); - for (i = 0; i < 3; i++) { - size_t size= (i == 0) ? pict->linesize[i] * FFALIGN(height, 16): - pict->linesize[i] * FFALIGN(height, 16) >> v_chroma_shift; - visualization_buffer[i]= av_realloc(visualization_buffer[i], size); - memcpy(visualization_buffer[i], pict->data[i], size); - pict->data[i] = visualization_buffer[i]; - } + av_frame_make_writable(pict); + pict->opaque = NULL; ptr = pict->data[0]; block_height = 16 >> v_chroma_shift; @@ -2203,9 +2199,9 @@ void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint } } -void ff_print_debug_info(MpegEncContext *s, Picture *p) +void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict) { - ff_print_debug_info2(s->avctx, p, &p->f, s->mbskip_table, s->visualization_buffer, &s->low_delay, + ff_print_debug_info2(s->avctx, p, pict, s->mbskip_table, &s->low_delay, s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample); } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 2118e521a8..41850df377 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -808,9 +808,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); void ff_mpeg_flush(AVCodecContext *avctx); -void ff_print_debug_info(MpegEncContext *s, Picture *p); +void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict); void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint8_t *mbskip_table, - uint8_t *visualization_buffer[3], int *low_delay, + int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample); void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index e2ccee7aec..da347854d3 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -741,11 +741,11 @@ static int rv10_decode_frame(AVCodecContext *avctx, if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr); + ff_print_debug_info(s, s->current_picture_ptr, pict); } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr); + ff_print_debug_info(s, s->last_picture_ptr, pict); } if(s->last_picture_ptr || s->low_delay){ diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 629564a8ea..1ddac8e4af 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1583,12 +1583,12 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->current_picture_ptr); + ff_print_debug_info(s, s->current_picture_ptr, pict); got_picture = 1; } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) return ret; - ff_print_debug_info(s, s->last_picture_ptr); + ff_print_debug_info(s, s->last_picture_ptr, pict); got_picture = 1; } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index aafc358fd6..6ffb0c203f 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5763,11 +5763,11 @@ image: if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) goto err; - ff_print_debug_info(s, s->current_picture_ptr); + ff_print_debug_info(s, s->current_picture_ptr, pict); } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) goto err; - ff_print_debug_info(s, s->last_picture_ptr); + ff_print_debug_info(s, s->last_picture_ptr, pict); } if (s->last_picture_ptr || s->low_delay) { *got_frame = 1; |