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

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

Issue 812033011: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: 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 | 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
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <string.h> 12 #include <string.h>
13 13
14 #include "./vpx_config.h" 14 #include "./vpx_config.h"
15 #include "vpx/vpx_codec.h" 15 #include "vpx/vpx_codec.h"
16 #include "vpx_ports/vpx_once.h"
16 #include "vpx/internal/vpx_codec_internal.h" 17 #include "vpx/internal/vpx_codec_internal.h"
17 #include "./vpx_version.h" 18 #include "./vpx_version.h"
18 #include "vp9/encoder/vp9_encoder.h" 19 #include "vp9/encoder/vp9_encoder.h"
19 #include "vpx/vp8cx.h" 20 #include "vpx/vp8cx.h"
20 #include "vp9/encoder/vp9_firstpass.h" 21 #include "vp9/encoder/vp9_firstpass.h"
21 #include "vp9/vp9_iface_common.h" 22 #include "vp9/vp9_iface_common.h"
22 23
23 struct vp9_extracfg { 24 struct vp9_extracfg {
24 int cpu_used; // available cpu percentage in 1/16 25 int cpu_used; // available cpu percentage in 1/16
25 unsigned int enable_auto_alt_ref; 26 unsigned int enable_auto_alt_ref;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 202
202 // VP9 does not support a lower bound on the keyframe interval in 203 // VP9 does not support a lower bound on the keyframe interval in
203 // automatic keyframe placement mode. 204 // automatic keyframe placement mode.
204 if (cfg->kf_mode != VPX_KF_DISABLED && 205 if (cfg->kf_mode != VPX_KF_DISABLED &&
205 cfg->kf_min_dist != cfg->kf_max_dist && 206 cfg->kf_min_dist != cfg->kf_max_dist &&
206 cfg->kf_min_dist > 0) 207 cfg->kf_min_dist > 0)
207 ERROR("kf_min_dist not supported in auto mode, use 0 " 208 ERROR("kf_min_dist not supported in auto mode, use 0 "
208 "or kf_max_dist instead."); 209 "or kf_max_dist instead.");
209 210
210 RANGE_CHECK(extra_cfg, enable_auto_alt_ref, 0, 2); 211 RANGE_CHECK(extra_cfg, enable_auto_alt_ref, 0, 2);
211 RANGE_CHECK(extra_cfg, cpu_used, -16, 16); 212 RANGE_CHECK(extra_cfg, cpu_used, -8, 8);
212 RANGE_CHECK_HI(extra_cfg, noise_sensitivity, 6); 213 RANGE_CHECK_HI(extra_cfg, noise_sensitivity, 6);
213 RANGE_CHECK(extra_cfg, tile_columns, 0, 6); 214 RANGE_CHECK(extra_cfg, tile_columns, 0, 6);
214 RANGE_CHECK(extra_cfg, tile_rows, 0, 2); 215 RANGE_CHECK(extra_cfg, tile_rows, 0, 2);
215 RANGE_CHECK_HI(extra_cfg, sharpness, 7); 216 RANGE_CHECK_HI(extra_cfg, sharpness, 7);
216 RANGE_CHECK(extra_cfg, arnr_max_frames, 0, 15); 217 RANGE_CHECK(extra_cfg, arnr_max_frames, 0, 15);
217 RANGE_CHECK_HI(extra_cfg, arnr_strength, 6); 218 RANGE_CHECK_HI(extra_cfg, arnr_strength, 6);
218 RANGE_CHECK(extra_cfg, cq_level, 0, 63); 219 RANGE_CHECK(extra_cfg, cq_level, 0, 63);
219 RANGE_CHECK(cfg, g_bit_depth, VPX_BITS_8, VPX_BITS_12); 220 RANGE_CHECK(cfg, g_bit_depth, VPX_BITS_8, VPX_BITS_12);
220 RANGE_CHECK(cfg, g_input_bit_depth, 8, 12); 221 RANGE_CHECK(cfg, g_input_bit_depth, 8, 12);
221 RANGE_CHECK(extra_cfg, content, 222 RANGE_CHECK(extra_cfg, content,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 349 }
349 return 0; 350 return 0;
350 } 351 }
351 352
352 static vpx_codec_err_t set_encoder_config( 353 static vpx_codec_err_t set_encoder_config(
353 VP9EncoderConfig *oxcf, 354 VP9EncoderConfig *oxcf,
354 const vpx_codec_enc_cfg_t *cfg, 355 const vpx_codec_enc_cfg_t *cfg,
355 const struct vp9_extracfg *extra_cfg) { 356 const struct vp9_extracfg *extra_cfg) {
356 const int is_vbr = cfg->rc_end_usage == VPX_VBR; 357 const int is_vbr = cfg->rc_end_usage == VPX_VBR;
357 oxcf->profile = cfg->g_profile; 358 oxcf->profile = cfg->g_profile;
359 oxcf->max_threads = (int)cfg->g_threads;
358 oxcf->width = cfg->g_w; 360 oxcf->width = cfg->g_w;
359 oxcf->height = cfg->g_h; 361 oxcf->height = cfg->g_h;
360 oxcf->bit_depth = cfg->g_bit_depth; 362 oxcf->bit_depth = cfg->g_bit_depth;
361 oxcf->input_bit_depth = cfg->g_input_bit_depth; 363 oxcf->input_bit_depth = cfg->g_input_bit_depth;
362 // guess a frame rate if out of whack, use 30 364 // guess a frame rate if out of whack, use 30
363 oxcf->init_framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num; 365 oxcf->init_framerate = (double)cfg->g_timebase.den / cfg->g_timebase.num;
364 if (oxcf->init_framerate > 180) 366 if (oxcf->init_framerate > 180)
365 oxcf->init_framerate = 30; 367 oxcf->init_framerate = 30;
366 368
367 oxcf->mode = GOOD; 369 oxcf->mode = GOOD;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 ctx->priv->init_flags = ctx->init_flags; 723 ctx->priv->init_flags = ctx->init_flags;
722 ctx->priv->enc.total_encoders = 1; 724 ctx->priv->enc.total_encoders = 1;
723 725
724 if (ctx->config.enc) { 726 if (ctx->config.enc) {
725 // Update the reference to the config structure to an internal copy. 727 // Update the reference to the config structure to an internal copy.
726 priv->cfg = *ctx->config.enc; 728 priv->cfg = *ctx->config.enc;
727 ctx->config.enc = &priv->cfg; 729 ctx->config.enc = &priv->cfg;
728 } 730 }
729 731
730 priv->extra_cfg = default_extra_cfg; 732 priv->extra_cfg = default_extra_cfg;
731 vp9_initialize_enc(); 733 once(vp9_initialize_enc);
732 734
733 res = validate_config(priv, &priv->cfg, &priv->extra_cfg); 735 res = validate_config(priv, &priv->cfg, &priv->extra_cfg);
734 736
735 if (res == VPX_CODEC_OK) { 737 if (res == VPX_CODEC_OK) {
736 set_encoder_config(&priv->oxcf, &priv->cfg, &priv->extra_cfg); 738 set_encoder_config(&priv->oxcf, &priv->cfg, &priv->extra_cfg);
737 #if CONFIG_VP9_HIGHBITDEPTH 739 #if CONFIG_VP9_HIGHBITDEPTH
738 priv->oxcf.use_highbitdepth = 740 priv->oxcf.use_highbitdepth =
739 (ctx->init_flags & VPX_CODEC_USE_HIGHBITDEPTH) ? 1 : 0; 741 (ctx->init_flags & VPX_CODEC_USE_HIGHBITDEPTH) ? 1 : 0;
740 #endif 742 #endif
741 priv->cpi = vp9_create_compressor(&priv->oxcf); 743 priv->cpi = vp9_create_compressor(&priv->oxcf);
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 1, // 1 cfg map 1459 1, // 1 cfg map
1458 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t 1460 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t
1459 encoder_encode, // vpx_codec_encode_fn_t 1461 encoder_encode, // vpx_codec_encode_fn_t
1460 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t 1462 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t
1461 encoder_set_config, // vpx_codec_enc_config_set_fn_t 1463 encoder_set_config, // vpx_codec_enc_config_set_fn_t
1462 NULL, // vpx_codec_get_global_headers_fn_t 1464 NULL, // vpx_codec_get_global_headers_fn_t
1463 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t 1465 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t
1464 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t 1466 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t
1465 } 1467 }
1466 }; 1468 };
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