was broken by the buffer ref stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -749,11 +749,11 @@ intrax8_decoded: |
749 | 749 |
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { |
750 | 750 |
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) |
751 | 751 |
return ret; |
752 |
- ff_print_debug_info(s, s->current_picture_ptr); |
|
752 |
+ ff_print_debug_info(s, s->current_picture_ptr, pict); |
|
753 | 753 |
} else if (s->last_picture_ptr != NULL) { |
754 | 754 |
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) |
755 | 755 |
return ret; |
756 |
- ff_print_debug_info(s, s->last_picture_ptr); |
|
756 |
+ ff_print_debug_info(s, s->last_picture_ptr, pict); |
|
757 | 757 |
} |
758 | 758 |
|
759 | 759 |
if(s->last_picture_ptr || s->low_delay){ |
... | ... |
@@ -4920,7 +4920,7 @@ not_extra: |
4920 | 4920 |
*got_frame = 1; |
4921 | 4921 |
if (CONFIG_MPEGVIDEO) { |
4922 | 4922 |
ff_print_debug_info2(h->avctx, h->next_output_pic, pict, h->er.mbskip_table, |
4923 |
- h->visualization_buffer, &h->low_delay, |
|
4923 |
+ &h->low_delay, |
|
4924 | 4924 |
h->mb_width, h->mb_height, h->mb_stride, 1); |
4925 | 4925 |
} |
4926 | 4926 |
} |
... | ... |
@@ -1989,7 +1989,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) |
1989 | 1989 |
int ret = av_frame_ref(pict, &s->current_picture_ptr->f); |
1990 | 1990 |
if (ret < 0) |
1991 | 1991 |
return ret; |
1992 |
- ff_print_debug_info(s, s->current_picture_ptr); |
|
1992 |
+ ff_print_debug_info(s, s->current_picture_ptr, pict); |
|
1993 | 1993 |
} else { |
1994 | 1994 |
if (avctx->active_thread_type & FF_THREAD_FRAME) |
1995 | 1995 |
s->picture_number++; |
... | ... |
@@ -1999,7 +1999,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) |
1999 | 1999 |
int ret = av_frame_ref(pict, &s->last_picture_ptr->f); |
2000 | 2000 |
if (ret < 0) |
2001 | 2001 |
return ret; |
2002 |
- ff_print_debug_info(s, s->last_picture_ptr); |
|
2002 |
+ ff_print_debug_info(s, s->last_picture_ptr, pict); |
|
2003 | 2003 |
} |
2004 | 2004 |
} |
2005 | 2005 |
|
... | ... |
@@ -1914,7 +1914,7 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, |
1914 | 1914 |
* Print debugging info for the given picture. |
1915 | 1915 |
*/ |
1916 | 1916 |
void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint8_t *mbskip_table, |
1917 |
- uint8_t *visualization_buffer[3], int *low_delay, |
|
1917 |
+ int *low_delay, |
|
1918 | 1918 |
int mb_width, int mb_height, int mb_stride, int quarter_sample) |
1919 | 1919 |
{ |
1920 | 1920 |
if (avctx->hwaccel || !p || !p->mb_type |
... | ... |
@@ -2001,20 +2001,16 @@ void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint |
2001 | 2001 |
int h_chroma_shift, v_chroma_shift, block_height; |
2002 | 2002 |
const int width = avctx->width; |
2003 | 2003 |
const int height = avctx->height; |
2004 |
- const int mv_sample_log2 = 4 - pict->motion_subsample_log2; |
|
2004 |
+ const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_SVQ3 ? 2 : 1; |
|
2005 | 2005 |
const int mv_stride = (mb_width << mv_sample_log2) + |
2006 | 2006 |
(avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1); |
2007 |
+ |
|
2007 | 2008 |
*low_delay = 0; // needed to see the vectors without trashing the buffers |
2008 | 2009 |
|
2009 | 2010 |
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); |
2010 | 2011 |
|
2011 |
- for (i = 0; i < 3; i++) { |
|
2012 |
- size_t size= (i == 0) ? pict->linesize[i] * FFALIGN(height, 16): |
|
2013 |
- pict->linesize[i] * FFALIGN(height, 16) >> v_chroma_shift; |
|
2014 |
- visualization_buffer[i]= av_realloc(visualization_buffer[i], size); |
|
2015 |
- memcpy(visualization_buffer[i], pict->data[i], size); |
|
2016 |
- pict->data[i] = visualization_buffer[i]; |
|
2017 |
- } |
|
2012 |
+ av_frame_make_writable(pict); |
|
2013 |
+ |
|
2018 | 2014 |
pict->opaque = NULL; |
2019 | 2015 |
ptr = pict->data[0]; |
2020 | 2016 |
block_height = 16 >> v_chroma_shift; |
... | ... |
@@ -2203,9 +2199,9 @@ void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint |
2203 | 2203 |
} |
2204 | 2204 |
} |
2205 | 2205 |
|
2206 |
-void ff_print_debug_info(MpegEncContext *s, Picture *p) |
|
2206 |
+void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict) |
|
2207 | 2207 |
{ |
2208 |
- ff_print_debug_info2(s->avctx, p, &p->f, s->mbskip_table, s->visualization_buffer, &s->low_delay, |
|
2208 |
+ ff_print_debug_info2(s->avctx, p, pict, s->mbskip_table, &s->low_delay, |
|
2209 | 2209 |
s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample); |
2210 | 2210 |
} |
2211 | 2211 |
|
... | ... |
@@ -808,9 +808,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, |
808 | 808 |
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); |
809 | 809 |
void ff_mpeg_flush(AVCodecContext *avctx); |
810 | 810 |
|
811 |
-void ff_print_debug_info(MpegEncContext *s, Picture *p); |
|
811 |
+void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict); |
|
812 | 812 |
void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint8_t *mbskip_table, |
813 |
- uint8_t *visualization_buffer[3], int *low_delay, |
|
813 |
+ int *low_delay, |
|
814 | 814 |
int mb_width, int mb_height, int mb_stride, int quarter_sample); |
815 | 815 |
|
816 | 816 |
void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix); |
... | ... |
@@ -741,11 +741,11 @@ static int rv10_decode_frame(AVCodecContext *avctx, |
741 | 741 |
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { |
742 | 742 |
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) |
743 | 743 |
return ret; |
744 |
- ff_print_debug_info(s, s->current_picture_ptr); |
|
744 |
+ ff_print_debug_info(s, s->current_picture_ptr, pict); |
|
745 | 745 |
} else if (s->last_picture_ptr != NULL) { |
746 | 746 |
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) |
747 | 747 |
return ret; |
748 |
- ff_print_debug_info(s, s->last_picture_ptr); |
|
748 |
+ ff_print_debug_info(s, s->last_picture_ptr, pict); |
|
749 | 749 |
} |
750 | 750 |
|
751 | 751 |
if(s->last_picture_ptr || s->low_delay){ |
... | ... |
@@ -1583,12 +1583,12 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) |
1583 | 1583 |
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { |
1584 | 1584 |
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) |
1585 | 1585 |
return ret; |
1586 |
- ff_print_debug_info(s, s->current_picture_ptr); |
|
1586 |
+ ff_print_debug_info(s, s->current_picture_ptr, pict); |
|
1587 | 1587 |
got_picture = 1; |
1588 | 1588 |
} else if (s->last_picture_ptr != NULL) { |
1589 | 1589 |
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) |
1590 | 1590 |
return ret; |
1591 |
- ff_print_debug_info(s, s->last_picture_ptr); |
|
1591 |
+ ff_print_debug_info(s, s->last_picture_ptr, pict); |
|
1592 | 1592 |
got_picture = 1; |
1593 | 1593 |
} |
1594 | 1594 |
|
... | ... |
@@ -5763,11 +5763,11 @@ image: |
5763 | 5763 |
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { |
5764 | 5764 |
if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0) |
5765 | 5765 |
goto err; |
5766 |
- ff_print_debug_info(s, s->current_picture_ptr); |
|
5766 |
+ ff_print_debug_info(s, s->current_picture_ptr, pict); |
|
5767 | 5767 |
} else if (s->last_picture_ptr != NULL) { |
5768 | 5768 |
if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0) |
5769 | 5769 |
goto err; |
5770 |
- ff_print_debug_info(s, s->last_picture_ptr); |
|
5770 |
+ ff_print_debug_info(s, s->last_picture_ptr, pict); |
|
5771 | 5771 |
} |
5772 | 5772 |
if (s->last_picture_ptr || s->low_delay) { |
5773 | 5773 |
*got_frame = 1; |