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

Unified Diff: source/libvpx/vp9/vp9_cx_iface.c

Issue 23530058: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/vp9_cx_iface.c
===================================================================
--- source/libvpx/vp9/vp9_cx_iface.c (revision 223100)
+++ source/libvpx/vp9/vp9_cx_iface.c (working copy)
@@ -89,6 +89,18 @@
unsigned int fixed_kf_cntr;
};
+static const VP9_REFFRAME ref_frame_to_vp9_reframe(vpx_ref_frame_type_t frame) {
+ switch (frame) {
+ case VP8_LAST_FRAME:
+ return VP9_LAST_FLAG;
+ case VP8_GOLD_FRAME:
+ return VP9_GOLD_FLAG;
+ case VP8_ALTR_FRAME:
+ return VP9_ALT_FLAG;
+ }
+ assert(!"Invalid Reference Frame");
+ return VP9_LAST_FLAG;
+}
static vpx_codec_err_t
update_error_state(vpx_codec_alg_priv_t *ctx,
@@ -148,7 +160,7 @@
RANGE_CHECK_HI(cfg, g_threads, 64);
RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS);
- RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_CQ);
+ RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q);
RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000);
RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000);
RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100);
@@ -160,6 +172,8 @@
RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100);
RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS);
+ RANGE_CHECK(cfg, ss_number_layers, 1,
+ VPX_SS_MAX_LAYERS); /*Spatial layers max */
/* VP8 does not support a lower bound on the keyframe interval in
* automatic keyframe placement mode.
*/
@@ -262,13 +276,15 @@
// VBR only supported for now.
// CBR code has been deprectated for experimental phase.
// CQ mode not yet tested
- oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK;
- /*if (cfg.rc_end_usage == VPX_CQ)
- oxcf->end_usage = USAGE_CONSTRAINED_QUALITY;
- else
- oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK;*/
+ oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK;
+ /*
+ if (cfg.rc_end_usage == VPX_CQ)
+ oxcf->end_usage = USAGE_CONSTRAINED_QUALITY;
+ */
+ if (cfg.rc_end_usage == VPX_Q)
+ oxcf->end_usage = USAGE_CONSTANT_QUALITY;
- oxcf->target_bandwidth = cfg.rc_target_bitrate;
+ oxcf->target_bandwidth = cfg.rc_target_bitrate;
oxcf->rc_max_intra_bitrate_pct = vp8_cfg.rc_max_intra_bitrate_pct;
oxcf->best_allowed_q = cfg.rc_min_quantizer;
@@ -317,6 +333,8 @@
oxcf->error_resilient_mode = cfg.g_error_resilient;
oxcf->frame_parallel_decoding_mode = vp8_cfg.frame_parallel_decoding_mode;
+
+ oxcf->ss_number_layers = cfg.ss_number_layers;
/*
printf("Current VP9 Settings: \n");
printf("target_bandwidth: %d\n", oxcf->target_bandwidth);
@@ -423,6 +441,8 @@
MAP(VP8E_SET_ARNR_TYPE, xcfg.arnr_type);
MAP(VP8E_SET_TUNING, xcfg.tuning);
MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level);
+ MAP(VP9E_SET_MAX_Q, ctx->cfg.rc_max_quantizer);
+ MAP(VP9E_SET_MIN_Q, ctx->cfg.rc_min_quantizer);
MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct);
MAP(VP9E_SET_LOSSLESS, xcfg.lossless);
MAP(VP9E_SET_FRAME_PARALLEL_DECODING, xcfg.frame_parallel_decoding_mode);
@@ -845,7 +865,8 @@
YV12_BUFFER_CONFIG sd;
image2yuvconfig(&frame->img, &sd);
- vp9_set_reference_enc(ctx->cpi, frame->frame_type, &sd);
+ vp9_set_reference_enc(ctx->cpi, ref_frame_to_vp9_reframe(frame->frame_type),
+ &sd);
return VPX_CODEC_OK;
} else
return VPX_CODEC_INVALID_PARAM;
@@ -863,7 +884,8 @@
YV12_BUFFER_CONFIG sd;
image2yuvconfig(&frame->img, &sd);
- vp9_copy_reference_enc(ctx->cpi, frame->frame_type, &sd);
+ vp9_copy_reference_enc(ctx->cpi,
+ ref_frame_to_vp9_reframe(frame->frame_type), &sd);
return VPX_CODEC_OK;
} else
return VPX_CODEC_INVALID_PARAM;
@@ -888,7 +910,7 @@
static vpx_codec_err_t vp9e_set_previewpp(vpx_codec_alg_priv_t *ctx,
int ctr_id,
va_list args) {
-#if CONFIG_POSTPROC
+#if CONFIG_VP9_POSTPROC
vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *);
(void)ctr_id;
@@ -1004,7 +1026,69 @@
return VPX_CODEC_INVALID_PARAM;
}
+static vpx_codec_err_t vp9e_set_width(vpx_codec_alg_priv_t *ctx, int ctr_id,
+ va_list args) {
+ unsigned int *data = va_arg(args, unsigned int *);
+ if (data) {
+ int res;
+ res = vp9_set_size_literal(ctx->cpi, *data, 0);
+ if (!res) {
+ return VPX_CODEC_OK;
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+}
+static vpx_codec_err_t vp9e_set_height(vpx_codec_alg_priv_t *ctx,
+ int ctr_id,
+ va_list args) {
+ unsigned int *data = va_arg(args, unsigned int *);
+
+ if (data) {
+ int res;
+ res = vp9_set_size_literal(ctx->cpi, 0, *data);
+
+ if (!res) {
+ return VPX_CODEC_OK;
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+}
+
+static vpx_codec_err_t vp9e_set_layer(vpx_codec_alg_priv_t *ctx,
+ int ctr_id,
+ va_list args) {
+ unsigned int *data = va_arg(args, unsigned int *);
+
+ if (data) {
+ int res;
+ res = 0;
+
+ res = vp9_switch_layer(ctx->cpi, *data);
+
+ if (!res) {
+ return VPX_CODEC_OK;
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+ } else {
+ return VPX_CODEC_INVALID_PARAM;
+ }
+}
+
+static vpx_codec_err_t vp9e_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id,
+ va_list args) {
+ int data = va_arg(args, int);
+ vp9_set_svc(ctx->cpi, data);
+ return VPX_CODEC_OK;
+}
+
static vpx_codec_ctrl_fn_map_t vp9e_ctf_maps[] = {
{VP8_SET_REFERENCE, vp9e_set_reference},
{VP8_COPY_REFERENCE, vp9e_copy_reference},
@@ -1029,10 +1113,16 @@
{VP8E_SET_ARNR_TYPE, set_param},
{VP8E_SET_TUNING, set_param},
{VP8E_SET_CQ_LEVEL, set_param},
+ {VP9E_SET_MAX_Q, set_param},
+ {VP9E_SET_MIN_Q, set_param},
{VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param},
{VP9E_SET_LOSSLESS, set_param},
{VP9E_SET_FRAME_PARALLEL_DECODING, set_param},
{VP9_GET_REFERENCE, get_reference},
+ {VP9E_SET_WIDTH, vp9e_set_width},
+ {VP9E_SET_HEIGHT, vp9e_set_height},
+ {VP9E_SET_LAYER, vp9e_set_layer},
+ {VP9E_SET_SVC, vp9e_set_svc},
{ -1, NULL},
};
@@ -1082,6 +1172,8 @@
0, /* kf_min_dist */
9999, /* kf_max_dist */
+ VPX_SS_DEFAULT_LAYERS, /* ss_number_layers */
+
#if VPX_ENCODER_ABI_VERSION == (1 + VPX_CODEC_ABI_VERSION)
1, /* g_delete_first_pass_file */
"vp8.fpf" /* first pass filename */
« 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