This avoid recalculating it and in case w/h changed avoids crashes.
Unified · Split
| @@ -50,6 +50,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) · 49 unmodified lines | |||
| 50 | if(!dst->video->qp_table) | 50 | if(!dst->video->qp_table) |
| 51 | return AVERROR(ENOMEM); | 51 | return AVERROR(ENOMEM); |
| 52 | dst->video->qp_table_linesize = src->qstride; | 52 | dst->video->qp_table_linesize = src->qstride; |
| 53 | dst->video->qp_table_size = qsize; | ||
| 53 | memcpy(dst->video->qp_table, src->qscale_table, qsize); | 54 | memcpy(dst->video->qp_table, src->qscale_table, qsize); |
| 54 | } | 55 | } |
| 55 | break; | 56 | break; |
| @@ -132,6 +132,7 @@ typedef struct AVFilterBufferRefVideoProps { · 131 unmodified lines | |||
| 132 | enum AVPictureType pict_type; ///< picture type of the frame | 132 | enum AVPictureType pict_type; ///< picture type of the frame |
| 133 | int key_frame; ///< 1 -> keyframe, 0-> not | 133 | int key_frame; ///< 1 -> keyframe, 0-> not |
| 134 | int qp_table_linesize; ///< qp_table stride | 134 | int qp_table_linesize; ///< qp_table stride |
| 135 | int qp_table_size; ///< qp_table size | ||
| 135 | int8_t *qp_table; ///< array of Quantization Parameters | 136 | int8_t *qp_table; ///< array of Quantization Parameters |
| 136 | } AVFilterBufferRefVideoProps; | 137 | } AVFilterBufferRefVideoProps; |
| 137 | 138 | ||
| @@ -42,7 +42,7 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) · 41 unmodified lines | |||
| 42 | static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) { | 42 | static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) { |
| 43 | *dst = *src; | 43 | *dst = *src; |
| 44 | if (src->qp_table) { | 44 | if (src->qp_table) { |
| 45 | int qsize = src->qp_table_linesize ? src->qp_table_linesize * ((src->h+15)/16) : (src->w+15)/16; | 45 | int qsize = src->qp_table_size; |
| 46 | dst->qp_table = av_malloc(qsize); | 46 | dst->qp_table = av_malloc(qsize); |
| 47 | memcpy(dst->qp_table, src->qp_table, qsize); | 47 | memcpy(dst->qp_table, src->qp_table, qsize); |
| 48 | } | 48 | } |