History

VP3: fix decoding of videos with stride > 2048

Also remove qscale_table code; this didn't make sense anyways as VP3 doesn't use an MPEG-like quantizer scale. (cherry picked from commit 902685b8abf4e2089802528a32a50f3c68033fda)

Jason Garrett-Glaser committed 15 years ago

Commit d1472381 parent 5c20c811 file · +6 −14Browse files

Unified · Split

libavcodec/vp3.c+6−14
@@ -237,8 +237,7 @@ typedef struct Vp3DecodeContext { · 236 unmodified lines
237237 * is coded. */
238238 unsigned char *macroblock_coding;
239239
240− uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc
241− int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
240+ uint8_t *edge_emu_buffer;
242241
243242 /* Huffman decode */
244243 int hti;
@@ -325,8 +324,6 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi) · 80 unmodified lines
325324 s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0];
326325 }
327326 }
328−
329− memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune
330327 }
331328
332329 /*
@@ -1409,10 +1406,6 @@ static void render_slice(Vp3DecodeContext *s, int slice) · 1076 unmodified lines
14091406 if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY))
14101407 continue;
14111408
1412−
1413− if(FFABS(stride) > 2048)
1414− return; //various tables are fixed size
1415−
14161409 /* for each superblock row in the slice (both of them)... */
14171410 for (; sb_y < slice_height; sb_y++) {
14181411
@@ -1817,10 +1810,8 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext * · 398 unmodified lines
18171810 }
18181811 }
18191812
1820− if (s->qps[0] != s1->qps[0]) {
1821− memcpy(&s->qscale_table, &s1->qscale_table, sizeof(s->qscale_table));
1813+ if (s->qps[0] != s1->qps[0])
18221814 memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array));
1823− }
18241815
18251816 if (qps_changed)
18261817 copy_fields(s, s1, qps, superblock_count);
@@ -1892,6 +1883,9 @@ static int vp3_decode_frame(AVCodecContext *avctx, · 65 unmodified lines
18921883 goto error;
18931884 }
18941885
1886+ if (!s->edge_emu_buffer)
1887+ s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0]));
1888+
18951889 if (s->keyframe) {
18961890 if (!s->theora)
18971891 {
@@ -1925,9 +1919,6 @@ static int vp3_decode_frame(AVCodecContext *avctx, · 27 unmodified lines
19251919 }
19261920 }
19271921
1928− s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
1929− s->current_frame.qstride= 0;
1930−
19311922 memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
19321923 ff_thread_finish_setup(avctx);
19331924
@@ -2007,6 +1998,7 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) · 73 unmodified lines
20071998 av_free(s->macroblock_coding);
20081999 av_free(s->motion_val[0]);
20092000 av_free(s->motion_val[1]);
2001+ av_free(s->edge_emu_buffer);
20102002
20112003 if (avctx->is_copy) return 0;
20122004

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