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)
Unified · Split
| @@ -237,8 +237,7 @@ typedef struct Vp3DecodeContext { · 236 unmodified lines | ||
| 237 | 237 | * is coded. */ |
| 238 | 238 | unsigned char *macroblock_coding; |
| 239 | 239 | |
| 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; | |
| 242 | 241 | |
| 243 | 242 | /* Huffman decode */ |
| 244 | 243 | int hti; |
| @@ -325,8 +324,6 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi) · 80 unmodified lines | ||
| 325 | 324 | s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0]; |
| 326 | 325 | } |
| 327 | 326 | } |
| 328 | − | |
| 329 | − memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune | |
| 330 | 327 | } |
| 331 | 328 | |
| 332 | 329 | /* |
| @@ -1409,10 +1406,6 @@ static void render_slice(Vp3DecodeContext *s, int slice) · 1076 unmodified lines | ||
| 1409 | 1406 | if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY)) |
| 1410 | 1407 | continue; |
| 1411 | 1408 | |
| 1412 | − | |
| 1413 | − if(FFABS(stride) > 2048) | |
| 1414 | − return; //various tables are fixed size | |
| 1415 | − | |
| 1416 | 1409 | /* for each superblock row in the slice (both of them)... */ |
| 1417 | 1410 | for (; sb_y < slice_height; sb_y++) { |
| 1418 | 1411 | |
| @@ -1817,10 +1810,8 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext * · 398 unmodified lines | ||
| 1817 | 1810 | } |
| 1818 | 1811 | } |
| 1819 | 1812 | |
| 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]) | |
| 1822 | 1814 | memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array)); |
| 1823 | − } | |
| 1824 | 1815 | |
| 1825 | 1816 | if (qps_changed) |
| 1826 | 1817 | copy_fields(s, s1, qps, superblock_count); |
| @@ -1892,6 +1883,9 @@ static int vp3_decode_frame(AVCodecContext *avctx, · 65 unmodified lines | ||
| 1892 | 1883 | goto error; |
| 1893 | 1884 | } |
| 1894 | 1885 | |
| 1886 | + if (!s->edge_emu_buffer) | |
| 1887 | + s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); | |
| 1888 | + | |
| 1895 | 1889 | if (s->keyframe) { |
| 1896 | 1890 | if (!s->theora) |
| 1897 | 1891 | { |
| @@ -1925,9 +1919,6 @@ static int vp3_decode_frame(AVCodecContext *avctx, · 27 unmodified lines | ||
| 1925 | 1919 | } |
| 1926 | 1920 | } |
| 1927 | 1921 | |
| 1928 | − s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame | |
| 1929 | − s->current_frame.qstride= 0; | |
| 1930 | − | |
| 1931 | 1922 | memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); |
| 1932 | 1923 | ff_thread_finish_setup(avctx); |
| 1933 | 1924 | |
| @@ -2007,6 +1998,7 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) · 73 unmodified lines | ||
| 2007 | 1998 | av_free(s->macroblock_coding); |
| 2008 | 1999 | av_free(s->motion_val[0]); |
| 2009 | 2000 | av_free(s->motion_val[1]); |
| 2001 | + av_free(s->edge_emu_buffer); | |
| 2010 | 2002 | |
| 2011 | 2003 | if (avctx->is_copy) return 0; |
| 2012 | 2004 | |