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

Side by Side Diff: source/libvpx/vp9/vp9_cx_iface.c

Issue 668403002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 2 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
« no previous file with comments | « source/libvpx/vp9/vp9_common.mk ('k') | source/libvpx/vp9/vp9_dx_iface.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 if ((cfg->ss_number_layers > 1 || cfg->ts_number_layers > 1) && 182 if ((cfg->ss_number_layers > 1 || cfg->ts_number_layers > 1) &&
183 cfg->g_pass == VPX_RC_LAST_PASS) { 183 cfg->g_pass == VPX_RC_LAST_PASS) {
184 unsigned int i, alt_ref_sum = 0; 184 unsigned int i, alt_ref_sum = 0;
185 for (i = 0; i < cfg->ss_number_layers; ++i) { 185 for (i = 0; i < cfg->ss_number_layers; ++i) {
186 if (cfg->ss_enable_auto_alt_ref[i]) 186 if (cfg->ss_enable_auto_alt_ref[i])
187 ++alt_ref_sum; 187 ++alt_ref_sum;
188 } 188 }
189 if (alt_ref_sum > REF_FRAMES - cfg->ss_number_layers) 189 if (alt_ref_sum > REF_FRAMES - cfg->ss_number_layers)
190 ERROR("Not enough ref buffers for svc alt ref frames"); 190 ERROR("Not enough ref buffers for svc alt ref frames");
191 if ((cfg->ss_number_layers > 3 || 191 if (cfg->ss_number_layers * cfg->ts_number_layers > 3 &&
192 cfg->ss_number_layers * cfg->ts_number_layers > 4) &&
193 cfg->g_error_resilient == 0) 192 cfg->g_error_resilient == 0)
194 ERROR("Multiple frame context are not supported for more than 3 spatial " 193 ERROR("Multiple frame context are not supported for more than 3 layers");
195 "layers or more than 4 spatial x temporal layers");
196 } 194 }
197 #endif 195 #endif
198 196
199 // VP9 does not support a lower bound on the keyframe interval in 197 // VP9 does not support a lower bound on the keyframe interval in
200 // automatic keyframe placement mode. 198 // automatic keyframe placement mode.
201 if (cfg->kf_mode != VPX_KF_DISABLED && 199 if (cfg->kf_mode != VPX_KF_DISABLED &&
202 cfg->kf_min_dist != cfg->kf_max_dist && 200 cfg->kf_min_dist != cfg->kf_max_dist &&
203 cfg->kf_min_dist > 0) 201 cfg->kf_min_dist > 0)
204 ERROR("kf_min_dist not supported in auto mode, use 0 " 202 ERROR("kf_min_dist not supported in auto mode, use 0 "
205 "or kf_max_dist instead."); 203 "or kf_max_dist instead.");
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 265
268 stats = 266 stats =
269 (const FIRSTPASS_STATS *)cfg->rc_twopass_stats_in.buf + n_packets - 1; 267 (const FIRSTPASS_STATS *)cfg->rc_twopass_stats_in.buf + n_packets - 1;
270 268
271 if ((int)(stats->count + 0.5) != n_packets - 1) 269 if ((int)(stats->count + 0.5) != n_packets - 1)
272 ERROR("rc_twopass_stats_in missing EOS stats packet"); 270 ERROR("rc_twopass_stats_in missing EOS stats packet");
273 } 271 }
274 } 272 }
275 273
276 #if !CONFIG_VP9_HIGHBITDEPTH 274 #if !CONFIG_VP9_HIGHBITDEPTH
277 if (cfg->g_profile > (unsigned int)PROFILE_1) 275 if (cfg->g_profile > (unsigned int)PROFILE_1) {
278 ERROR("Profile > 1 not supported in this build configuration"); 276 ERROR("Profile > 1 not supported in this build configuration");
277 }
279 #endif 278 #endif
280 if (cfg->g_profile <= (unsigned int)PROFILE_1 && 279 if (cfg->g_profile <= (unsigned int)PROFILE_1 &&
281 extra_cfg->bit_depth > VPX_BITS_8) 280 cfg->g_bit_depth > VPX_BITS_8) {
282 ERROR("Codec high bit-depth not supported in profile < 2"); 281 ERROR("Codec high bit-depth not supported in profile < 2");
282 }
283 if (cfg->g_profile <= (unsigned int)PROFILE_1 &&
284 cfg->g_input_bit_depth > 8) {
285 ERROR("Source high bit-depth not supported in profile < 2");
286 }
283 if (cfg->g_profile > (unsigned int)PROFILE_1 && 287 if (cfg->g_profile > (unsigned int)PROFILE_1 &&
284 extra_cfg->bit_depth == VPX_BITS_8) 288 cfg->g_bit_depth == VPX_BITS_8) {
285 ERROR("Codec bit-depth 8 not supported in profile > 1"); 289 ERROR("Codec bit-depth 8 not supported in profile > 1");
290 }
286 291
287 return VPX_CODEC_OK; 292 return VPX_CODEC_OK;
288 } 293 }
289 294
290
291 static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx, 295 static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
292 const vpx_image_t *img) { 296 const vpx_image_t *img) {
293 switch (img->fmt) { 297 switch (img->fmt) {
294 case VPX_IMG_FMT_YV12: 298 case VPX_IMG_FMT_YV12:
295 case VPX_IMG_FMT_I420: 299 case VPX_IMG_FMT_I420:
300 case VPX_IMG_FMT_I42016:
301 break;
296 case VPX_IMG_FMT_I422: 302 case VPX_IMG_FMT_I422:
297 case VPX_IMG_FMT_I444: 303 case VPX_IMG_FMT_I444:
304 case VPX_IMG_FMT_I440:
305 if (ctx->cfg.g_profile != (unsigned int)PROFILE_1) {
306 ERROR("Invalid image format. I422, I444, I440 images are "
307 "not supported in profile.");
308 }
309 break;
310 case VPX_IMG_FMT_I42216:
311 case VPX_IMG_FMT_I44416:
312 case VPX_IMG_FMT_I44016:
313 if (ctx->cfg.g_profile != (unsigned int)PROFILE_1 &&
314 ctx->cfg.g_profile != (unsigned int)PROFILE_3) {
315 ERROR("Invalid image format. 16-bit I422, I444, I440 images are "
316 "not supported in profile.");
317 }
298 break; 318 break;
299 default: 319 default:
300 ERROR("Invalid image format. Only YV12, I420, I422, I444 images are " 320 ERROR("Invalid image format. Only YV12, I420, I422, I444 images are "
301 "supported."); 321 "supported.");
302 break; 322 break;
303 } 323 }
304 324
305 if (img->d_w != ctx->cfg.g_w || img->d_h != ctx->cfg.g_h) 325 if (img->d_w != ctx->cfg.g_w || img->d_h != ctx->cfg.g_h)
306 ERROR("Image size must match encoder init configuration size"); 326 ERROR("Image size must match encoder init configuration size");
307 327
308 return VPX_CODEC_OK; 328 return VPX_CODEC_OK;
309 } 329 }
310 330
311 static int get_image_bps(const vpx_image_t *img) { 331 static int get_image_bps(const vpx_image_t *img) {
312 switch (img->fmt) { 332 switch (img->fmt) {
313 case VPX_IMG_FMT_YV12: 333 case VPX_IMG_FMT_YV12:
314 case VPX_IMG_FMT_I420: return 12; 334 case VPX_IMG_FMT_I420: return 12;
315 case VPX_IMG_FMT_I422: return 16; 335 case VPX_IMG_FMT_I422: return 16;
316 case VPX_IMG_FMT_I444: return 24; 336 case VPX_IMG_FMT_I444: return 24;
337 case VPX_IMG_FMT_I440: return 16;
317 case VPX_IMG_FMT_I42016: return 24; 338 case VPX_IMG_FMT_I42016: return 24;
318 case VPX_IMG_FMT_I42216: return 32; 339 case VPX_IMG_FMT_I42216: return 32;
319 case VPX_IMG_FMT_I44416: return 48; 340 case VPX_IMG_FMT_I44416: return 48;
341 case VPX_IMG_FMT_I44016: return 32;
320 default: assert(0 && "Invalid image format"); break; 342 default: assert(0 && "Invalid image format"); break;
321 } 343 }
322 return 0; 344 return 0;
323 } 345 }
324 346
325 static vpx_codec_err_t set_encoder_config( 347 static vpx_codec_err_t set_encoder_config(
326 VP9EncoderConfig *oxcf, 348 VP9EncoderConfig *oxcf,
327 const vpx_codec_enc_cfg_t *cfg, 349 const vpx_codec_enc_cfg_t *cfg,
328 const struct vp9_extracfg *extra_cfg) { 350 const struct vp9_extracfg *extra_cfg) {
329 const int is_vbr = cfg->rc_end_usage == VPX_VBR; 351 const int is_vbr = cfg->rc_end_usage == VPX_VBR;
330 oxcf->profile = cfg->g_profile; 352 oxcf->profile = cfg->g_profile;
331 oxcf->width = cfg->g_w; 353 oxcf->width = cfg->g_w;
332 oxcf->height = cfg->g_h; 354 oxcf->height = cfg->g_h;
333 oxcf->bit_depth = extra_cfg->bit_depth; 355 oxcf->bit_depth = cfg->g_bit_depth;
334 oxcf->input_bit_depth = cfg->g_input_bit_depth; 356 oxcf->input_bit_depth = cfg->g_input_bit_depth;
335 // guess a frame rate if out of whack, use 30 357 // guess a frame rate if out of whack, use 30
336 oxcf->init_framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num; 358 oxcf->init_framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num;
337 if (oxcf->init_framerate > 180) 359 if (oxcf->init_framerate > 180)
338 oxcf->init_framerate = 30; 360 oxcf->init_framerate = 30;
339 361
340 oxcf->mode = GOOD; 362 oxcf->mode = GOOD;
341 363
342 switch (cfg->g_pass) { 364 switch (cfg->g_pass) {
343 case VPX_RC_ONE_PASS: 365 case VPX_RC_ONE_PASS:
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 1, // 1 cfg map 1375 1, // 1 cfg map
1354 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t 1376 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t
1355 encoder_encode, // vpx_codec_encode_fn_t 1377 encoder_encode, // vpx_codec_encode_fn_t
1356 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t 1378 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t
1357 encoder_set_config, // vpx_codec_enc_config_set_fn_t 1379 encoder_set_config, // vpx_codec_enc_config_set_fn_t
1358 NULL, // vpx_codec_get_global_headers_fn_t 1380 NULL, // vpx_codec_get_global_headers_fn_t
1359 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t 1381 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t
1360 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t 1382 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t
1361 } 1383 }
1362 }; 1384 };
OLDNEW
« no previous file with comments | « source/libvpx/vp9/vp9_common.mk ('k') | source/libvpx/vp9/vp9_dx_iface.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698