Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/vp3.c

Issue 2850032: ffmpeg update to june 23 version which fixes mp4 crash on still frames with 3... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003-2004 the ffmpeg project 2 * Copyright (C) 2003-2004 the ffmpeg project
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 typedef struct Vp3DecodeContext { 127 typedef struct Vp3DecodeContext {
128 AVCodecContext *avctx; 128 AVCodecContext *avctx;
129 int theora, theora_tables; 129 int theora, theora_tables;
130 int version; 130 int version;
131 int width, height; 131 int width, height;
132 int chroma_x_shift, chroma_y_shift; 132 int chroma_x_shift, chroma_y_shift;
133 AVFrame golden_frame; 133 AVFrame golden_frame;
134 AVFrame last_frame; 134 AVFrame last_frame;
135 AVFrame current_frame; 135 AVFrame current_frame;
136 int keyframe; 136 int keyframe;
137 int flushed;
138 DSPContext dsp; 137 DSPContext dsp;
139 int flipped_image; 138 int flipped_image;
140 int last_slice_end; 139 int last_slice_end;
141 int skip_loop_filter; 140 int skip_loop_filter;
142 141
143 int qps[3]; 142 int qps[3];
144 int nqps; 143 int nqps;
145 int last_qps[3]; 144 int last_qps[3];
146 145
147 int superblock_count; 146 int superblock_count;
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 int y_fragment_count, c_fragment_count; 1601 int y_fragment_count, c_fragment_count;
1603 1602
1604 if (avctx->codec_tag == MKTAG('V','P','3','0')) 1603 if (avctx->codec_tag == MKTAG('V','P','3','0'))
1605 s->version = 0; 1604 s->version = 0;
1606 else 1605 else
1607 s->version = 1; 1606 s->version = 1;
1608 1607
1609 s->avctx = avctx; 1608 s->avctx = avctx;
1610 s->width = FFALIGN(avctx->width, 16); 1609 s->width = FFALIGN(avctx->width, 16);
1611 s->height = FFALIGN(avctx->height, 16); 1610 s->height = FFALIGN(avctx->height, 16);
1612 s->flushed = 0;
1613 if (avctx->pix_fmt == PIX_FMT_NONE) 1611 if (avctx->pix_fmt == PIX_FMT_NONE)
1614 avctx->pix_fmt = PIX_FMT_YUV420P; 1612 avctx->pix_fmt = PIX_FMT_YUV420P;
1615 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; 1613 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
1616 if(avctx->idct_algo==FF_IDCT_AUTO) 1614 if(avctx->idct_algo==FF_IDCT_AUTO)
1617 avctx->idct_algo=FF_IDCT_VP3; 1615 avctx->idct_algo=FF_IDCT_VP3;
1618 dsputil_init(&s->dsp, avctx); 1616 dsputil_init(&s->dsp, avctx);
1619 1617
1620 ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); 1618 ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
1621 1619
1622 /* initialize to an impossible value which will force a recalculation 1620 /* initialize to an impossible value which will force a recalculation
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 1884
1887 if (s->qps[0] != s->last_qps[0]) 1885 if (s->qps[0] != s->last_qps[0])
1888 init_loop_filter(s); 1886 init_loop_filter(s);
1889 1887
1890 for (i = 0; i < s->nqps; i++) 1888 for (i = 0; i < s->nqps; i++)
1891 // reinit all dequantizers if the first one changed, because 1889 // reinit all dequantizers if the first one changed, because
1892 // the DC of the first quantizer must be used for all matrices 1890 // the DC of the first quantizer must be used for all matrices
1893 if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0]) 1891 if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
1894 init_dequantizer(s, i); 1892 init_dequantizer(s, i);
1895 1893
1896 if (!s->keyframe && (avctx->skip_frame >= AVDISCARD_NONKEY || s->flushed)) 1894 if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
1897 return buf_size; 1895 return buf_size;
1898 1896
1899 s->current_frame.reference = 3; 1897 s->current_frame.reference = 3;
1900 s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE; 1898 s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
1901 if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { 1899 if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) {
1902 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); 1900 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
1903 goto error; 1901 goto error;
1904 } 1902 }
1905 1903
1906 if (s->keyframe) { 1904 if (s->keyframe) {
1907 s->flushed = 0;
1908 if (!s->theora) 1905 if (!s->theora)
1909 { 1906 {
1910 skip_bits(&gb, 4); /* width code */ 1907 skip_bits(&gb, 4); /* width code */
1911 skip_bits(&gb, 4); /* height code */ 1908 skip_bits(&gb, 4); /* height code */
1912 if (s->version) 1909 if (s->version)
1913 { 1910 {
1914 s->version = get_bits(&gb, 5); 1911 s->version = get_bits(&gb, 5);
1915 if (avctx->frame_number == 0) 1912 if (avctx->frame_number == 0)
1916 av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->versio n); 1913 av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->versio n);
1917 } 1914 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 if (s->golden_frame.data[0]) 2033 if (s->golden_frame.data[0])
2037 ff_thread_release_buffer(avctx, &s->golden_frame); 2034 ff_thread_release_buffer(avctx, &s->golden_frame);
2038 if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY) 2035 if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY)
2039 ff_thread_release_buffer(avctx, &s->last_frame); 2036 ff_thread_release_buffer(avctx, &s->last_frame);
2040 /* no need to release the current_frame since it will always be pointing 2037 /* no need to release the current_frame since it will always be pointing
2041 * to the same frame as either the golden or last frame */ 2038 * to the same frame as either the golden or last frame */
2042 2039
2043 return 0; 2040 return 0;
2044 } 2041 }
2045 2042
2046 static void vp3_decode_flush (AVCodecContext *avctx) {
2047 // FIXME: Actually flush data.
2048 Vp3DecodeContext *s = avctx->priv_data;
2049 s->flushed = 1;
2050 }
2051
2052 static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb) 2043 static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
2053 { 2044 {
2054 Vp3DecodeContext *s = avctx->priv_data; 2045 Vp3DecodeContext *s = avctx->priv_data;
2055 2046
2056 if (get_bits1(gb)) { 2047 if (get_bits1(gb)) {
2057 int token; 2048 int token;
2058 if (s->entries >= 32) { /* overflow */ 2049 if (s->entries >= 32) { /* overflow */
2059 av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n"); 2050 av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
2060 return -1; 2051 return -1;
2061 } 2052 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 "theora", 2339 "theora",
2349 AVMEDIA_TYPE_VIDEO, 2340 AVMEDIA_TYPE_VIDEO,
2350 CODEC_ID_THEORA, 2341 CODEC_ID_THEORA,
2351 sizeof(Vp3DecodeContext), 2342 sizeof(Vp3DecodeContext),
2352 theora_decode_init, 2343 theora_decode_init,
2353 NULL, 2344 NULL,
2354 vp3_decode_end, 2345 vp3_decode_end,
2355 vp3_decode_frame, 2346 vp3_decode_frame,
2356 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, 2347 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
2357 NULL, 2348 NULL,
2358 .flush = vp3_decode_flush,
2359 .long_name = NULL_IF_CONFIG_SMALL("Theora"), 2349 .long_name = NULL_IF_CONFIG_SMALL("Theora"),
2360 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) 2350 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
2361 }; 2351 };
2362 #endif 2352 #endif
2363 2353
2364 AVCodec vp3_decoder = { 2354 AVCodec vp3_decoder = {
2365 "vp3", 2355 "vp3",
2366 AVMEDIA_TYPE_VIDEO, 2356 AVMEDIA_TYPE_VIDEO,
2367 CODEC_ID_VP3, 2357 CODEC_ID_VP3,
2368 sizeof(Vp3DecodeContext), 2358 sizeof(Vp3DecodeContext),
2369 vp3_decode_init, 2359 vp3_decode_init,
2370 NULL, 2360 NULL,
2371 vp3_decode_end, 2361 vp3_decode_end,
2372 vp3_decode_frame, 2362 vp3_decode_frame,
2373 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS, 2363 CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
2374 NULL, 2364 NULL,
2375 .flush = vp3_decode_flush,
2376 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), 2365 .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
2377 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context) 2366 .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
2378 }; 2367 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavcodec/svq3.c ('k') | source/patched-ffmpeg-mt/libavfilter/vsrc_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698