Merge "build/make/iosbuild.sh: Remove jobs argument."
diff --git a/test/encode_test_driver.h b/test/encode_test_driver.h
index 9ecc498..6d0a72f 100644
--- a/test/encode_test_driver.h
+++ b/test/encode_test_driver.h
@@ -124,6 +124,11 @@
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
}
+ void Control(int ctrl_id, int *arg) {
+ const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
+ ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
+ }
+
void Control(int ctrl_id, struct vpx_scaling_mode *arg) {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
diff --git a/test/test.mk b/test/test.mk
index fde9703..bb5186b 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -168,7 +168,7 @@
TEST_INTRA_PRED_SPEED_SRCS-$(CONFIG_VP9) += ../md5_utils.h ../md5_utils.c
## VP10
-LIBVPX_TEST_SRCS-$(CONFIG_VP10) += vp10_dct_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP10_ENCODER) += vp10_dct_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP10) += vp10_inv_txfm_test.cc
endif # CONFIG_SHARED
diff --git a/test/vp10_dct_test.cc b/test/vp10_dct_test.cc
index 8fb5f4f..b2c301a 100644
--- a/test/vp10_dct_test.cc
+++ b/test/vp10_dct_test.cc
@@ -17,7 +17,10 @@
#include "test/util.h"
#include "./vpx_config.h"
#include "vpx_ports/msvc.h"
-#include "vp10/encoder/dct.h"
+
+#undef CONFIG_COEFFICIENT_RANGE_CHECKING
+#define CONFIG_COEFFICIENT_RANGE_CHECKING 1
+#include "vp10/encoder/dct.c"
using libvpx_test::ACMRandom;
@@ -102,8 +105,7 @@
INSTANTIATE_TEST_CASE_P(
C, Vp10FwdTxfm,
::testing::Values(
- FdctParam(&vp10_fdct4, &reference_dct_1d, 4, 1),
- FdctParam(&vp10_fdct8, &reference_dct_1d, 8, 1),
- FdctParam(&vp10_fdct16, &reference_dct_1d, 16, 2),
- FdctParam(&vp10_fdct32_local, &reference_dct_1d, 32, 4)));
+ FdctParam(&fdct4, &reference_dct_1d, 4, 1),
+ FdctParam(&fdct8, &reference_dct_1d, 8, 1),
+ FdctParam(&fdct16, &reference_dct_1d, 16, 2)));
} // namespace
diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc
index 901605d..0984e6a 100644
--- a/test/vp9_encoder_parms_get_to_decoder.cc
+++ b/test/vp9_encoder_parms_get_to_decoder.cc
@@ -42,6 +42,7 @@
int32_t frame_parallel;
int32_t color_range;
vpx_color_space_t cs;
+ int render_size[2];
// TODO(JBB): quantizers / bitrate
};
@@ -49,7 +50,7 @@
{0, 0, 0, 1, 0, 0, VPX_CS_BT_601},
{0, 0, 0, 0, 0, 1, VPX_CS_BT_709},
{0, 0, 1, 0, 0, 1, VPX_CS_BT_2020},
- {0, 2, 0, 0, 1, 0, VPX_CS_UNKNOWN},
+ {0, 2, 0, 0, 1, 0, VPX_CS_UNKNOWN, { 640, 480 }},
// TODO(JBB): Test profiles (requires more work).
};
@@ -88,6 +89,8 @@
encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
encoder->Control(VP8E_SET_ARNR_STRENGTH, 5);
encoder->Control(VP8E_SET_ARNR_TYPE, 3);
+ if (encode_parms.render_size[0] > 0 && encode_parms.render_size[1] > 0)
+ encoder->Control(VP9E_SET_RENDER_SIZE, encode_parms.render_size);
}
}
@@ -118,6 +121,10 @@
}
EXPECT_EQ(encode_parms.color_range, common->color_range);
EXPECT_EQ(encode_parms.cs, common->color_space);
+ if (encode_parms.render_size[0] > 0 && encode_parms.render_size[1] > 0) {
+ EXPECT_EQ(encode_parms.render_size[0], common->render_width);
+ EXPECT_EQ(encode_parms.render_size[1], common->render_height);
+ }
EXPECT_EQ(encode_parms.tile_cols, common->log2_tile_cols);
EXPECT_EQ(encode_parms.tile_rows, common->log2_tile_rows);
diff --git a/vp10/common/idct.c b/vp10/common/idct.c
index 144afc3..5ee15c8 100644
--- a/vp10/common/idct.c
+++ b/vp10/common/idct.c
@@ -179,21 +179,24 @@
}
void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
- int stride, int eob, TX_TYPE tx_type,
- void (*itxm_add_4x4)(const tran_low_t *input,
- uint8_t *dest, int stride, int eob)) {
- switch (tx_type) {
- case DCT_DCT:
- itxm_add_4x4(input, dest, stride, eob);
- break;
- case ADST_DCT:
- case DCT_ADST:
- case ADST_ADST:
- vp10_iht4x4_16_add(input, dest, stride, tx_type);
- break;
- default:
- assert(0);
- break;
+ int stride, int eob, TX_TYPE tx_type, int lossless) {
+ if (lossless) {
+ assert(tx_type == DCT_DCT);
+ vp10_iwht4x4_add(input, dest, stride, eob);
+ } else {
+ switch (tx_type) {
+ case DCT_DCT:
+ vp10_idct4x4_add(input, dest, stride, eob);
+ break;
+ case ADST_DCT:
+ case DCT_ADST:
+ case ADST_ADST:
+ vp10_iht4x4_16_add(input, dest, stride, tx_type);
+ break;
+ default:
+ assert(0);
+ break;
+ }
}
}
@@ -418,21 +421,24 @@
void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type,
- void (*highbd_itxm_add_4x4)
- (const tran_low_t *input, uint8_t *dest,
- int stride, int eob, int bd)) {
- switch (tx_type) {
- case DCT_DCT:
- highbd_itxm_add_4x4(input, dest, stride, eob, bd);
- break;
- case ADST_DCT:
- case DCT_ADST:
- case ADST_ADST:
- vp10_highbd_iht4x4_16_add(input, dest, stride, tx_type, bd);
- break;
- default:
- assert(0);
- break;
+ int lossless) {
+ if (lossless) {
+ assert(tx_type == DCT_DCT);
+ vp10_highbd_iwht4x4_add(input, dest, stride, eob, bd);
+ } else {
+ switch (tx_type) {
+ case DCT_DCT:
+ vp10_highbd_idct4x4_add(input, dest, stride, eob, bd);
+ break;
+ case ADST_DCT:
+ case DCT_ADST:
+ case ADST_ADST:
+ vp10_highbd_iht4x4_16_add(input, dest, stride, tx_type, bd);
+ break;
+ default:
+ assert(0);
+ break;
+ }
}
}
diff --git a/vp10/common/idct.h b/vp10/common/idct.h
index 2e00052..0883398 100644
--- a/vp10/common/idct.h
+++ b/vp10/common/idct.h
@@ -44,9 +44,7 @@
int eob);
void vp10_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
- int stride, int eob, TX_TYPE tx_type,
- void (*itxm_add_4x4)(const tran_low_t *input,
- uint8_t *dest, int stride, int eob));
+ int stride, int eob, TX_TYPE tx_type, int lossless);
void vp10_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, TX_TYPE tx_type);
void vp10_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
@@ -67,9 +65,7 @@
int stride, int eob, int bd);
void vp10_highbd_inv_txfm_add_4x4(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type,
- void (*highbd_itxm_add_4x4)
- (const tran_low_t *input, uint8_t *dest,
- int stride, int eob, int bd));
+ int lossless);
void vp10_highbd_inv_txfm_add_8x8(const tran_low_t *input, uint8_t *dest,
int stride, int eob, int bd, TX_TYPE tx_type);
void vp10_highbd_inv_txfm_add_16x16(const tran_low_t *input, uint8_t *dest,
diff --git a/vp10/common/loopfilter.c b/vp10/common/loopfilter.c
index 1b89ed5..a1925de 100644
--- a/vp10/common/loopfilter.c
+++ b/vp10/common/loopfilter.c
@@ -719,7 +719,11 @@
uint64_t *const int_4x4_y = &lfm->int_4x4_y;
uint16_t *const left_uv = &lfm->left_uv[tx_size_uv];
uint16_t *const above_uv = &lfm->above_uv[tx_size_uv];
+#if CONFIG_MISC_FIXES
+ uint16_t *const int_4x4_uv = &lfm->left_int_4x4_uv;
+#else
uint16_t *const int_4x4_uv = &lfm->int_4x4_uv;
+#endif
int i;
// If filter level is 0 we don't loop filter.
@@ -1015,7 +1019,11 @@
lfm->above_uv[i] &= mask_uv;
}
lfm->int_4x4_y &= mask_y;
+#if CONFIG_MISC_FIXES
+ lfm->above_int_4x4_uv = lfm->left_int_4x4_uv & mask_uv;
+#else
lfm->int_4x4_uv &= mask_uv;
+#endif
// We don't apply a wide loop filter on the last uv block row. If set
// apply the shorter one instead.
@@ -1049,7 +1057,11 @@
lfm->above_uv[i] &= mask_uv;
}
lfm->int_4x4_y &= mask_y;
+#if CONFIG_MISC_FIXES
+ lfm->left_int_4x4_uv &= mask_uv_int;
+#else
lfm->int_4x4_uv &= mask_uv_int;
+#endif
// We don't apply a wide loop filter on the last uv column. If set
// apply the shorter one instead.
@@ -1079,7 +1091,11 @@
assert(!(lfm->left_uv[TX_16X16]&lfm->left_uv[TX_8X8]));
assert(!(lfm->left_uv[TX_16X16] & lfm->left_uv[TX_4X4]));
assert(!(lfm->left_uv[TX_8X8] & lfm->left_uv[TX_4X4]));
+#if CONFIG_MISC_FIXES
+ assert(!(lfm->left_int_4x4_uv & lfm->left_uv[TX_16X16]));
+#else
assert(!(lfm->int_4x4_uv & lfm->left_uv[TX_16X16]));
+#endif
assert(!(lfm->above_y[TX_16X16] & lfm->above_y[TX_8X8]));
assert(!(lfm->above_y[TX_16X16] & lfm->above_y[TX_4X4]));
assert(!(lfm->above_y[TX_8X8] & lfm->above_y[TX_4X4]));
@@ -1087,7 +1103,11 @@
assert(!(lfm->above_uv[TX_16X16] & lfm->above_uv[TX_8X8]));
assert(!(lfm->above_uv[TX_16X16] & lfm->above_uv[TX_4X4]));
assert(!(lfm->above_uv[TX_8X8] & lfm->above_uv[TX_4X4]));
+#if CONFIG_MISC_FIXES
+ assert(!(lfm->above_int_4x4_uv & lfm->above_uv[TX_16X16]));
+#else
assert(!(lfm->int_4x4_uv & lfm->above_uv[TX_16X16]));
+#endif
}
static void filter_selectively_vert(uint8_t *s, int pitch,
@@ -1442,7 +1462,11 @@
uint16_t mask_16x16 = lfm->left_uv[TX_16X16];
uint16_t mask_8x8 = lfm->left_uv[TX_8X8];
uint16_t mask_4x4 = lfm->left_uv[TX_4X4];
+#if CONFIG_MISC_FIXES
+ uint16_t mask_4x4_int = lfm->left_int_4x4_uv;
+#else
uint16_t mask_4x4_int = lfm->int_4x4_uv;
+#endif
assert(plane->subsampling_x == 1 && plane->subsampling_y == 1);
@@ -1494,7 +1518,11 @@
mask_16x16 = lfm->above_uv[TX_16X16];
mask_8x8 = lfm->above_uv[TX_8X8];
mask_4x4 = lfm->above_uv[TX_4X4];
+#if CONFIG_MISC_FIXES
+ mask_4x4_int = lfm->above_int_4x4_uv;
+#else
mask_4x4_int = lfm->int_4x4_uv;
+#endif
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
diff --git a/vp10/common/loopfilter.h b/vp10/common/loopfilter.h
index 329ab75..8db705a 100644
--- a/vp10/common/loopfilter.h
+++ b/vp10/common/loopfilter.h
@@ -80,7 +80,12 @@
uint64_t int_4x4_y;
uint16_t left_uv[TX_SIZES];
uint16_t above_uv[TX_SIZES];
+#if CONFIG_MISC_FIXES
+ uint16_t left_int_4x4_uv;
+ uint16_t above_int_4x4_uv;
+#else
uint16_t int_4x4_uv;
+#endif
uint8_t lfl_y[64];
uint8_t lfl_uv[16];
} LOOP_FILTER_MASK;
diff --git a/vp10/common/onyxc_int.h b/vp10/common/onyxc_int.h
index eeaadc6..c345068 100644
--- a/vp10/common/onyxc_int.h
+++ b/vp10/common/onyxc_int.h
@@ -132,8 +132,8 @@
int color_range;
int width;
int height;
- int display_width;
- int display_height;
+ int render_width;
+ int render_height;
int last_width;
int last_height;
diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c
index 50d50f8..91096a2 100644
--- a/vp10/decoder/decodeframe.c
+++ b/vp10/decoder/decodeframe.c
@@ -124,6 +124,18 @@
vp10_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
}
+#if CONFIG_MISC_FIXES
+static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
+ struct vpx_read_bit_buffer *rb) {
+ if (is_compound_reference_allowed(cm)) {
+ return vpx_rb_read_bit(rb) ? REFERENCE_MODE_SELECT
+ : (vpx_rb_read_bit(rb) ? COMPOUND_REFERENCE
+ : SINGLE_REFERENCE);
+ } else {
+ return SINGLE_REFERENCE;
+ }
+}
+#else
static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
vpx_reader *r) {
if (is_compound_reference_allowed(cm)) {
@@ -134,6 +146,7 @@
return SINGLE_REFERENCE;
}
}
+#endif
static void read_frame_reference_mode_probs(VP10_COMMON *cm, vpx_reader *r) {
FRAME_CONTEXT *const fc = cm->fc;
@@ -203,9 +216,7 @@
switch (tx_size) {
case TX_4X4:
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd,
- tx_type, xd->lossless ?
- vp10_highbd_iwht4x4_add :
- vp10_highbd_idct4x4_add);
+ tx_type, xd->lossless);
break;
case TX_8X8:
vp10_highbd_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, xd->bd,
@@ -228,8 +239,7 @@
switch (tx_size) {
case TX_4X4:
vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type,
- xd->lossless ? vp10_iwht4x4_add :
- vp10_idct4x4_add);
+ xd->lossless);
break;
case TX_8X8:
vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type);
@@ -274,9 +284,7 @@
switch (tx_size) {
case TX_4X4:
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, xd->bd,
- tx_type, xd->lossless ?
- vp10_highbd_iwht4x4_add :
- vp10_highbd_idct4x4_add);
+ tx_type, xd->lossless);
break;
case TX_8X8:
vp10_highbd_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, xd->bd,
@@ -299,8 +307,7 @@
switch (tx_size) {
case TX_4X4:
vp10_inv_txfm_add_4x4(dqcoeff, dst, stride, eob, tx_type,
- xd->lossless ? vp10_iwht4x4_add :
- vp10_idct4x4_add);
+ xd->lossless);
break;
case TX_8X8:
vp10_inv_txfm_add_8x8(dqcoeff, dst, stride, eob, tx_type);
@@ -1169,12 +1176,12 @@
return vpx_rb_read_bit(rb) ? SWITCHABLE : vpx_rb_read_literal(rb, 2);
}
-static void setup_display_size(VP10_COMMON *cm,
- struct vpx_read_bit_buffer *rb) {
- cm->display_width = cm->width;
- cm->display_height = cm->height;
+static void setup_render_size(VP10_COMMON *cm,
+ struct vpx_read_bit_buffer *rb) {
+ cm->render_width = cm->width;
+ cm->render_height = cm->height;
if (vpx_rb_read_bit(rb))
- vp10_read_frame_size(rb, &cm->display_width, &cm->display_height);
+ vp10_read_frame_size(rb, &cm->render_width, &cm->render_height);
}
static void resize_mv_buffer(VP10_COMMON *cm) {
@@ -1222,7 +1229,7 @@
BufferPool *const pool = cm->buffer_pool;
vp10_read_frame_size(rb, &width, &height);
resize_context_buffers(cm, width, height);
- setup_display_size(cm, rb);
+ setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
@@ -1246,6 +1253,8 @@
pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
pool->frame_bufs[cm->new_fb_idx].buf.color_space = cm->color_space;
pool->frame_bufs[cm->new_fb_idx].buf.color_range = cm->color_range;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_width = cm->render_width;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_height = cm->render_height;
}
static INLINE int valid_ref_frame_img_fmt(vpx_bit_depth_t ref_bit_depth,
@@ -1304,7 +1313,7 @@
}
resize_context_buffers(cm, width, height);
- setup_display_size(cm, rb);
+ setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
@@ -1328,6 +1337,8 @@
pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
pool->frame_bufs[cm->new_fb_idx].buf.color_space = cm->color_space;
pool->frame_bufs[cm->new_fb_idx].buf.color_range = cm->color_range;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_width = cm->render_width;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_height = cm->render_height;
}
static void setup_tile_info(VP10_COMMON *cm, struct vpx_read_bit_buffer *rb) {
@@ -1968,6 +1979,8 @@
#endif
get_frame_new_buffer(cm)->color_space = cm->color_space;
get_frame_new_buffer(cm)->color_range = cm->color_range;
+ get_frame_new_buffer(cm)->render_width = cm->render_width;
+ get_frame_new_buffer(cm)->render_height = cm->render_height;
if (pbi->need_resync) {
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
@@ -2029,6 +2042,7 @@
setup_segmentation_dequant(cm);
#if CONFIG_MISC_FIXES
cm->tx_mode = xd->lossless ? ONLY_4X4 : read_tx_mode(rb);
+ cm->reference_mode = read_frame_reference_mode(cm, rb);
#endif
setup_tile_info(cm, rb);
@@ -2078,7 +2092,9 @@
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp10_diff_update_prob(&r, &fc->intra_inter_prob[i]);
+#if !CONFIG_MISC_FIXES
cm->reference_mode = read_frame_reference_mode(cm, &r);
+#endif
if (cm->reference_mode != SINGLE_REFERENCE)
setup_compound_reference_mode(cm);
read_frame_reference_mode_probs(cm, &r);
diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c
index da51599..348c7cb 100644
--- a/vp10/encoder/bitstream.c
+++ b/vp10/encoder/bitstream.c
@@ -982,14 +982,14 @@
return total_size;
}
-static void write_display_size(const VP10_COMMON *cm,
- struct vpx_write_bit_buffer *wb) {
- const int scaling_active = cm->width != cm->display_width ||
- cm->height != cm->display_height;
+static void write_render_size(const VP10_COMMON *cm,
+ struct vpx_write_bit_buffer *wb) {
+ const int scaling_active = cm->width != cm->render_width ||
+ cm->height != cm->render_height;
vpx_wb_write_bit(wb, scaling_active);
if (scaling_active) {
- vpx_wb_write_literal(wb, cm->display_width - 1, 16);
- vpx_wb_write_literal(wb, cm->display_height - 1, 16);
+ vpx_wb_write_literal(wb, cm->render_width - 1, 16);
+ vpx_wb_write_literal(wb, cm->render_height - 1, 16);
}
}
@@ -998,7 +998,7 @@
vpx_wb_write_literal(wb, cm->width - 1, 16);
vpx_wb_write_literal(wb, cm->height - 1, 16);
- write_display_size(cm, wb);
+ write_render_size(cm, wb);
}
static void write_frame_size_with_refs(VP10_COMP *cpi,
@@ -1025,7 +1025,7 @@
vpx_wb_write_literal(wb, cm->height - 1, 16);
}
- write_display_size(cm, wb);
+ write_render_size(cm, wb);
}
static void write_sync_code(struct vpx_write_bit_buffer *wb) {
@@ -1169,6 +1169,14 @@
cm->tx_mode = TX_4X4;
else
write_txfm_mode(cm->tx_mode, wb);
+ if (cpi->allow_comp_inter_inter) {
+ const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
+ const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
+
+ vpx_wb_write_bit(wb, use_hybrid_pred);
+ if (!use_hybrid_pred)
+ vpx_wb_write_bit(wb, use_compound_pred);
+ }
#endif
write_tile_info(cm, wb);
@@ -1208,8 +1216,9 @@
counts->intra_inter[i]);
if (cpi->allow_comp_inter_inter) {
- const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
+#if !CONFIG_MISC_FIXES
+ const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
vpx_write_bit(&header_bc, use_compound_pred);
if (use_compound_pred) {
@@ -1219,6 +1228,12 @@
vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
counts->comp_inter[i]);
}
+#else
+ if (use_hybrid_pred)
+ for (i = 0; i < COMP_INTER_CONTEXTS; i++)
+ vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
+ counts->comp_inter[i]);
+#endif
}
if (cm->reference_mode != COMPOUND_REFERENCE) {
diff --git a/vp10/encoder/block.h b/vp10/encoder/block.h
index 9eff31a..cb2a234 100644
--- a/vp10/encoder/block.h
+++ b/vp10/encoder/block.h
@@ -132,13 +132,6 @@
// Strong color activity detection. Used in RTC coding mode to enhance
// the visual quality at the boundary of moving color objects.
uint8_t color_sensitivity[2];
-
- void (*fwd_txm4x4)(const int16_t *input, tran_low_t *output, int stride);
- void (*itxm_add)(const tran_low_t *input, uint8_t *dest, int stride, int eob);
-#if CONFIG_VP9_HIGHBITDEPTH
- void (*highbd_itxm_add)(const tran_low_t *input, uint8_t *dest, int stride,
- int eob, int bd);
-#endif
};
#ifdef __cplusplus
diff --git a/vp10/encoder/dct.c b/vp10/encoder/dct.c
index 78f151e..c61babe 100644
--- a/vp10/encoder/dct.c
+++ b/vp10/encoder/dct.c
@@ -34,7 +34,7 @@
#endif
}
-void vp10_fdct4(const tran_low_t *input, tran_low_t *output) {
+static void fdct4(const tran_low_t *input, tran_low_t *output) {
tran_high_t temp;
tran_low_t step[4];
@@ -70,7 +70,7 @@
range_check(output, 4, 13);
}
-void vp10_fdct8(const tran_low_t *input, tran_low_t *output) {
+static void fdct8(const tran_low_t *input, tran_low_t *output) {
tran_high_t temp;
tran_low_t step[8];
@@ -148,7 +148,7 @@
range_check(output, 8, 14);
}
-void vp10_fdct16(const tran_low_t *input, tran_low_t *output) {
+static void fdct16(const tran_low_t *input, tran_low_t *output) {
tran_high_t temp;
tran_low_t step[16];
@@ -322,8 +322,8 @@
range_check(output, 16, 16);
}
-// TODO(angiebird): Unify this with vp10_fwd_txfm.c: vp10_fdct32
-void vp10_fdct32_local(const tran_low_t *input, tran_low_t *output) {
+/* #TODO(angiebird): Unify this with vp10_fwd_txfm.c: vp10_fdct32
+static void fdct32(const tran_low_t *input, tran_low_t *output) {
tran_high_t temp;
tran_low_t step[32];
@@ -720,6 +720,7 @@
range_check(output, 32, 18);
}
+*/
static void fadst4(const tran_low_t *input, tran_low_t *output) {
tran_high_t x0, x1, x2, x3;
@@ -996,24 +997,24 @@
}
static const transform_2d FHT_4[] = {
- { vp10_fdct4, vp10_fdct4 }, // DCT_DCT = 0
- { fadst4, vp10_fdct4 }, // ADST_DCT = 1
- { vp10_fdct4, fadst4 }, // DCT_ADST = 2
- { fadst4, fadst4 } // ADST_ADST = 3
+ { fdct4, fdct4 }, // DCT_DCT = 0
+ { fadst4, fdct4 }, // ADST_DCT = 1
+ { fdct4, fadst4 }, // DCT_ADST = 2
+ { fadst4, fadst4 } // ADST_ADST = 3
};
static const transform_2d FHT_8[] = {
- { vp10_fdct8, vp10_fdct8 }, // DCT_DCT = 0
- { fadst8, vp10_fdct8 }, // ADST_DCT = 1
- { vp10_fdct8, fadst8 }, // DCT_ADST = 2
- { fadst8, fadst8 } // ADST_ADST = 3
+ { fdct8, fdct8 }, // DCT_DCT = 0
+ { fadst8, fdct8 }, // ADST_DCT = 1
+ { fdct8, fadst8 }, // DCT_ADST = 2
+ { fadst8, fadst8 } // ADST_ADST = 3
};
static const transform_2d FHT_16[] = {
- { vp10_fdct16, vp10_fdct16 }, // DCT_DCT = 0
- { fadst16, vp10_fdct16 }, // ADST_DCT = 1
- { vp10_fdct16, fadst16 }, // DCT_ADST = 2
- { fadst16, fadst16 } // ADST_ADST = 3
+ { fdct16, fdct16 }, // DCT_DCT = 0
+ { fadst16, fdct16 }, // ADST_DCT = 1
+ { fdct16, fadst16 }, // DCT_ADST = 2
+ { fadst16, fadst16 } // ADST_ADST = 3
};
void vp10_fht4x4_c(const int16_t *input, tran_low_t *output,
@@ -1124,7 +1125,7 @@
// Rows
for (i = 0; i < 8; ++i) {
- vp10_fdct8(&intermediate[i * 8], &coeff_ptr[i * 8]);
+ fdct8(&intermediate[i * 8], &coeff_ptr[i * 8]);
for (j = 0; j < 8; ++j)
coeff_ptr[j + i * 8] /= 2;
}
diff --git a/vp10/encoder/dct.h b/vp10/encoder/dct.h
deleted file mode 100644
index ab0db93..0000000
--- a/vp10/encoder/dct.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef VP10_ENCODER_DCT_H_
-#define VP10_ENCODER_DCT_H_
-
-#include "vpx_dsp/vpx_dsp_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void vp10_fdct4(const tran_low_t *input, tran_low_t *output);
-void vp10_fdct8(const tran_low_t *input, tran_low_t *output);
-void vp10_fdct16(const tran_low_t *input, tran_low_t *output);
-void vp10_fdct32_local(const tran_low_t *input, tran_low_t *output);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // VP10_ENCODER_DCT_H_
diff --git a/vp10/encoder/encodeframe.c b/vp10/encoder/encodeframe.c
index c3b6265..019e5b1 100644
--- a/vp10/encoder/encodeframe.c
+++ b/vp10/encoder/encodeframe.c
@@ -2696,18 +2696,6 @@
cm->uv_dc_delta_q == 0 &&
cm->uv_ac_delta_q == 0;
-#if CONFIG_VP9_HIGHBITDEPTH
- if (cm->use_highbitdepth)
- x->fwd_txm4x4 = xd->lossless ? vp10_highbd_fwht4x4 : vpx_highbd_fdct4x4;
- else
- x->fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
- x->highbd_itxm_add = xd->lossless ? vp10_highbd_iwht4x4_add :
- vp10_highbd_idct4x4_add;
-#else
- x->fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
-#endif // CONFIG_VP9_HIGHBITDEPTH
- x->itxm_add = xd->lossless ? vp10_iwht4x4_add : vp10_idct4x4_add;
-
if (xd->lossless)
x->optimize = 0;
diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c
index 65692dd..3307720 100644
--- a/vp10/encoder/encodemb.c
+++ b/vp10/encoder/encodemb.c
@@ -367,7 +367,11 @@
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
+ if (xd->lossless) {
+ vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
+ } else {
+ vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
+ }
vp10_highbd_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
@@ -403,7 +407,11 @@
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
+ if (xd->lossless) {
+ vp10_fwht4x4(src_diff, coeff, diff_stride);
+ } else {
+ vpx_fdct4x4(src_diff, coeff, diff_stride);
+ }
vp10_quantize_fp(coeff, 16, x->skip_block, p->zbin, p->round_fp,
p->quant_fp, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
@@ -453,7 +461,11 @@
pd->dequant[0], eob);
break;
case TX_4X4:
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
+ if (xd->lossless) {
+ vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
+ } else {
+ vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
+ }
vpx_highbd_quantize_dc(coeff, 16, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
@@ -485,7 +497,11 @@
pd->dequant[0], eob);
break;
case TX_4X4:
- x->fwd_txm4x4(src_diff, coeff, diff_stride);
+ if (xd->lossless) {
+ vp10_fwht4x4(src_diff, coeff, diff_stride);
+ } else {
+ vpx_fdct4x4(src_diff, coeff, diff_stride);
+ }
vpx_quantize_dc(coeff, 16, x->skip_block, p->round,
p->quant_fp[0], qcoeff, dqcoeff,
pd->dequant[0], eob);
@@ -496,22 +512,24 @@
}
}
-void vp10_fwd_txfm_4x4(const int16_t *src_diff,
- tran_low_t *coeff, int diff_stride, TX_TYPE tx_type,
- void (*fwd_txm4x4)(const int16_t *input,
- tran_low_t *output, int stride)) {
- switch (tx_type) {
- case DCT_DCT:
- fwd_txm4x4(src_diff, coeff, diff_stride);
- break;
- case ADST_DCT:
- case DCT_ADST:
- case ADST_ADST:
- vp10_fht4x4(src_diff, coeff, diff_stride, tx_type);
- break;
- default:
- assert(0);
- break;
+void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
+ int diff_stride, TX_TYPE tx_type, int lossless) {
+ if (lossless) {
+ vp10_fwht4x4(src_diff, coeff, diff_stride);
+ } else {
+ switch (tx_type) {
+ case DCT_DCT:
+ vpx_fdct4x4(src_diff, coeff, diff_stride);
+ break;
+ case ADST_DCT:
+ case DCT_ADST:
+ case ADST_ADST:
+ vp10_fht4x4(src_diff, coeff, diff_stride, tx_type);
+ break;
+ default:
+ assert(0);
+ break;
+ }
}
}
@@ -565,21 +583,24 @@
#if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
- int diff_stride, TX_TYPE tx_type,
- void (*highbd_fwd_txm4x4)(const int16_t *input,
- tran_low_t *output, int stride)) {
- switch (tx_type) {
- case DCT_DCT:
- highbd_fwd_txm4x4(src_diff, coeff, diff_stride);
- break;
- case ADST_DCT:
- case DCT_ADST:
- case ADST_ADST:
- vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
- break;
- default:
- assert(0);
- break;
+ int diff_stride, TX_TYPE tx_type, int lossless) {
+ if (lossless) {
+ assert(tx_type == DCT_DCT);
+ vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
+ } else {
+ switch (tx_type) {
+ case DCT_DCT:
+ vpx_highbd_fdct4x4(src_diff, coeff, diff_stride);
+ break;
+ case ADST_DCT:
+ case DCT_ADST:
+ case ADST_ADST:
+ vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
+ break;
+ default:
+ assert(0);
+ break;
+ }
}
}
@@ -681,7 +702,7 @@
break;
case TX_4X4:
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
- x->fwd_txm4x4);
+ xd->lossless);
vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
@@ -717,7 +738,7 @@
scan_order->scan, scan_order->iscan);
break;
case TX_4X4:
- vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, x->fwd_txm4x4);
+ vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, xd->lossless);
vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
@@ -820,7 +841,7 @@
// case.
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, pd->dst.stride,
p->eobs[block], xd->bd, tx_type,
- x->highbd_itxm_add);
+ xd->lossless);
break;
default:
assert(0 && "Invalid transform size");
@@ -849,7 +870,7 @@
// which is significant (not just an optimization) for the lossless
// case.
vp10_inv_txfm_add_4x4(dqcoeff, dst, pd->dst.stride, p->eobs[block],
- tx_type, x->itxm_add);
+ tx_type, xd->lossless);
break;
default:
assert(0 && "Invalid transform size");
@@ -874,11 +895,21 @@
if (p->eobs[block] > 0) {
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- x->highbd_itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block], xd->bd);
- return;
+ if (xd->lossless) {
+ vp10_highbd_iwht4x4_add(dqcoeff, dst, pd->dst.stride,
+ p->eobs[block], xd->bd);
+ } else {
+ vp10_highbd_idct4x4_add(dqcoeff, dst, pd->dst.stride,
+ p->eobs[block], xd->bd);
+ }
+ return;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
- x->itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
+ if (xd->lossless) {
+ vp10_iwht4x4_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
+ } else {
+ vp10_idct4x4_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]);
+ }
}
}
@@ -999,7 +1030,7 @@
vpx_highbd_subtract_block(4, 4, src_diff, diff_stride,
src, src_stride, dst, dst_stride, xd->bd);
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
- x->fwd_txm4x4);
+ xd->lossless);
vpx_highbd_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob,
@@ -1011,7 +1042,7 @@
// eob<=1 which is significant (not just an optimization) for the
// lossless case.
vp10_highbd_inv_txfm_add_4x4(dqcoeff, dst, dst_stride, *eob, xd->bd,
- tx_type, x->highbd_itxm_add);
+ tx_type, xd->lossless);
break;
default:
assert(0);
@@ -1068,7 +1099,7 @@
if (!x->skip_recode) {
vpx_subtract_block(4, 4, src_diff, diff_stride,
src, src_stride, dst, dst_stride);
- vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, x->fwd_txm4x4);
+ vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, xd->lossless);
vpx_quantize_b(coeff, 16, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff,
pd->dequant, eob, scan_order->scan,
@@ -1080,7 +1111,7 @@
// which is significant (not just an optimization) for the lossless
// case.
vp10_inv_txfm_add_4x4(dqcoeff, dst, dst_stride, *eob, tx_type,
- x->itxm_add);
+ xd->lossless);
}
break;
default:
diff --git a/vp10/encoder/encodemb.h b/vp10/encoder/encodemb.h
index 928be6c..62a7db4 100644
--- a/vp10/encoder/encodemb.h
+++ b/vp10/encoder/encodemb.h
@@ -39,16 +39,12 @@
void vp10_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
-void vp10_fwd_txfm_4x4(const int16_t *src_diff,
- tran_low_t *coeff, int diff_stride, TX_TYPE tx_type,
- void (*fwd_txm4x4)(const int16_t *input,
- tran_low_t *output, int stride));
+void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
+ int diff_stride, TX_TYPE tx_type, int lossless);
#if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
- int diff_stride, TX_TYPE tx_type,
- void (*highbd_fwd_txm4x4)(const int16_t *input,
- tran_low_t *output, int stride));
+ int diff_stride, TX_TYPE tx_type, int lossless);
#endif // CONFIG_VP9_HIGHBITDEPTH
#ifdef __cplusplus
diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c
index 6ae4c5e..a38e182 100644
--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -1455,8 +1455,13 @@
cm->interp_filter = cpi->sf.default_interp_filter;
- cm->display_width = cpi->oxcf.width;
- cm->display_height = cpi->oxcf.height;
+ if (cpi->oxcf.render_width > 0 && cpi->oxcf.render_height > 0) {
+ cm->render_width = cpi->oxcf.render_width;
+ cm->render_height = cpi->oxcf.render_height;
+ } else {
+ cm->render_width = cpi->oxcf.width;
+ cm->render_height = cpi->oxcf.height;
+ }
cm->width = cpi->oxcf.width;
cm->height = cpi->oxcf.height;
@@ -1820,14 +1825,15 @@
snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
void vp10_remove_compressor(VP10_COMP *cpi) {
- VP10_COMMON *const cm = &cpi->common;
+ VP10_COMMON *cm;
unsigned int i;
int t;
if (!cpi)
return;
- if (cpi && (cm->current_video_frame > 0)) {
+ cm = &cpi->common;
+ if (cm->current_video_frame > 0) {
#if CONFIG_INTERNAL_STATS
vpx_clear_system_state();
@@ -3626,6 +3632,8 @@
cm->frame_to_show = get_frame_new_buffer(cm);
cm->frame_to_show->color_space = cm->color_space;
cm->frame_to_show->color_range = cm->color_range;
+ cm->frame_to_show->render_width = cm->render_width;
+ cm->frame_to_show->render_height = cm->render_height;
// Pick the loop filter level for the frame.
loopfilter_frame(cpi, cm);
@@ -4086,19 +4094,7 @@
}
if (oxcf->pass == 1) {
- const int lossless = is_lossless_requested(oxcf);
-#if CONFIG_VP9_HIGHBITDEPTH
- if (cpi->oxcf.use_highbitdepth)
- cpi->td.mb.fwd_txm4x4 = lossless ?
- vp10_highbd_fwht4x4 : vpx_highbd_fdct4x4;
- else
- cpi->td.mb.fwd_txm4x4 = lossless ? vp10_fwht4x4 : vpx_fdct4x4;
- cpi->td.mb.highbd_itxm_add = lossless ? vp10_highbd_iwht4x4_add :
- vp10_highbd_idct4x4_add;
-#else
- cpi->td.mb.fwd_txm4x4 = lossless ? vp10_fwht4x4 : vpx_fdct4x4;
-#endif // CONFIG_VP9_HIGHBITDEPTH
- cpi->td.mb.itxm_add = lossless ? vp10_iwht4x4_add : vp10_idct4x4_add;
+ cpi->td.mb.e_mbd.lossless = is_lossless_requested(oxcf);
vp10_first_pass(cpi, source);
} else if (oxcf->pass == 2) {
Pass2Encode(cpi, size, dest, frame_flags);
diff --git a/vp10/encoder/encoder.h b/vp10/encoder/encoder.h
index 8ab1efa..6f3f711 100644
--- a/vp10/encoder/encoder.h
+++ b/vp10/encoder/encoder.h
@@ -229,6 +229,8 @@
#endif
vpx_color_space_t color_space;
int color_range;
+ int render_width;
+ int render_height;
} VP10EncoderConfig;
static INLINE int is_lossless_requested(const VP10EncoderConfig *cfg) {
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index 20b7d50..e3bbdd3 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -798,8 +798,7 @@
if (xd->lossless) {
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type);
- vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
- vp10_highbd_fwht4x4);
+ vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors,
@@ -808,14 +807,12 @@
goto next_highbd;
vp10_highbd_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
dst, dst_stride, p->eobs[block],
- xd->bd, DCT_DCT,
- vp10_highbd_iwht4x4_add);
+ xd->bd, DCT_DCT, 1);
} else {
int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type);
- vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type,
- vpx_highbd_fdct4x4);
+ vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors,
@@ -827,8 +824,7 @@
goto next_highbd;
vp10_highbd_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
dst, dst_stride, p->eobs[block],
- xd->bd, tx_type,
- vp10_highbd_idct4x4_add);
+ xd->bd, tx_type, 0);
}
}
}
@@ -901,7 +897,7 @@
if (xd->lossless) {
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type);
- vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, vp10_fwht4x4);
+ vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors,
@@ -909,13 +905,12 @@
if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
goto next;
vp10_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
- dst, dst_stride, p->eobs[block], DCT_DCT,
- vp10_iwht4x4_add);
+ dst, dst_stride, p->eobs[block], DCT_DCT, 1);
} else {
int64_t unused;
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block);
const scan_order *so = get_scan(TX_4X4, tx_type);
- vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, vpx_fdct4x4);
+ vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
ratey += cost_coeffs(x, 0, block, tempa + idx, templ + idy, TX_4X4,
so->scan, so->neighbors,
@@ -925,8 +920,7 @@
if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
goto next;
vp10_inv_txfm_add_4x4(BLOCK_OFFSET(pd->dqcoeff, block),
- dst, dst_stride, p->eobs[block], tx_type,
- vp10_idct4x4_add);
+ dst, dst_stride, p->eobs[block], tx_type, 0);
}
}
}
@@ -1290,6 +1284,8 @@
const int width = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int height = 4 * num_4x4_blocks_high_lookup[plane_bsize];
int idx, idy;
+ void (*fwd_txm4x4)(const int16_t *input, tran_low_t *output, int stride);
+
const uint8_t *const src =
&p->src.buf[vp10_raster_block_offset(BLOCK_8X8, i, p->src.stride)];
uint8_t *const dst = &pd->dst.buf[vp10_raster_block_offset(BLOCK_8X8, i,
@@ -1303,6 +1299,16 @@
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ fwd_txm4x4 = xd->lossless ? vp10_highbd_fwht4x4 : vpx_highbd_fdct4x4;
+ } else {
+ fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
+ }
+#else
+ fwd_txm4x4 = xd->lossless ? vp10_fwht4x4 : vpx_fdct4x4;
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vpx_highbd_subtract_block(
height, width, vp10_raster_block_offset_int16(BLOCK_8X8, i, p->src_diff),
8, src, p->src.stride, dst, pd->dst.stride, xd->bd);
@@ -1325,8 +1331,8 @@
k += (idy * 2 + idx);
coeff = BLOCK_OFFSET(p->coeff, k);
- x->fwd_txm4x4(vp10_raster_block_offset_int16(BLOCK_8X8, k, p->src_diff),
- coeff, 8);
+ fwd_txm4x4(vp10_raster_block_offset_int16(BLOCK_8X8, k, p->src_diff),
+ coeff, 8);
vp10_regular_quantize_b_4x4(x, 0, k, so->scan, so->iscan);
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
diff --git a/vp10/vp10_cx_iface.c b/vp10/vp10_cx_iface.c
index 2cb309d..304f74e 100644
--- a/vp10/vp10_cx_iface.c
+++ b/vp10/vp10_cx_iface.c
@@ -46,6 +46,8 @@
vp9e_tune_content content;
vpx_color_space_t color_space;
int color_range;
+ int render_width;
+ int render_height;
};
static struct vp10_extracfg default_extra_cfg = {
@@ -73,6 +75,8 @@
VP9E_CONTENT_DEFAULT, // content
VPX_CS_UNKNOWN, // color space
0, // color range
+ 0, // render width
+ 0, // render height
};
struct vpx_codec_alg_priv {
@@ -402,6 +406,8 @@
oxcf->color_space = extra_cfg->color_space;
oxcf->color_range = extra_cfg->color_range;
+ oxcf->render_width = extra_cfg->render_width;
+ oxcf->render_height = extra_cfg->render_height;
oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
oxcf->arnr_strength = extra_cfg->arnr_strength;
oxcf->min_gf_interval = extra_cfg->min_gf_interval;
@@ -1232,6 +1238,15 @@
return update_extra_cfg(ctx, &extra_cfg);
}
+static vpx_codec_err_t ctrl_set_render_size(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ struct vp10_extracfg extra_cfg = ctx->extra_cfg;
+ int *const render_size = va_arg(args, int *);
+ extra_cfg.render_width = render_size[0];
+ extra_cfg.render_height = render_size[0];
+ return update_extra_cfg(ctx, &extra_cfg);
+}
+
static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{VP8_COPY_REFERENCE, ctrl_copy_reference},
{VP8E_UPD_ENTROPY, ctrl_update_entropy},
@@ -1269,6 +1284,7 @@
{VP9E_SET_NOISE_SENSITIVITY, ctrl_set_noise_sensitivity},
{VP9E_SET_MIN_GF_INTERVAL, ctrl_set_min_gf_interval},
{VP9E_SET_MAX_GF_INTERVAL, ctrl_set_max_gf_interval},
+ {VP9E_SET_RENDER_SIZE, ctrl_set_render_size},
// Getters
{VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer},
diff --git a/vp10/vp10_dx_iface.c b/vp10/vp10_dx_iface.c
index a8f9aa3..33337a4 100644
--- a/vp10/vp10_dx_iface.c
+++ b/vp10/vp10_dx_iface.c
@@ -978,9 +978,9 @@
return VPX_CODEC_INVALID_PARAM;
}
-static vpx_codec_err_t ctrl_get_display_size(vpx_codec_alg_priv_t *ctx,
- va_list args) {
- int *const display_size = va_arg(args, int *);
+static vpx_codec_err_t ctrl_get_render_size(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ int *const render_size = va_arg(args, int *);
// Only support this function in serial decode.
if (ctx->frame_parallel_decode) {
@@ -988,14 +988,14 @@
return VPX_CODEC_INCAPABLE;
}
- if (display_size) {
+ if (render_size) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
const VP10_COMMON *const cm = &frame_worker_data->pbi->common;
- display_size[0] = cm->display_width;
- display_size[1] = cm->display_height;
+ render_size[0] = cm->render_width;
+ render_size[1] = cm->render_height;
return VPX_CODEC_OK;
} else {
return VPX_CODEC_ERROR;
@@ -1094,7 +1094,7 @@
{VP8D_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates},
{VP8D_GET_FRAME_CORRUPTED, ctrl_get_frame_corrupted},
{VP9_GET_REFERENCE, ctrl_get_reference},
- {VP9D_GET_DISPLAY_SIZE, ctrl_get_display_size},
+ {VP9D_GET_DISPLAY_SIZE, ctrl_get_render_size},
{VP9D_GET_BIT_DEPTH, ctrl_get_bit_depth},
{VP9D_GET_FRAME_SIZE, ctrl_get_frame_size},
diff --git a/vp10/vp10_iface_common.h b/vp10/vp10_iface_common.h
index 7987d18..b2b4b7d 100644
--- a/vp10/vp10_iface_common.h
+++ b/vp10/vp10_iface_common.h
@@ -43,6 +43,8 @@
img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3);
img->d_w = yv12->y_crop_width;
img->d_h = yv12->y_crop_height;
+ img->r_w = yv12->render_width;
+ img->r_h = yv12->render_height;
img->x_chroma_shift = yv12->subsampling_x;
img->y_chroma_shift = yv12->subsampling_y;
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
@@ -84,6 +86,8 @@
yv12->y_crop_width = img->d_w;
yv12->y_crop_height = img->d_h;
+ yv12->render_width = img->r_w;
+ yv12->render_height = img->r_h;
yv12->y_width = img->d_w;
yv12->y_height = img->d_h;
diff --git a/vp10/vp10cx.mk b/vp10/vp10cx.mk
index 7393a4e..ead993a 100644
--- a/vp10/vp10cx.mk
+++ b/vp10/vp10cx.mk
@@ -23,7 +23,6 @@
VP10_CX_SRCS-yes += encoder/context_tree.h
VP10_CX_SRCS-yes += encoder/cost.h
VP10_CX_SRCS-yes += encoder/cost.c
-VP10_CX_SRCS-yes += encoder/dct.h
VP10_CX_SRCS-yes += encoder/dct.c
VP10_CX_SRCS-$(CONFIG_VP9_TEMPORAL_DENOISING) += encoder/denoiser.c
VP10_CX_SRCS-$(CONFIG_VP9_TEMPORAL_DENOISING) += encoder/denoiser.h
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index 63c8e68..7da3d71 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -1593,15 +1593,38 @@
if (Q < thresh_qp &&
cpi->projected_frame_size > thresh_rate &&
pred_err_mb > thresh_pred_err_mb) {
+ double new_correction_factor = cpi->rate_correction_factor;
+ const int target_size = cpi->av_per_frame_bandwidth;
+ int target_bits_per_mb;
// Drop this frame: advance frame counters, and set force_maxqp flag.
cpi->common.current_video_frame++;
cpi->frames_since_key++;
- // Adjust rate correction factor upwards.
- cpi->rate_correction_factor *= 2.0;
- if (cpi->rate_correction_factor > MAX_BPB_FACTOR)
- cpi->rate_correction_factor = MAX_BPB_FACTOR;
// Flag to indicate we will force next frame to be encoded at max QP.
cpi->force_maxqp = 1;
+ // Reset the buffer levels.
+ cpi->buffer_level = cpi->oxcf.optimal_buffer_level;
+ cpi->bits_off_target = cpi->oxcf.optimal_buffer_level;
+ // Compute a new rate correction factor, corresponding to the current
+ // target frame size and max_QP, and adjust the rate correction factor
+ // upwards, if needed.
+ // This is to prevent a bad state where the re-encoded frame at max_QP
+ // undershoots significantly, and then we end up dropping every other
+ // frame because the QP/rate_correction_factor may have been too low
+ // before the drop and then takes too long to come up.
+ if (target_size >= (INT_MAX >> BPER_MB_NORMBITS))
+ target_bits_per_mb =
+ (target_size / cpi->common.MBs) << BPER_MB_NORMBITS;
+ else
+ target_bits_per_mb =
+ (target_size << BPER_MB_NORMBITS) / cpi->common.MBs;
+ // Rate correction factor based on target_size_per_mb and max_QP.
+ new_correction_factor = (double)target_bits_per_mb /
+ (double)vp8_bits_per_mb[INTER_FRAME][cpi->worst_quality];
+ if (new_correction_factor > cpi->rate_correction_factor)
+ cpi->rate_correction_factor =
+ VPXMIN(2.0 * cpi->rate_correction_factor, new_correction_factor);
+ if (cpi->rate_correction_factor > MAX_BPB_FACTOR)
+ cpi->rate_correction_factor = MAX_BPB_FACTOR;
return 1;
} else {
cpi->force_maxqp = 0;
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index 99e51c4..a12a2ad 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -246,8 +246,8 @@
img->fmt = VPX_IMG_FMT_I420;
img->w = yv12->y_stride;
img->h = (yv12->y_height + 2 * VP8BORDERINPIXELS + 15) & ~15;
- img->d_w = yv12->y_width;
- img->d_h = yv12->y_height;
+ img->d_w = img->r_w = yv12->y_width;
+ img->d_h = img->r_h = yv12->y_height;
img->x_chroma_shift = 1;
img->y_chroma_shift = 1;
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 61e731a..6fb8dca 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -115,8 +115,8 @@
int color_range;
int width;
int height;
- int display_width;
- int display_height;
+ int render_width;
+ int render_height;
int last_width;
int last_height;
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index ba8c8dd..fc58a6e 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -1181,11 +1181,11 @@
: literal_to_filter[vpx_rb_read_literal(rb, 2)];
}
-static void setup_display_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
- cm->display_width = cm->width;
- cm->display_height = cm->height;
+static void setup_render_size(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
+ cm->render_width = cm->width;
+ cm->render_height = cm->height;
if (vpx_rb_read_bit(rb))
- vp9_read_frame_size(rb, &cm->display_width, &cm->display_height);
+ vp9_read_frame_size(rb, &cm->render_width, &cm->render_height);
}
static void resize_mv_buffer(VP9_COMMON *cm) {
@@ -1233,7 +1233,7 @@
BufferPool *const pool = cm->buffer_pool;
vp9_read_frame_size(rb, &width, &height);
resize_context_buffers(cm, width, height);
- setup_display_size(cm, rb);
+ setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
@@ -1257,6 +1257,8 @@
pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
pool->frame_bufs[cm->new_fb_idx].buf.color_space = cm->color_space;
pool->frame_bufs[cm->new_fb_idx].buf.color_range = cm->color_range;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_width = cm->render_width;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_height = cm->render_height;
}
static INLINE int valid_ref_frame_img_fmt(vpx_bit_depth_t ref_bit_depth,
@@ -1315,7 +1317,7 @@
}
resize_context_buffers(cm, width, height);
- setup_display_size(cm, rb);
+ setup_render_size(cm, rb);
lock_buffer_pool(pool);
if (vpx_realloc_frame_buffer(
@@ -1339,6 +1341,8 @@
pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
pool->frame_bufs[cm->new_fb_idx].buf.color_space = cm->color_space;
pool->frame_bufs[cm->new_fb_idx].buf.color_range = cm->color_range;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_width = cm->render_width;
+ pool->frame_bufs[cm->new_fb_idx].buf.render_height = cm->render_height;
}
static void setup_tile_info(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
@@ -1948,6 +1952,8 @@
#endif
get_frame_new_buffer(cm)->color_space = cm->color_space;
get_frame_new_buffer(cm)->color_range = cm->color_range;
+ get_frame_new_buffer(cm)->render_width = cm->render_width;
+ get_frame_new_buffer(cm)->render_height = cm->render_height;
if (pbi->need_resync) {
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 01cced0..f3c8579 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -969,14 +969,14 @@
return total_size;
}
-static void write_display_size(const VP9_COMMON *cm,
- struct vpx_write_bit_buffer *wb) {
- const int scaling_active = cm->width != cm->display_width ||
- cm->height != cm->display_height;
+static void write_render_size(const VP9_COMMON *cm,
+ struct vpx_write_bit_buffer *wb) {
+ const int scaling_active = cm->width != cm->render_width ||
+ cm->height != cm->render_height;
vpx_wb_write_bit(wb, scaling_active);
if (scaling_active) {
- vpx_wb_write_literal(wb, cm->display_width - 1, 16);
- vpx_wb_write_literal(wb, cm->display_height - 1, 16);
+ vpx_wb_write_literal(wb, cm->render_width - 1, 16);
+ vpx_wb_write_literal(wb, cm->render_height - 1, 16);
}
}
@@ -985,7 +985,7 @@
vpx_wb_write_literal(wb, cm->width - 1, 16);
vpx_wb_write_literal(wb, cm->height - 1, 16);
- write_display_size(cm, wb);
+ write_render_size(cm, wb);
}
static void write_frame_size_with_refs(VP9_COMP *cpi,
@@ -1023,7 +1023,7 @@
vpx_wb_write_literal(wb, cm->height - 1, 16);
}
- write_display_size(cm, wb);
+ write_render_size(cm, wb);
}
static void write_sync_code(struct vpx_write_bit_buffer *wb) {
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index eb0d360..202c112 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1509,8 +1509,13 @@
cm->interp_filter = cpi->sf.default_interp_filter;
- cm->display_width = cpi->oxcf.width;
- cm->display_height = cpi->oxcf.height;
+ if (cpi->oxcf.render_width > 0 && cpi->oxcf.render_height > 0) {
+ cm->render_width = cpi->oxcf.render_width;
+ cm->render_height = cpi->oxcf.render_height;
+ } else {
+ cm->render_width = cpi->oxcf.width;
+ cm->render_height = cpi->oxcf.height;
+ }
if (last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) {
cm->width = cpi->oxcf.width;
cm->height = cpi->oxcf.height;
@@ -1930,14 +1935,15 @@
snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V))
void vp9_remove_compressor(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
+ VP9_COMMON *cm;
unsigned int i;
int t;
if (!cpi)
return;
- if (cpi && (cm->current_video_frame > 0)) {
+ cm = &cpi->common;
+ if (cm->current_video_frame > 0) {
#if CONFIG_INTERNAL_STATS
vpx_clear_system_state();
@@ -3823,6 +3829,8 @@
cm->frame_to_show = get_frame_new_buffer(cm);
cm->frame_to_show->color_space = cm->color_space;
cm->frame_to_show->color_range = cm->color_range;
+ cm->frame_to_show->render_width = cm->render_width;
+ cm->frame_to_show->render_height = cm->render_height;
// Pick the loop filter level for the frame.
loopfilter_frame(cpi, cm);
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index b50f2fb..174e2b4 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -239,6 +239,8 @@
#endif
vpx_color_space_t color_space;
int color_range;
+ int render_width;
+ int render_height;
VP9E_TEMPORAL_LAYERING_MODE temporal_layering_mode;
} VP9EncoderConfig;
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index aea1a5f..a253c06 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -46,6 +46,8 @@
vp9e_tune_content content;
vpx_color_space_t color_space;
int color_range;
+ int render_width;
+ int render_height;
};
static struct vp9_extracfg default_extra_cfg = {
@@ -73,6 +75,8 @@
VP9E_CONTENT_DEFAULT, // content
VPX_CS_UNKNOWN, // color space
0, // color range
+ 0, // render width
+ 0, // render height
};
struct vpx_codec_alg_priv {
@@ -469,6 +473,8 @@
oxcf->color_space = extra_cfg->color_space;
oxcf->color_range = extra_cfg->color_range;
+ oxcf->render_width = extra_cfg->render_width;
+ oxcf->render_height = extra_cfg->render_height;
oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
oxcf->arnr_strength = extra_cfg->arnr_strength;
oxcf->min_gf_interval = extra_cfg->min_gf_interval;
@@ -1461,6 +1467,15 @@
return update_extra_cfg(ctx, &extra_cfg);
}
+static vpx_codec_err_t ctrl_set_render_size(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ struct vp9_extracfg extra_cfg = ctx->extra_cfg;
+ int *const render_size = va_arg(args, int *);
+ extra_cfg.render_width = render_size[0];
+ extra_cfg.render_height = render_size[1];
+ return update_extra_cfg(ctx, &extra_cfg);
+}
+
static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{VP8_COPY_REFERENCE, ctrl_copy_reference},
{VP8E_UPD_ENTROPY, ctrl_update_entropy},
@@ -1502,6 +1517,7 @@
{VP9E_SET_MIN_GF_INTERVAL, ctrl_set_min_gf_interval},
{VP9E_SET_MAX_GF_INTERVAL, ctrl_set_max_gf_interval},
{VP9E_SET_SVC_REF_FRAME_CONFIG, ctrl_set_svc_ref_frame_config},
+ {VP9E_SET_RENDER_SIZE, ctrl_set_render_size},
// Getters
{VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer},
diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c
index eb2371e..c6b1ba9 100644
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -979,9 +979,9 @@
return VPX_CODEC_INVALID_PARAM;
}
-static vpx_codec_err_t ctrl_get_display_size(vpx_codec_alg_priv_t *ctx,
- va_list args) {
- int *const display_size = va_arg(args, int *);
+static vpx_codec_err_t ctrl_get_render_size(vpx_codec_alg_priv_t *ctx,
+ va_list args) {
+ int *const render_size = va_arg(args, int *);
// Only support this function in serial decode.
if (ctx->frame_parallel_decode) {
@@ -989,14 +989,14 @@
return VPX_CODEC_INCAPABLE;
}
- if (display_size) {
+ if (render_size) {
if (ctx->frame_workers) {
VPxWorker *const worker = ctx->frame_workers;
FrameWorkerData *const frame_worker_data =
(FrameWorkerData *)worker->data1;
const VP9_COMMON *const cm = &frame_worker_data->pbi->common;
- display_size[0] = cm->display_width;
- display_size[1] = cm->display_height;
+ render_size[0] = cm->render_width;
+ render_size[1] = cm->render_height;
return VPX_CODEC_OK;
} else {
return VPX_CODEC_ERROR;
@@ -1095,7 +1095,7 @@
{VP8D_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates},
{VP8D_GET_FRAME_CORRUPTED, ctrl_get_frame_corrupted},
{VP9_GET_REFERENCE, ctrl_get_reference},
- {VP9D_GET_DISPLAY_SIZE, ctrl_get_display_size},
+ {VP9D_GET_DISPLAY_SIZE, ctrl_get_render_size},
{VP9D_GET_BIT_DEPTH, ctrl_get_bit_depth},
{VP9D_GET_FRAME_SIZE, ctrl_get_frame_size},
diff --git a/vp9/vp9_iface_common.h b/vp9/vp9_iface_common.h
index 7d514ba..938d422 100644
--- a/vp9/vp9_iface_common.h
+++ b/vp9/vp9_iface_common.h
@@ -43,6 +43,8 @@
img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3);
img->d_w = yv12->y_crop_width;
img->d_h = yv12->y_crop_height;
+ img->r_w = yv12->render_width;
+ img->r_h = yv12->render_height;
img->x_chroma_shift = yv12->subsampling_x;
img->y_chroma_shift = yv12->subsampling_y;
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
@@ -84,6 +86,8 @@
yv12->y_crop_width = img->d_w;
yv12->y_crop_height = img->d_h;
+ yv12->render_width = img->r_w;
+ yv12->render_height = img->r_h;
yv12->y_width = img->d_w;
yv12->y_height = img->d_h;
diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
index a437ac9..69b8d3e 100644
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -564,6 +564,14 @@
* Supported in codecs: VP9
*/
VP9E_SET_SVC_REF_FRAME_CONFIG,
+
+ /*!\brief Codec control function to set intended rendering image size.
+ *
+ * By default, this is identical to the image size in pixels.
+ *
+ * Supported in codecs: VP9
+ */
+ VP9E_SET_RENDER_SIZE,
};
/*!\brief vpx 1-D scaling mode
@@ -798,6 +806,13 @@
VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_RANGE, int)
VPX_CTRL_USE_TYPE(VP9E_SET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
+
+/*!\brief
+ *
+ * TODO(rbultje) : add support of the control in ffmpeg
+ */
+#define VPX_CTRL_VP9E_SET_RENDER_SIZE
+VPX_CTRL_USE_TYPE(VP9E_SET_RENDER_SIZE, int *)
/*! @} - end defgroup vp8_encoder */
#ifdef __cplusplus
} // extern "C"
diff --git a/vpx/vpx_image.h b/vpx/vpx_image.h
index be93147..51100599 100644
--- a/vpx/vpx_image.h
+++ b/vpx/vpx_image.h
@@ -93,6 +93,10 @@
unsigned int d_w; /**< Displayed image width */
unsigned int d_h; /**< Displayed image height */
+ /* Image intended rendering dimensions */
+ unsigned int r_w; /**< Intended rendering image width */
+ unsigned int r_h; /**< Intended rendering image height */
+
/* Chroma subsampling info */
unsigned int x_chroma_shift; /**< subsampling order, X */
unsigned int y_chroma_shift; /**< subsampling order, Y */
diff --git a/vpx_scale/yv12config.h b/vpx_scale/yv12config.h
index 2e12ace..3a04452 100644
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -57,6 +57,8 @@
unsigned int bit_depth;
vpx_color_space_t color_space;
int color_range;
+ int render_width;
+ int render_height;
int corrupted;
int flags;
diff --git a/vpxdec.c b/vpxdec.c
index fe1e3f0..fde3b9a 100644
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -953,22 +953,22 @@
// these is set to 0, use the display size set in the first frame
// header. If that is unavailable, use the raw decoded size of the
// first decoded frame.
- int display_width = vpx_input_ctx.width;
- int display_height = vpx_input_ctx.height;
- if (!display_width || !display_height) {
- int display_size[2];
+ int render_width = vpx_input_ctx.width;
+ int render_height = vpx_input_ctx.height;
+ if (!render_width || !render_height) {
+ int render_size[2];
if (vpx_codec_control(&decoder, VP9D_GET_DISPLAY_SIZE,
- display_size)) {
+ render_size)) {
// As last resort use size of first frame as display size.
- display_width = img->d_w;
- display_height = img->d_h;
+ render_width = img->d_w;
+ render_height = img->d_h;
} else {
- display_width = display_size[0];
- display_height = display_size[1];
+ render_width = render_size[0];
+ render_height = render_size[1];
}
}
- scaled_img = vpx_img_alloc(NULL, img->fmt, display_width,
- display_height, 16);
+ scaled_img = vpx_img_alloc(NULL, img->fmt, render_width,
+ render_height, 16);
scaled_img->bit_depth = img->bit_depth;
}