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

Side by Side Diff: patches/to_upstream/14_vp8_encode_options.patch

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month 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 diff -rpu -N orig/ffpresets/libvpx-1080p.ffpreset ffmpeg-mt/ffpresets/libvpx-108 0p.ffpreset 1 diff -wurp -N orig/ffpresets/libvpx-1080p.ffpreset ffmpeg-mt/ffpresets/libvpx-10 80p.ffpreset
2 --- orig/ffpresets/libvpx-1080p.ffpreset 1969-12-31 16:00:00 -0800 2 --- orig/ffpresets/libvpx-1080p.ffpreset 1969-12-31 16:00:00 -0800
3 +++ ffmpeg-mt/ffpresets/libvpx-1080p.ffpreset» 2010-10-11 16:55:58 -0700 3 +++ ffmpeg-mt/ffpresets/libvpx-1080p.ffpreset» 2010-11-04 08:10:04 -0700
4 @@ -0,0 +1,13 @@ 4 @@ -0,0 +1,13 @@
5 +vcodec=libvpx 5 +vcodec=libvpx
6 +g=120 6 +g=120
7 +rc_lookahead=16 7 +rc_lookahead=16
8 +level=216 8 +level=216
9 +profile=1 9 +profile=1
10 +qmax=51 10 +qmax=51
11 +qmin=11 11 +qmin=11
12 +token_partitions=4 12 +slices=4
13 +vb=2M 13 +vb=2M
14 + 14 +
15 +#ignored unless using -pass 2 15 +#ignored unless using -pass 2
16 +maxrate=24M 16 +maxrate=24M
17 +minrate=100k 17 +minrate=100k
18 diff -rpu -N orig/ffpresets/libvpx-1080p50_60.ffpreset ffmpeg-mt/ffpresets/libvp x-1080p50_60.ffpreset 18 diff -wurp -N orig/ffpresets/libvpx-1080p50_60.ffpreset ffmpeg-mt/ffpresets/libv px-1080p50_60.ffpreset
19 --- orig/ffpresets/libvpx-1080p50_60.ffpreset 1969-12-31 16:00:00 -0800 19 --- orig/ffpresets/libvpx-1080p50_60.ffpreset 1969-12-31 16:00:00 -0800
20 +++ ffmpeg-mt/ffpresets/libvpx-1080p50_60.ffpreset» 2010-10-11 16:55:58 -070 0 20 +++ ffmpeg-mt/ffpresets/libvpx-1080p50_60.ffpreset» 2010-11-04 08:10:04 -070 0
21 @@ -0,0 +1,13 @@ 21 @@ -0,0 +1,13 @@
22 +vcodec=libvpx 22 +vcodec=libvpx
23 +g=120 23 +g=120
24 +rc_lookahead=25 24 +rc_lookahead=25
25 +level=216 25 +level=216
26 +profile=1 26 +profile=1
27 +qmax=51 27 +qmax=51
28 +qmin=11 28 +qmin=11
29 +token_partitions=4 29 +slices=4
30 +vb=2M 30 +vb=2M
31 + 31 +
32 +#ignored unless using -pass 2 32 +#ignored unless using -pass 2
33 +maxrate=24M 33 +maxrate=24M
34 +minrate=100k 34 +minrate=100k
35 diff -rpu -N orig/ffpresets/libvpx-360p.ffpreset ffmpeg-mt/ffpresets/libvpx-360p .ffpreset 35 diff -wurp -N orig/ffpresets/libvpx-360p.ffpreset ffmpeg-mt/ffpresets/libvpx-360 p.ffpreset
36 --- orig/ffpresets/libvpx-360p.ffpreset 1969-12-31 16:00:00 -0800 36 --- orig/ffpresets/libvpx-360p.ffpreset 1969-12-31 16:00:00 -0800
37 +++ ffmpeg-mt/ffpresets/libvpx-360p.ffpreset» 2010-10-11 16:55:58 -0700 37 +++ ffmpeg-mt/ffpresets/libvpx-360p.ffpreset» 2010-11-04 08:10:04 -0700
38 @@ -0,0 +1,12 @@ 38 @@ -0,0 +1,12 @@
39 +vcodec=libvpx 39 +vcodec=libvpx
40 +g=120 40 +g=120
41 +rc_lookahead=16 41 +rc_lookahead=16
42 +level=216 42 +level=216
43 +profile=0 43 +profile=0
44 +qmax=63 44 +qmax=63
45 +qmin=0 45 +qmin=0
46 +vb=768k 46 +vb=768k
47 + 47 +
48 +#ignored unless using -pass 2 48 +#ignored unless using -pass 2
49 +maxrate=1.5M 49 +maxrate=1.5M
50 +minrate=40k 50 +minrate=40k
51 diff -rpu -N orig/ffpresets/libvpx-720p.ffpreset ffmpeg-mt/ffpresets/libvpx-720p .ffpreset 51 diff -wurp -N orig/ffpresets/libvpx-720p.ffpreset ffmpeg-mt/ffpresets/libvpx-720 p.ffpreset
52 --- orig/ffpresets/libvpx-720p.ffpreset 1969-12-31 16:00:00 -0800 52 --- orig/ffpresets/libvpx-720p.ffpreset 1969-12-31 16:00:00 -0800
53 +++ ffmpeg-mt/ffpresets/libvpx-720p.ffpreset» 2010-10-11 16:55:58 -0700 53 +++ ffmpeg-mt/ffpresets/libvpx-720p.ffpreset» 2010-11-04 08:10:04 -0700
54 @@ -0,0 +1,13 @@ 54 @@ -0,0 +1,13 @@
55 +vcodec=libvpx 55 +vcodec=libvpx
56 +g=120 56 +g=120
57 +rc_lookahead=16 57 +rc_lookahead=16
58 +level=216 58 +level=216
59 +profile=0 59 +profile=0
60 +qmax=51 60 +qmax=51
61 +qmin=11 61 +qmin=11
62 +token_partitions=4 62 +slices=4
63 +vb=2M 63 +vb=2M
64 + 64 +
65 +#ignored unless using -pass 2 65 +#ignored unless using -pass 2
66 +maxrate=24M 66 +maxrate=24M
67 +minrate=100k 67 +minrate=100k
68 diff -rpu -N orig/ffpresets/libvpx-720p50_60.ffpreset ffmpeg-mt/ffpresets/libvpx -720p50_60.ffpreset 68 diff -wurp -N orig/ffpresets/libvpx-720p50_60.ffpreset ffmpeg-mt/ffpresets/libvp x-720p50_60.ffpreset
69 --- orig/ffpresets/libvpx-720p50_60.ffpreset 1969-12-31 16:00:00 -0800 69 --- orig/ffpresets/libvpx-720p50_60.ffpreset 1969-12-31 16:00:00 -0800
70 +++ ffmpeg-mt/ffpresets/libvpx-720p50_60.ffpreset» 2010-10-11 16:55:58 -070 0 70 +++ ffmpeg-mt/ffpresets/libvpx-720p50_60.ffpreset» 2010-11-04 08:10:04 -070 0
71 @@ -0,0 +1,13 @@ 71 @@ -0,0 +1,13 @@
72 +vcodec=libvpx 72 +vcodec=libvpx
73 +g=120 73 +g=120
74 +rc_lookahead=25 74 +rc_lookahead=25
75 +level=216 75 +level=216
76 +profile=0 76 +profile=0
77 +qmax=51 77 +qmax=51
78 +qmin=11 78 +qmin=11
79 +token_partitions=4 79 +slices=4
80 +vb=2M 80 +vb=2M
81 + 81 +
82 +#ignored unless using -pass 2 82 +#ignored unless using -pass 2
83 +maxrate=24M 83 +maxrate=24M
84 +minrate=100k 84 +minrate=100k
85 diff -rpu -N orig/libavcodec/avcodec.h ffmpeg-mt/libavcodec/avcodec.h 85 diff -wurp -N orig/libavcodec/avcodec.h ffmpeg-mt/libavcodec/avcodec.h
86 --- orig/libavcodec/avcodec.h» 2010-10-11 16:55:52 -0700 86 --- orig/libavcodec/avcodec.h» 2010-11-04 08:09:58 -0700
87 +++ ffmpeg-mt/libavcodec/avcodec.h» 2010-10-11 16:55:58 -0700 87 +++ ffmpeg-mt/libavcodec/avcodec.h» 2010-11-04 08:10:04 -0700
88 @@ -652,6 +652,7 @@ typedef struct RcOverride{ 88 @@ -652,6 +652,7 @@ typedef struct RcOverride{
89 #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizatio ns. 89 #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizatio ns.
90 #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. 90 #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
91 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of int ra blocks instead of keyframes. 91 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of int ra blocks instead of keyframes.
92 +#define CODEC_FLAG2_ALT_REF 0x00400000 ///< Allow encoder to insert alter nate reference frames (VP8 only) 92 +#define CODEC_FLAG2_ALT_REF 0x00400000 ///< Allow encoder to insert alter nate reference frames (VP8 only)
93 93
94 /* Unsupported options : 94 /* Unsupported options :
95 * Syntax Arithmetic coding (SAC) 95 * Syntax Arithmetic coding (SAC)
96 @@ -2792,6 +2793,19 @@ typedef struct AVCodecContext { 96 @@ -2801,6 +2802,19 @@ typedef struct AVCodecContext {
97 * - decoding: Set by libavcodec. 97 * - decoding: Set by libavcodec.
98 */ 98 */
99 int active_thread_type; 99 int active_thread_type;
100 + 100 +
101 + /** 101 + /**
102 + * Number of token partitions. 102 + * Number of token partitions.
103 + * Indicates number of sub-streams in the bitstream. Used for parallelized 103 + * Indicates number of sub-streams in the bitstream. Used for parallelized
104 + * decoding. 104 + * decoding.
105 + * Valid values are 1, 2, 4 & 8 105 + * Valid values are 1, 2, 4 & 8
106 + * - encoding: Set by user. 106 + * - encoding: Set by user.
107 + * - decoding: unused 107 + * - decoding: unused
108 + * 108 + *
109 + * @attention VP8 specific 109 + * @attention VP8 specific
110 + */ 110 + */
111 + int token_partitions; 111 + int token_partitions;
112 + 112 +
113 } AVCodecContext; 113 } AVCodecContext;
114 114
115 /** 115 /**
116 diff -rpu -N orig/libavcodec/libvpxenc.c ffmpeg-mt/libavcodec/libvpxenc.c 116 diff -wurp -N orig/libavcodec/libvpxenc.c ffmpeg-mt/libavcodec/libvpxenc.c
117 --- orig/libavcodec/libvpxenc.c»2010-10-11 16:55:53 -0700 117 --- orig/libavcodec/libvpxenc.c»2010-11-04 08:09:59 -0700
118 +++ ffmpeg-mt/libavcodec/libvpxenc.c» 2010-10-11 16:55:58 -0700 118 +++ ffmpeg-mt/libavcodec/libvpxenc.c» 2010-11-04 08:10:04 -0700
119 @@ -218,11 +218,21 @@ static av_cold int vp8_init(AVCodecConte 119 @@ -218,11 +218,21 @@ static av_cold int vp8_init(AVCodecConte
120 } 120 }
121 dump_enc_cfg(avctx, &enccfg); 121 dump_enc_cfg(avctx, &enccfg);
122 122
123 + /* With altref set an additional frame at the same pts may be produced. 123 + /* With altref set an additional frame at the same pts may be produced.
124 + Increasing the time_base gives the library a window to place these frame s 124 + Increasing the time_base gives the library a window to place these frame s
125 + ensuring strictly increasing timestamps. */ 125 + ensuring strictly increasing timestamps. */
126 + if (avctx->flags2 & CODEC_FLAG2_ALT_REF) { 126 + if (avctx->flags2 & CODEC_FLAG2_ALT_REF) {
127 + avctx->ticks_per_frame = 2; 127 + avctx->ticks_per_frame = 2;
128 + avctx->time_base = av_mul_q(avctx->time_base, 128 + avctx->time_base = av_mul_q(avctx->time_base,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 + } 170 + }
171 + av_log(avctx, AV_LOG_DEBUG, "Using deadline: %lu\n", ctx->deadline); 171 + av_log(avctx, AV_LOG_DEBUG, "Using deadline: %lu\n", ctx->deadline);
172 + 172 +
173 + if (avctx->level != FF_LEVEL_UNKNOWN) { 173 + if (avctx->level != FF_LEVEL_UNKNOWN) {
174 + enccfg.g_error_resilient = avctx->level < 0; 174 + enccfg.g_error_resilient = avctx->level < 0;
175 + cpuused = FFABS(avctx->level) % 100 - 16; //[-16,16] 175 + cpuused = FFABS(avctx->level) % 100 - 16; //[-16,16]
176 + } 176 + }
177 177
178 dump_enc_cfg(avctx, &enccfg); 178 dump_enc_cfg(avctx, &enccfg);
179 /* Construct Encoder Context */ 179 /* Construct Encoder Context */
180 @@ -310,6 +338,8 @@ static av_cold int vp8_init(AVCodecConte 180 @@ -311,6 +339,7 @@ static av_cold int vp8_init(AVCodecConte
181 av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
182 codecctl_int(avctx, VP8E_SET_CPUUSED, cpuused); 181 codecctl_int(avctx, VP8E_SET_CPUUSED, cpuused);
183 codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction); 182 codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
183 codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices));
184 + codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, !!(avctx->flags2 & CODEC_FL AG2_ALT_REF)); 184 + codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, !!(avctx->flags2 & CODEC_FL AG2_ALT_REF));
185 + codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->token_partit ions));
186 185
187 //provide dummy value to initialize wrapper, values will be updated each _e ncode() 186 //provide dummy value to initialize wrapper, values will be updated each _e ncode()
188 vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1 , 187 vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1 ,
189 diff -rpu -N orig/libavcodec/options.c ffmpeg-mt/libavcodec/options.c 188 diff -wurp -N orig/libavcodec/options.c ffmpeg-mt/libavcodec/options.c
190 --- orig/libavcodec/options.c» 2010-10-11 16:55:54 -0700 189 --- orig/libavcodec/options.c» 2010-11-04 08:10:00 -0700
191 +++ ffmpeg-mt/libavcodec/options.c» 2010-10-11 16:55:58 -0700 190 +++ ffmpeg-mt/libavcodec/options.c» 2010-11-04 08:10:05 -0700
192 @@ -429,6 +429,8 @@ static const AVOption options[]={ 191 @@ -430,6 +430,8 @@ static const AVOption options[]={
193 {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_ INT, FF_THREAD_SLICE|FF_THREAD_FRAME, 0, INT_MAX, V|E|D, "thread_type"}, 192 {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_ INT, FF_THREAD_SLICE|FF_THREAD_FRAME, 0, INT_MAX, V|E|D, "thread_type"},
194 {"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"}, 193 {"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"},
195 {"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"}, 194 {"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"},
196 +{"altref", "enable use of alternate reference frames (VP8/2-pass only)", 0, FF_ OPT_TYPE_CONST, CODEC_FLAG2_ALT_REF, INT_MIN, INT_MAX, V|E, "flags2"}, 195 +{"altref", "enable use of alternate reference frames (VP8/2-pass only)", 0, FF_ OPT_TYPE_CONST, CODEC_FLAG2_ALT_REF, INT_MIN, INT_MAX, V|E, "flags2"},
197 +{"token_partitions", "Number of sub-streams in bitstream (1,2,4,8). Used for pa rallelized decoding.", OFFSET(token_partitions), FF_OPT_TYPE_INT, 1, 1, INT_MAX, V|E}, 196 +{"token_partitions", "Number of sub-streams in bitstream (1,2,4,8). Used for pa rallelized decoding.", OFFSET(token_partitions), FF_OPT_TYPE_INT, 1, 1, INT_MAX, V|E},
198 {NULL}, 197 {NULL},
199 }; 198 };
200 199
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698