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

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

Issue 800493003: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Keep vp9_iht8x8_add_neon disabled because of http://llvm.org/bugs/show_bug.cgi?id=22178 Created 5 years, 11 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
« no previous file with comments | « source/libvpx/vp9/vp9_common.mk ('k') | source/libvpx/vp9/vp9_iface_common.h » ('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 24 matching lines...) Expand all
35 unsigned int cq_level; // constrained quality level 35 unsigned int cq_level; // constrained quality level
36 unsigned int rc_max_intra_bitrate_pct; 36 unsigned int rc_max_intra_bitrate_pct;
37 unsigned int rc_max_inter_bitrate_pct; 37 unsigned int rc_max_inter_bitrate_pct;
38 unsigned int gf_cbr_boost_pct; 38 unsigned int gf_cbr_boost_pct;
39 unsigned int lossless; 39 unsigned int lossless;
40 unsigned int frame_parallel_decoding_mode; 40 unsigned int frame_parallel_decoding_mode;
41 AQ_MODE aq_mode; 41 AQ_MODE aq_mode;
42 unsigned int frame_periodic_boost; 42 unsigned int frame_periodic_boost;
43 vpx_bit_depth_t bit_depth; 43 vpx_bit_depth_t bit_depth;
44 vp9e_tune_content content; 44 vp9e_tune_content content;
45 vpx_color_space_t color_space;
45 }; 46 };
46 47
47 static struct vp9_extracfg default_extra_cfg = { 48 static struct vp9_extracfg default_extra_cfg = {
48 0, // cpu_used 49 0, // cpu_used
49 1, // enable_auto_alt_ref 50 1, // enable_auto_alt_ref
50 0, // noise_sensitivity 51 0, // noise_sensitivity
51 0, // sharpness 52 0, // sharpness
52 0, // static_thresh 53 0, // static_thresh
53 0, // tile_columns 54 0, // tile_columns
54 0, // tile_rows 55 0, // tile_rows
55 7, // arnr_max_frames 56 7, // arnr_max_frames
56 5, // arnr_strength 57 5, // arnr_strength
57 VP8_TUNE_PSNR, // tuning 58 VP8_TUNE_PSNR, // tuning
58 10, // cq_level 59 10, // cq_level
59 0, // rc_max_intra_bitrate_pct 60 0, // rc_max_intra_bitrate_pct
60 0, // rc_max_inter_bitrate_pct 61 0, // rc_max_inter_bitrate_pct
61 0, // gf_cbr_boost_pct 62 0, // gf_cbr_boost_pct
62 0, // lossless 63 0, // lossless
63 0, // frame_parallel_decoding_mode 64 0, // frame_parallel_decoding_mode
64 NO_AQ, // aq_mode 65 NO_AQ, // aq_mode
65 0, // frame_periodic_delta_q 66 0, // frame_periodic_delta_q
66 VPX_BITS_8, // Bit depth 67 VPX_BITS_8, // Bit depth
67 VP9E_CONTENT_DEFAULT // content 68 VP9E_CONTENT_DEFAULT, // content
69 VPX_CS_UNKNOWN, // color space
68 }; 70 };
69 71
70 struct vpx_codec_alg_priv { 72 struct vpx_codec_alg_priv {
71 vpx_codec_priv_t base; 73 vpx_codec_priv_t base;
72 vpx_codec_enc_cfg_t cfg; 74 vpx_codec_enc_cfg_t cfg;
73 struct vp9_extracfg extra_cfg; 75 struct vp9_extracfg extra_cfg;
74 VP9EncoderConfig oxcf; 76 VP9EncoderConfig oxcf;
75 VP9_COMP *cpi; 77 VP9_COMP *cpi;
76 unsigned char *cx_data; 78 unsigned char *cx_data;
77 size_t cx_data_sz; 79 size_t cx_data_sz;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 ERROR("Codec high bit-depth not supported in profile < 2"); 289 ERROR("Codec high bit-depth not supported in profile < 2");
288 } 290 }
289 if (cfg->g_profile <= (unsigned int)PROFILE_1 && 291 if (cfg->g_profile <= (unsigned int)PROFILE_1 &&
290 cfg->g_input_bit_depth > 8) { 292 cfg->g_input_bit_depth > 8) {
291 ERROR("Source high bit-depth not supported in profile < 2"); 293 ERROR("Source high bit-depth not supported in profile < 2");
292 } 294 }
293 if (cfg->g_profile > (unsigned int)PROFILE_1 && 295 if (cfg->g_profile > (unsigned int)PROFILE_1 &&
294 cfg->g_bit_depth == VPX_BITS_8) { 296 cfg->g_bit_depth == VPX_BITS_8) {
295 ERROR("Codec bit-depth 8 not supported in profile > 1"); 297 ERROR("Codec bit-depth 8 not supported in profile > 1");
296 } 298 }
297 299 RANGE_CHECK(extra_cfg, color_space, VPX_CS_UNKNOWN, VPX_CS_SRGB);
298 return VPX_CODEC_OK; 300 return VPX_CODEC_OK;
299 } 301 }
300 302
301 static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx, 303 static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
302 const vpx_image_t *img) { 304 const vpx_image_t *img) {
303 switch (img->fmt) { 305 switch (img->fmt) {
304 case VPX_IMG_FMT_YV12: 306 case VPX_IMG_FMT_YV12:
305 case VPX_IMG_FMT_I420: 307 case VPX_IMG_FMT_I420:
306 case VPX_IMG_FMT_I42016: 308 case VPX_IMG_FMT_I42016:
307 break; 309 break;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 case VPX_IMG_FMT_I42016: return 24; 346 case VPX_IMG_FMT_I42016: return 24;
345 case VPX_IMG_FMT_I42216: return 32; 347 case VPX_IMG_FMT_I42216: return 32;
346 case VPX_IMG_FMT_I44416: return 48; 348 case VPX_IMG_FMT_I44416: return 48;
347 case VPX_IMG_FMT_I44016: return 32; 349 case VPX_IMG_FMT_I44016: return 32;
348 default: assert(0 && "Invalid image format"); break; 350 default: assert(0 && "Invalid image format"); break;
349 } 351 }
350 return 0; 352 return 0;
351 } 353 }
352 354
353 static vpx_codec_err_t set_encoder_config( 355 static vpx_codec_err_t set_encoder_config(
354 VP9EncoderConfig *oxcf, 356 VP9EncoderConfig *oxcf,
355 const vpx_codec_enc_cfg_t *cfg, 357 const vpx_codec_enc_cfg_t *cfg,
356 const struct vp9_extracfg *extra_cfg) { 358 const struct vp9_extracfg *extra_cfg) {
357 const int is_vbr = cfg->rc_end_usage == VPX_VBR; 359 const int is_vbr = cfg->rc_end_usage == VPX_VBR;
358 oxcf->profile = cfg->g_profile; 360 oxcf->profile = cfg->g_profile;
359 oxcf->max_threads = (int)cfg->g_threads; 361 oxcf->max_threads = (int)cfg->g_threads;
360 oxcf->width = cfg->g_w; 362 oxcf->width = cfg->g_w;
361 oxcf->height = cfg->g_h; 363 oxcf->height = cfg->g_h;
362 oxcf->bit_depth = cfg->g_bit_depth; 364 oxcf->bit_depth = cfg->g_bit_depth;
363 oxcf->input_bit_depth = cfg->g_input_bit_depth; 365 oxcf->input_bit_depth = cfg->g_input_bit_depth;
364 // guess a frame rate if out of whack, use 30 366 // guess a frame rate if out of whack, use 30
365 oxcf->init_framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num; 367 oxcf->init_framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num;
366 if (oxcf->init_framerate > 180) 368 if (oxcf->init_framerate > 180)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 oxcf->enable_auto_arf = extra_cfg->enable_auto_alt_ref; 432 oxcf->enable_auto_arf = extra_cfg->enable_auto_alt_ref;
431 oxcf->noise_sensitivity = extra_cfg->noise_sensitivity; 433 oxcf->noise_sensitivity = extra_cfg->noise_sensitivity;
432 oxcf->sharpness = extra_cfg->sharpness; 434 oxcf->sharpness = extra_cfg->sharpness;
433 435
434 oxcf->two_pass_stats_in = cfg->rc_twopass_stats_in; 436 oxcf->two_pass_stats_in = cfg->rc_twopass_stats_in;
435 437
436 #if CONFIG_FP_MB_STATS 438 #if CONFIG_FP_MB_STATS
437 oxcf->firstpass_mb_stats_in = cfg->rc_firstpass_mb_stats_in; 439 oxcf->firstpass_mb_stats_in = cfg->rc_firstpass_mb_stats_in;
438 #endif 440 #endif
439 441
442 oxcf->color_space = extra_cfg->color_space;
440 oxcf->arnr_max_frames = extra_cfg->arnr_max_frames; 443 oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
441 oxcf->arnr_strength = extra_cfg->arnr_strength; 444 oxcf->arnr_strength = extra_cfg->arnr_strength;
442 445
443 oxcf->tuning = extra_cfg->tuning; 446 oxcf->tuning = extra_cfg->tuning;
444 oxcf->content = extra_cfg->content; 447 oxcf->content = extra_cfg->content;
445 448
446 oxcf->tile_columns = extra_cfg->tile_columns; 449 oxcf->tile_columns = extra_cfg->tile_columns;
447 oxcf->tile_rows = extra_cfg->tile_rows; 450 oxcf->tile_rows = extra_cfg->tile_rows;
448 451
449 oxcf->error_resilient_mode = cfg->g_error_resilient; 452 oxcf->error_resilient_mode = cfg->g_error_resilient;
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 return VPX_CODEC_OK; 1318 return VPX_CODEC_OK;
1316 } 1319 }
1317 1320
1318 static vpx_codec_err_t ctrl_set_tune_content(vpx_codec_alg_priv_t *ctx, 1321 static vpx_codec_err_t ctrl_set_tune_content(vpx_codec_alg_priv_t *ctx,
1319 va_list args) { 1322 va_list args) {
1320 struct vp9_extracfg extra_cfg = ctx->extra_cfg; 1323 struct vp9_extracfg extra_cfg = ctx->extra_cfg;
1321 extra_cfg.content = CAST(VP9E_SET_TUNE_CONTENT, args); 1324 extra_cfg.content = CAST(VP9E_SET_TUNE_CONTENT, args);
1322 return update_extra_cfg(ctx, &extra_cfg); 1325 return update_extra_cfg(ctx, &extra_cfg);
1323 } 1326 }
1324 1327
1328 static vpx_codec_err_t ctrl_set_color_space(vpx_codec_alg_priv_t *ctx,
1329 va_list args) {
1330 struct vp9_extracfg extra_cfg = ctx->extra_cfg;
1331 extra_cfg.color_space = CAST(VP9E_SET_COLOR_SPACE, args);
1332 return update_extra_cfg(ctx, &extra_cfg);
1333 }
1334
1325 static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { 1335 static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
1326 {VP8_COPY_REFERENCE, ctrl_copy_reference}, 1336 {VP8_COPY_REFERENCE, ctrl_copy_reference},
1327 {VP8E_UPD_ENTROPY, ctrl_update_entropy}, 1337 {VP8E_UPD_ENTROPY, ctrl_update_entropy},
1328 {VP8E_UPD_REFERENCE, ctrl_update_reference}, 1338 {VP8E_UPD_REFERENCE, ctrl_update_reference},
1329 {VP8E_USE_REFERENCE, ctrl_use_reference}, 1339 {VP8E_USE_REFERENCE, ctrl_use_reference},
1330 1340
1331 // Setters 1341 // Setters
1332 {VP8_SET_REFERENCE, ctrl_set_reference}, 1342 {VP8_SET_REFERENCE, ctrl_set_reference},
1333 {VP8_SET_POSTPROC, ctrl_set_previewpp}, 1343 {VP8_SET_POSTPROC, ctrl_set_previewpp},
1334 {VP8E_SET_ROI_MAP, ctrl_set_roi_map}, 1344 {VP8E_SET_ROI_MAP, ctrl_set_roi_map},
(...skipping 15 matching lines...) Expand all
1350 {VP8E_SET_GF_CBR_BOOST_PCT, ctrl_set_rc_gf_cbr_boost_pct}, 1360 {VP8E_SET_GF_CBR_BOOST_PCT, ctrl_set_rc_gf_cbr_boost_pct},
1351 {VP9E_SET_LOSSLESS, ctrl_set_lossless}, 1361 {VP9E_SET_LOSSLESS, ctrl_set_lossless},
1352 {VP9E_SET_FRAME_PARALLEL_DECODING, ctrl_set_frame_parallel_decoding_mode}, 1362 {VP9E_SET_FRAME_PARALLEL_DECODING, ctrl_set_frame_parallel_decoding_mode},
1353 {VP9E_SET_AQ_MODE, ctrl_set_aq_mode}, 1363 {VP9E_SET_AQ_MODE, ctrl_set_aq_mode},
1354 {VP9E_SET_FRAME_PERIODIC_BOOST, ctrl_set_frame_periodic_boost}, 1364 {VP9E_SET_FRAME_PERIODIC_BOOST, ctrl_set_frame_periodic_boost},
1355 {VP9E_SET_SVC, ctrl_set_svc}, 1365 {VP9E_SET_SVC, ctrl_set_svc},
1356 {VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters}, 1366 {VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters},
1357 {VP9E_REGISTER_CX_CALLBACK, ctrl_register_cx_callback}, 1367 {VP9E_REGISTER_CX_CALLBACK, ctrl_register_cx_callback},
1358 {VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id}, 1368 {VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id},
1359 {VP9E_SET_TUNE_CONTENT, ctrl_set_tune_content}, 1369 {VP9E_SET_TUNE_CONTENT, ctrl_set_tune_content},
1370 {VP9E_SET_COLOR_SPACE, ctrl_set_color_space},
1360 {VP9E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity}, 1371 {VP9E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity},
1361 1372
1362 // Getters 1373 // Getters
1363 {VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer}, 1374 {VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer},
1364 {VP8E_GET_LAST_QUANTIZER_64, ctrl_get_quantizer64}, 1375 {VP8E_GET_LAST_QUANTIZER_64, ctrl_get_quantizer64},
1365 {VP9_GET_REFERENCE, ctrl_get_reference}, 1376 {VP9_GET_REFERENCE, ctrl_get_reference},
1366 {VP9E_GET_SVC_LAYER_ID, ctrl_get_svc_layer_id}, 1377 {VP9E_GET_SVC_LAYER_ID, ctrl_get_svc_layer_id},
1367 1378
1368 { -1, NULL}, 1379 { -1, NULL},
1369 }; 1380 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 1, // 1 cfg map 1470 1, // 1 cfg map
1460 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t 1471 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t
1461 encoder_encode, // vpx_codec_encode_fn_t 1472 encoder_encode, // vpx_codec_encode_fn_t
1462 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t 1473 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t
1463 encoder_set_config, // vpx_codec_enc_config_set_fn_t 1474 encoder_set_config, // vpx_codec_enc_config_set_fn_t
1464 NULL, // vpx_codec_get_global_headers_fn_t 1475 NULL, // vpx_codec_get_global_headers_fn_t
1465 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t 1476 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t
1466 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t 1477 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t
1467 } 1478 }
1468 }; 1479 };
OLDNEW
« no previous file with comments | « source/libvpx/vp9/vp9_common.mk ('k') | source/libvpx/vp9/vp9_iface_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698