History

lavfi: add qp_table_size

This avoid recalculating it and in case w/h changed avoids crashes.

Michael Niedermayer committed 14 years ago

Commit 91141f21 parent 5891e453 files · +3 −1Browse files

Unified · Split

3 files
  1. libavfilter/avcodec.c +1 −0
  2. libavfilter/avfilter.h +1 −0
  3. libavfilter/buffer.c +1 −1
libavfilter/avcodec.c+1−0
@@ -50,6 +50,7 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) · 49 unmodified lines
5050 if(!dst->video->qp_table)
5151 return AVERROR(ENOMEM);
5252 dst->video->qp_table_linesize = src->qstride;
53+ dst->video->qp_table_size = qsize;
5354 memcpy(dst->video->qp_table, src->qscale_table, qsize);
5455 }
5556 break;
libavfilter/avfilter.h+1−0
@@ -132,6 +132,7 @@ typedef struct AVFilterBufferRefVideoProps { · 131 unmodified lines
132132 enum AVPictureType pict_type; ///< picture type of the frame
133133 int key_frame; ///< 1 -> keyframe, 0-> not
134134 int qp_table_linesize; ///< qp_table stride
135+ int qp_table_size; ///< qp_table size
135136 int8_t *qp_table; ///< array of Quantization Parameters
136137 } AVFilterBufferRefVideoProps;
137138
libavfilter/buffer.c+1−1
@@ -42,7 +42,7 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) · 41 unmodified lines
4242 static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) {
4343 *dst = *src;
4444 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;
4646 dst->qp_table = av_malloc(qsize);
4747 memcpy(dst->qp_table, src->qp_table, qsize);
4848 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t