diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c index 95e30b3d16c5f33984f74be5a03be0534e1061f2..51c15de40bf69177550d06b4abef79d575426e1e 100644 --- a/libavfilter/avcodec.c +++ b/libavfilter/avcodec.c @@ -50,6 +50,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) if(!dst->video->qp_table) return AVERROR(ENOMEM); dst->video->qp_table_linesize = src->qstride; + dst->video->qp_table_size = qsize; memcpy(dst->video->qp_table, src->qscale_table, qsize); } break; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 2e61ac5c02a7c3c8094c514bf63ca51c0bc0d1d3..4750cfdec96f162184631b894bac07608d22ab2d 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -132,6 +132,7 @@ typedef struct AVFilterBufferRefVideoProps { enum AVPictureType pict_type; ///< picture type of the frame int key_frame; ///< 1 -> keyframe, 0-> not int qp_table_linesize; ///< qp_table stride + int qp_table_size; ///< qp_table size int8_t *qp_table; ///< array of Quantization Parameters } AVFilterBufferRefVideoProps; diff --git a/libavfilter/buffer.c b/libavfilter/buffer.c index 470c6f148c9f94d1c3fc07393577c9756093c8f7..fc65b828259effab42ff7740cbf425741fc8f66a 100644 --- a/libavfilter/buffer.c +++ b/libavfilter/buffer.c @@ -42,7 +42,7 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) { *dst = *src; if (src->qp_table) { - int qsize = src->qp_table_linesize ? src->qp_table_linesize * ((src->h+15)/16) : (src->w+15)/16; + int qsize = src->qp_table_size; dst->qp_table = av_malloc(qsize); memcpy(dst->qp_table, src->qp_table, qsize); }