diff options
author | Yaowu Xu <yaowu@google.com> | 2015-02-25 15:39:09 -0800 |
---|---|---|
committer | Yaowu Xu <yaowu@google.com> | 2015-02-26 11:41:01 -0800 |
commit | 754bbcfdc80e15730b62a554baa7ac74af136066 (patch) | |
tree | 0d0c37837544602dc9d91878b1894fc45be26f7d | |
parent | 387bb8bed76eabe2f11877265e534fc2c9dc4256 (diff) | |
download | libvpx-754bbcfdc80e15730b62a554baa7ac74af136066.tar libvpx-754bbcfdc80e15730b62a554baa7ac74af136066.tar.gz libvpx-754bbcfdc80e15730b62a554baa7ac74af136066.tar.bz2 libvpx-754bbcfdc80e15730b62a554baa7ac74af136066.zip |
Fix the encoder to support profile change
Change-Id: Iefb928ad1174e274409facfb44f80265ff0f7683
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 17 | ||||
-rw-r--r-- | vp9/vp9_cx_iface.c | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 9147c29e5..17eb75a9e 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1963,11 +1963,13 @@ typedef struct { static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b, PSNR_STATS *psnr) { static const double peak = 255.0; - const int widths[3] = {a->y_width, a->uv_width, a->uv_width }; - const int heights[3] = {a->y_height, a->uv_height, a->uv_height}; - const uint8_t *a_planes[3] = {a->y_buffer, a->u_buffer, a->v_buffer }; + const int widths[3] = { + a->y_crop_width, a->uv_crop_width, a->uv_crop_width}; + const int heights[3] = { + a->y_crop_height, a->uv_crop_height, a->uv_crop_height}; + const uint8_t *a_planes[3] = {a->y_buffer, a->u_buffer, a->v_buffer}; const int a_strides[3] = {a->y_stride, a->uv_stride, a->uv_stride}; - const uint8_t *b_planes[3] = {b->y_buffer, b->u_buffer, b->v_buffer }; + const uint8_t *b_planes[3] = {b->y_buffer, b->u_buffer, b->v_buffer}; const int b_strides[3] = {b->y_stride, b->uv_stride, b->uv_stride}; int i; uint64_t total_sse = 0; @@ -3451,7 +3453,12 @@ static void check_initial_width(VP9_COMP *cpi, int subsampling_x, int subsampling_y) { VP9_COMMON *const cm = &cpi->common; - if (!cpi->initial_width) { + if (!cpi->initial_width || +#if CONFIG_VP9_HIGHBITDEPTH + cm->use_highbitdepth != use_highbitdepth || +#endif + cm->subsampling_x != subsampling_x || + cm->subsampling_y != subsampling_y) { cm->subsampling_x = subsampling_x; cm->subsampling_y = subsampling_y; #if CONFIG_VP9_HIGHBITDEPTH diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 8fd7b35e6..d0c4c6744 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -550,6 +550,8 @@ static vpx_codec_err_t encoder_set_config(vpx_codec_alg_priv_t *ctx, if (res == VPX_CODEC_OK) { ctx->cfg = *cfg; set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg); + // On profile change, request a key frame + force_key |= ctx->cpi->common.profile != ctx->oxcf.profile; vp9_change_config(ctx->cpi, &ctx->oxcf); } |