Merge branch 'master' into nextgenv2
diff --git a/test/avg_test.cc b/test/avg_test.cc index 7d5380f..44d8dd7 100644 --- a/test/avg_test.cc +++ b/test/avg_test.cc
@@ -55,19 +55,19 @@ } // Sum Pixels - unsigned int ReferenceAverage8x8(const uint8_t* source, int pitch ) { + unsigned int ReferenceAverage8x8(const uint8_t* source, int pitch) { unsigned int average = 0; for (int h = 0; h < 8; ++h) for (int w = 0; w < 8; ++w) - average += source[h * source_stride_ + w]; + average += source[h * pitch + w]; return ((average + 32) >> 6); } - unsigned int ReferenceAverage4x4(const uint8_t* source, int pitch ) { + unsigned int ReferenceAverage4x4(const uint8_t* source, int pitch) { unsigned int average = 0; for (int h = 0; h < 4; ++h) for (int w = 0; w < 4; ++w) - average += source[h * source_stride_ + w]; + average += source[h * pitch + w]; return ((average + 8) >> 4); }
diff --git a/test/convolve_test.cc b/test/convolve_test.cc index 0826788..12022be 100644 --- a/test/convolve_test.cc +++ b/test/convolve_test.cc
@@ -279,8 +279,7 @@ uint16_t *output_ptr, unsigned int output_stride, unsigned int output_width, - unsigned int output_height, - int bd) { + unsigned int output_height) { unsigned int i, j; for (i = 0; i < output_height; ++i) { for (j = 0; j < output_width; ++j) { @@ -306,7 +305,7 @@ highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64, output_width, output_height, bd); highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride, - output_width, output_height, bd); + output_width, output_height); } #endif // CONFIG_VP9_HIGHBITDEPTH
diff --git a/test/datarate_test.cc b/test/datarate_test.cc index b98f8c8..9d5074e 100644 --- a/test/datarate_test.cc +++ b/test/datarate_test.cc
@@ -850,8 +850,7 @@ const vpx_svc_extra_cfg_t *svc_params, int spatial_layers, int temporal_layers, - int temporal_layering_mode, - unsigned int total_rate) { + int temporal_layering_mode) { int sl, spatial_layer_target; float total = 0; float alloc_ratio[VPX_MAX_LAYERS] = {0}; @@ -914,8 +913,7 @@ cfg_.rc_target_bitrate = i; ResetModel(); assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers, - cfg_.ts_number_layers, cfg_.temporal_layering_mode, - cfg_.rc_target_bitrate); + cfg_.ts_number_layers, cfg_.temporal_layering_mode); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_ * 0.85) << " The datarate for the file exceeds the target by too much!"; @@ -953,8 +951,7 @@ cfg_.rc_target_bitrate = 800; ResetModel(); assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers, - cfg_.ts_number_layers, cfg_.temporal_layering_mode, - cfg_.rc_target_bitrate); + cfg_.ts_number_layers, cfg_.temporal_layering_mode); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_ * 0.85) << " The datarate for the file exceeds the target by too much!";
diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc index 0449b52..d6cc5e4 100644 --- a/test/dct16x16_test.cc +++ b/test/dct16x16_test.cc
@@ -276,12 +276,12 @@ } void idct16x16_10_ref(const tran_low_t *in, uint8_t *out, int stride, - int tx_type) { + int /*tx_type*/) { idct16x16_10(in, out, stride); } void idct16x16_12_ref(const tran_low_t *in, uint8_t *out, int stride, - int tx_type) { + int /*tx_type*/) { idct16x16_12(in, out, stride); } @@ -778,7 +778,7 @@ virtual void TearDown() { libvpx_test::ClearSystemState(); } protected: - void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {} + void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {} void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { inv_txfm_(out, dst, stride); }
diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc index 9a2ad2f..cd0dca2 100644 --- a/test/error_resilience_test.cc +++ b/test/error_resilience_test.cc
@@ -100,7 +100,7 @@ } virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video, - ::libvpx_test::Encoder *encoder) { + ::libvpx_test::Encoder * /*encoder*/) { frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF);
diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc index 3f6b738..0c91aee 100644 --- a/test/fdct4x4_test.cc +++ b/test/fdct4x4_test.cc
@@ -40,7 +40,7 @@ typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht4x4Param; void fdct4x4_ref(const int16_t *in, tran_low_t *out, int stride, - int tx_type) { + int /*tx_type*/) { vpx_fdct4x4_c(in, out, stride); } @@ -49,7 +49,7 @@ } void fwht4x4_ref(const int16_t *in, tran_low_t *out, int stride, - int tx_type) { + int /*tx_type*/) { vp9_fwht4x4_c(in, out, stride); }
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc index 72d2aed..edf4682 100644 --- a/test/fdct8x8_test.cc +++ b/test/fdct8x8_test.cc
@@ -47,7 +47,7 @@ typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht8x8Param; typedef std::tr1::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t> Idct8x8Param; -void reference_8x8_dct_1d(const double in[8], double out[8], int stride) { +void reference_8x8_dct_1d(const double in[8], double out[8]) { const double kInvSqrt2 = 0.707106781186547524400844362104; for (int k = 0; k < 8; k++) { out[k] = 0.0; @@ -65,7 +65,7 @@ double temp_in[8], temp_out[8]; for (int j = 0; j < 8; ++j) temp_in[j] = input[j*8 + i]; - reference_8x8_dct_1d(temp_in, temp_out, 1); + reference_8x8_dct_1d(temp_in, temp_out); for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j]; } @@ -74,7 +74,7 @@ double temp_in[8], temp_out[8]; for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i*8]; - reference_8x8_dct_1d(temp_in, temp_out, 1); + reference_8x8_dct_1d(temp_in, temp_out); // Scale by some magic number for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2; @@ -82,7 +82,8 @@ } -void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { +void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, + int /*tx_type*/) { vpx_fdct8x8_c(in, out, stride); } @@ -642,7 +643,7 @@ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { inv_txfm_(out, dst, stride); } - void RunFwdTxfm(int16_t *out, tran_low_t *dst, int stride) {} + void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {} IdctFunc ref_txfm_; IdctFunc inv_txfm_;
diff --git a/test/resize_test.cc b/test/resize_test.cc index c5f05f3..0177308 100644 --- a/test/resize_test.cc +++ b/test/resize_test.cc
@@ -90,74 +90,178 @@ unsigned int h; }; -unsigned int ScaleForFrameNumber(unsigned int frame, unsigned int val) { - if (frame < 10) - return val; - if (frame < 20) - return val * 3 / 4; - if (frame < 30) - return val / 2; - if (frame < 40) - return val; - if (frame < 50) - return val * 3 / 4; - if (frame < 60) - return val / 2; - if (frame < 70) - return val * 3 / 4; - if (frame < 80) - return val; - if (frame < 90) - return val * 3 / 4; - if (frame < 100) - return val / 2; - if (frame < 110) - return val * 3 / 4; - if (frame < 120) - return val; - if (frame < 130) - return val * 3 / 4; - if (frame < 140) - return val / 2; - if (frame < 150) - return val * 3 / 4; - if (frame < 160) - return val; - if (frame < 170) - return val / 2; - if (frame < 180) - return val * 3 / 4; - if (frame < 190) - return val; - if (frame < 200) - return val * 3 / 4; - if (frame < 210) - return val / 2; - if (frame < 220) - return val * 3 / 4; - if (frame < 230) - return val; - if (frame < 240) - return val / 2; - if (frame < 250) - return val * 3 / 4; - return val; +void ScaleForFrameNumber(unsigned int frame, + unsigned int initial_w, + unsigned int initial_h, + unsigned int *w, + unsigned int *h, + int flag_codec) { + if (frame < 10) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 20) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 30) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 40) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 50) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 60) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 70) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 80) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 90) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 100) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 110) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 120) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 130) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 140) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 150) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 160) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 170) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 180) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 190) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 200) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 210) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 220) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 230) { + *w = initial_w; + *h = initial_h; + return; + } + if (frame < 240) { + *w = initial_w * 3 / 4; + *h = initial_h * 3 / 4; + return; + } + if (frame < 250) { + *w = initial_w / 2; + *h = initial_h / 2; + return; + } + if (frame < 260) { + *w = initial_w; + *h = initial_h; + return; + } + // Go down very low. + if (frame < 270) { + *w = initial_w / 4; + *h = initial_h / 4; + return; + } + if (flag_codec == 1) { + // Cases that only works for VP9. + // For VP9: Swap width and height of original. + if (frame < 320) { + *w = initial_h; + *h = initial_w; + return; + } + } + *w = initial_w; + *h = initial_h; } class ResizingVideoSource : public ::libvpx_test::DummyVideoSource { public: ResizingVideoSource() { SetSize(kInitialWidth, kInitialHeight); - limit_ = 300; + limit_ = 350; } - + int flag_codec_; virtual ~ResizingVideoSource() {} protected: virtual void Next() { ++frame_; - SetSize(ScaleForFrameNumber(frame_, kInitialWidth), - ScaleForFrameNumber(frame_, kInitialHeight)); + unsigned int width; + unsigned int height; + ScaleForFrameNumber(frame_, kInitialWidth, kInitialHeight, &width, &height, + flag_codec_); + SetSize(width, height); FillFrame(); } }; @@ -184,15 +288,17 @@ TEST_P(ResizeTest, TestExternalResizeWorks) { ResizingVideoSource video; + video.flag_codec_ = 0; cfg_.g_lag_in_frames = 0; ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin(); info != frame_info_list_.end(); ++info) { const unsigned int frame = static_cast<unsigned>(info->pts); - const unsigned int expected_w = ScaleForFrameNumber(frame, kInitialWidth); - const unsigned int expected_h = ScaleForFrameNumber(frame, kInitialHeight); - + unsigned int expected_w; + unsigned int expected_h; + ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, + &expected_w, &expected_h, 0); EXPECT_EQ(expected_w, info->w) << "Frame " << frame << " had unexpected width"; EXPECT_EQ(expected_h, info->h) @@ -386,6 +492,7 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) { ResizingVideoSource video; + video.flag_codec_ = 1; DefaultConfig(); // Disable internal resize for this test. cfg_.rc_resize_allowed = 0; @@ -395,9 +502,10 @@ for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin(); info != frame_info_list_.end(); ++info) { const unsigned int frame = static_cast<unsigned>(info->pts); - const unsigned int expected_w = ScaleForFrameNumber(frame, kInitialWidth); - const unsigned int expected_h = ScaleForFrameNumber(frame, kInitialHeight); - + unsigned int expected_w; + unsigned int expected_h; + ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, + &expected_w, &expected_h, 1); EXPECT_EQ(expected_w, info->w) << "Frame " << frame << " had unexpected width"; EXPECT_EQ(expected_h, info->h)
diff --git a/test/test_vector_test.cc b/test/test_vector_test.cc index 6f0cbdf..f1aa4d7 100644 --- a/test/test_vector_test.cc +++ b/test/test_vector_test.cc
@@ -103,7 +103,7 @@ const int mode = std::tr1::get<kDecodeMode>(input); libvpx_test::CompressedVideoSource *video = NULL; vpx_codec_flags_t flags = 0; - vpx_codec_dec_cfg_t cfg = {0}; + vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); char str[256]; if (mode == kFrameParallelMode) {
diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc index 3ef6022..bd84098 100644 --- a/test/vp9_encoder_parms_get_to_decoder.cc +++ b/test/vp9_encoder_parms_get_to_decoder.cc
@@ -45,9 +45,9 @@ }; const EncodeParameters kVP9EncodeParameterSet[] = { - {0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601}, - {0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709}, - {0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020}, + {0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601, { 0, 0 }}, + {0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709, { 0, 0 }}, + {0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020, { 0, 0 }}, {0, 2, 0, 0, 1, VPX_CR_STUDIO_RANGE, VPX_CS_UNKNOWN, { 640, 480 }}, // TODO(JBB): Test profiles (requires more work). }; @@ -93,7 +93,7 @@ } virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec, - const libvpx_test::VideoSource &video, + const libvpx_test::VideoSource & /*video*/, libvpx_test::Decoder *decoder) { vpx_codec_ctx_t *const vp9_decoder = decoder->GetDecoder(); vpx_codec_alg_priv_t *const priv =
diff --git a/test/vp9_error_block_test.cc b/test/vp9_error_block_test.cc index 77b12ea..23a249e 100644 --- a/test/vp9_error_block_test.cc +++ b/test/vp9_error_block_test.cc
@@ -164,7 +164,7 @@ const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bps) { - assert(bps == 8); + EXPECT_EQ(8, bps); return vp9_highbd_block_error_8bit_c(coeff, dqcoeff, block_size, ssz); } @@ -173,7 +173,7 @@ const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bps) { - assert(bps == 8); + EXPECT_EQ(8, bps); return vp9_highbd_block_error_8bit_sse2(coeff, dqcoeff, block_size, ssz); } @@ -195,7 +195,7 @@ const tran_low_t *dqcoeff, intptr_t block_size, int64_t *ssz, int bps) { - assert(bps == 8); + EXPECT_EQ(8, bps); return vp9_highbd_block_error_8bit_avx(coeff, dqcoeff, block_size, ssz); }
diff --git a/test/vp9_ethread_test.cc b/test/vp9_ethread_test.cc index 8ac5c33..29a653f 100644 --- a/test/vp9_ethread_test.cc +++ b/test/vp9_ethread_test.cc
@@ -62,7 +62,7 @@ encoder_initialized_ = false; } - virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, + virtual void PreEncodeFrameHook(::libvpx_test::VideoSource * /*video*/, ::libvpx_test::Encoder *encoder) { if (!encoder_initialized_) { // Encode 4 column tiles.
diff --git a/test/vp9_intrapred_test.cc b/test/vp9_intrapred_test.cc index e6198af..416f3c3 100644 --- a/test/vp9_intrapred_test.cc +++ b/test/vp9_intrapred_test.cc
@@ -34,7 +34,7 @@ virtual ~VP9IntraPredBase() { libvpx_test::ClearSystemState(); } protected: - virtual void Predict(PREDICTION_MODE mode) = 0; + virtual void Predict() = 0; void CheckPrediction(int test_case_number, int *error_count) const { // For each pixel ensure that the calculated value is the same as reference. @@ -73,7 +73,7 @@ left_col_[y] = rnd.Rand16() & mask_; } } - Predict(DC_PRED); + Predict(); CheckPrediction(i, &error_count); } ASSERT_EQ(0, error_count); @@ -106,7 +106,7 @@ mask_ = (1 << bit_depth_) - 1; } - virtual void Predict(PREDICTION_MODE mode) { + virtual void Predict() { const uint16_t *const_above_row = above_row_; const uint16_t *const_left_col = left_col_; ref_fn_(ref_dst_, stride_, const_above_row, const_left_col, bit_depth_);
diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c index 4c4261e..4f97c79 100644 --- a/vp10/encoder/encoder.c +++ b/vp10/encoder/encoder.c
@@ -3993,13 +3993,22 @@ int vp10_receive_raw_frame(VP10_COMP *cpi, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time) { - VP10_COMMON *cm = &cpi->common; + VP10_COMMON *volatile const cm = &cpi->common; struct vpx_usec_timer timer; - int res = 0; + volatile int res = 0; const int subsampling_x = sd->subsampling_x; const int subsampling_y = sd->subsampling_y; #if CONFIG_VP9_HIGHBITDEPTH const int use_highbitdepth = (sd->flags & YV12_FLAG_HIGHBITDEPTH) != 0; +#endif + + if (setjmp(cm->error.jmp)) { + cm->error.setjmp = 0; + return -1; + } + cm->error.setjmp = 1; + +#if CONFIG_VP9_HIGHBITDEPTH check_initial_width(cpi, use_highbitdepth, subsampling_x, subsampling_y); #else check_initial_width(cpi, subsampling_x, subsampling_y); @@ -4032,6 +4041,7 @@ res = -1; } + cm->error.setjmp = 0; return res; }
diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c index 24c6c54..7dd1005 100644 --- a/vp9/common/vp9_alloccommon.c +++ b/vp9/common/vp9_alloccommon.c
@@ -119,6 +119,20 @@ cm->lf.lfm = NULL; } + +int vp9_alloc_loop_filter(VP9_COMMON *cm) { + vpx_free(cm->lf.lfm); + // Each lfm holds bit masks for all the 8x8 blocks in a 64x64 region. The + // stride and rows are rounded up / truncated to a multiple of 8. + cm->lf.lfm_stride = (cm->mi_cols + (MI_BLOCK_SIZE - 1)) >> 3; + cm->lf.lfm = (LOOP_FILTER_MASK *)vpx_calloc( + ((cm->mi_rows + (MI_BLOCK_SIZE - 1)) >> 3) * cm->lf.lfm_stride, + sizeof(*cm->lf.lfm)); + if (!cm->lf.lfm) + return 1; + return 0; +} + int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) { int new_mi_size; @@ -151,15 +165,8 @@ cm->above_context_alloc_cols = cm->mi_cols; } - vpx_free(cm->lf.lfm); - - // Each lfm holds bit masks for all the 8x8 blocks in a 64x64 region. The - // stride and rows are rounded up / truncated to a multiple of 8. - cm->lf.lfm_stride = (cm->mi_cols + (MI_BLOCK_SIZE - 1)) >> 3; - cm->lf.lfm = (LOOP_FILTER_MASK *)vpx_calloc( - ((cm->mi_rows + (MI_BLOCK_SIZE - 1)) >> 3) * cm->lf.lfm_stride, - sizeof(*cm->lf.lfm)); - if (!cm->lf.lfm) goto fail; + if (vp9_alloc_loop_filter(cm)) + goto fail; return 0;
diff --git a/vp9/common/vp9_alloccommon.h b/vp9/common/vp9_alloccommon.h index c0e51a6..e53955b 100644 --- a/vp9/common/vp9_alloccommon.h +++ b/vp9/common/vp9_alloccommon.h
@@ -23,6 +23,7 @@ void vp9_remove_common(struct VP9Common *cm); +int vp9_alloc_loop_filter(struct VP9Common *cm); int vp9_alloc_context_buffers(struct VP9Common *cm, int width, int height); void vp9_init_context_buffers(struct VP9Common *cm); void vp9_free_context_buffers(struct VP9Common *cm);
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a2445b0..cf1fe81 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c
@@ -3031,10 +3031,24 @@ TileInfo *const tile_info = &tile_data->tile_info; MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO *mi; + ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE]; + BLOCK_SIZE bs = VPXMAX(bsize, BLOCK_8X8); // processing unit block size + const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bs]; + const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bs]; + int plane; + set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize); mi = xd->mi[0]; mi->sb_type = bsize; + for (plane = 0; plane < MAX_MB_PLANE; ++plane) { + struct macroblockd_plane *pd = &xd->plane[plane]; + memcpy(a + num_4x4_blocks_wide * plane, pd->above_context, + (sizeof(a[0]) * num_4x4_blocks_wide) >> pd->subsampling_x); + memcpy(l + num_4x4_blocks_high * plane, pd->left_context, + (sizeof(l[0]) * num_4x4_blocks_high) >> pd->subsampling_y); + } + if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled) if (cyclic_refresh_segment_id_boosted(mi->segment_id)) x->rdmult = vp9_cyclic_refresh_get_rdmult(cpi->cyclic_refresh); @@ -3052,6 +3066,14 @@ duplicate_mode_info_in_sb(cm, xd, mi_row, mi_col, bsize); + for (plane = 0; plane < MAX_MB_PLANE; ++plane) { + struct macroblockd_plane *pd = &xd->plane[plane]; + memcpy(pd->above_context, a + num_4x4_blocks_wide * plane, + (sizeof(a[0]) * num_4x4_blocks_wide) >> pd->subsampling_x); + memcpy(pd->left_context, l + num_4x4_blocks_high * plane, + (sizeof(l[0]) * num_4x4_blocks_high) >> pd->subsampling_y); + } + if (rd_cost->rate == INT_MAX) vp9_rd_cost_reset(rd_cost);
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index f3147e9..69d5fa7 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c
@@ -1538,8 +1538,12 @@ realloc_segmentation_maps(cpi); cpi->initial_width = cpi->initial_height = 0; cpi->external_resize = 0; + } else if (cm->mi_alloc_size == new_mi_size && + (cpi->oxcf.width > last_w || cpi->oxcf.height > last_h)) { + vp9_alloc_loop_filter(cm); } } + update_frame_size(cpi); if ((last_w != cpi->oxcf.width || last_h != cpi->oxcf.height) && @@ -4141,13 +4145,22 @@ int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time) { - VP9_COMMON *cm = &cpi->common; + VP9_COMMON *volatile const cm = &cpi->common; struct vpx_usec_timer timer; - int res = 0; + volatile int res = 0; const int subsampling_x = sd->subsampling_x; const int subsampling_y = sd->subsampling_y; #if CONFIG_VP9_HIGHBITDEPTH const int use_highbitdepth = (sd->flags & YV12_FLAG_HIGHBITDEPTH) != 0; +#endif + + if (setjmp(cm->error.jmp)) { + cm->error.setjmp = 0; + return -1; + } + cm->error.setjmp = 1; + +#if CONFIG_VP9_HIGHBITDEPTH check_initial_width(cpi, use_highbitdepth, subsampling_x, subsampling_y); #else check_initial_width(cpi, subsampling_x, subsampling_y); @@ -4180,6 +4193,7 @@ res = -1; } + cm->error.setjmp = 0; return res; }
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 1480ea4..193c9d3 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c
@@ -787,9 +787,9 @@ #if CONFIG_VP9_HIGHBITDEPTH uint16_t best_dst16[8 * 8]; #endif + memcpy(ta, a, num_4x4_blocks_wide * sizeof(a[0])); + memcpy(tl, l, num_4x4_blocks_high * sizeof(l[0])); - memcpy(ta, a, sizeof(ta)); - memcpy(tl, l, sizeof(tl)); xd->mi[0]->tx_size = TX_4X4; #if CONFIG_VP9_HIGHBITDEPTH @@ -810,8 +810,8 @@ continue; } - memcpy(tempa, ta, sizeof(ta)); - memcpy(templ, tl, sizeof(tl)); + memcpy(tempa, ta, num_4x4_blocks_wide * sizeof(ta[0])); + memcpy(templ, tl, num_4x4_blocks_high * sizeof(tl[0])); for (idy = 0; idy < num_4x4_blocks_high; ++idy) { for (idx = 0; idx < num_4x4_blocks_wide; ++idx) { @@ -874,8 +874,8 @@ *bestdistortion = distortion; best_rd = this_rd; *best_mode = mode; - memcpy(a, tempa, sizeof(tempa)); - memcpy(l, templ, sizeof(templ)); + memcpy(a, tempa, num_4x4_blocks_wide * sizeof(tempa[0])); + memcpy(l, templ, num_4x4_blocks_high * sizeof(templ[0])); for (idy = 0; idy < num_4x4_blocks_high * 4; ++idy) { memcpy(best_dst16 + idy * 8, CONVERT_TO_SHORTPTR(dst_init + idy * dst_stride), @@ -914,8 +914,8 @@ continue; } - memcpy(tempa, ta, sizeof(ta)); - memcpy(templ, tl, sizeof(tl)); + memcpy(tempa, ta, num_4x4_blocks_wide * sizeof(ta[0])); + memcpy(templ, tl, num_4x4_blocks_high * sizeof(tl[0])); for (idy = 0; idy < num_4x4_blocks_high; ++idy) { for (idx = 0; idx < num_4x4_blocks_wide; ++idx) { @@ -976,8 +976,8 @@ *bestdistortion = distortion; best_rd = this_rd; *best_mode = mode; - memcpy(a, tempa, sizeof(tempa)); - memcpy(l, templ, sizeof(templ)); + memcpy(a, tempa, num_4x4_blocks_wide * sizeof(tempa[0])); + memcpy(l, templ, num_4x4_blocks_high * sizeof(templ[0])); for (idy = 0; idy < num_4x4_blocks_high * 4; ++idy) memcpy(best_dst + idy * 8, dst_init + idy * dst_stride, num_4x4_blocks_wide * 4); @@ -1013,12 +1013,8 @@ int64_t total_distortion = 0; int tot_rate_y = 0; int64_t total_rd = 0; - ENTROPY_CONTEXT t_above[4], t_left[4]; const int *bmode_costs = cpi->mbmode_cost; - memcpy(t_above, xd->plane[0].above_context, sizeof(t_above)); - memcpy(t_left, xd->plane[0].left_context, sizeof(t_left)); - // Pick modes for each sub-block (of size 4x4, 4x8, or 8x4) in an 8x8 block. for (idy = 0; idy < 2; idy += num_4x4_blocks_high) { for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) { @@ -1034,8 +1030,11 @@ } this_rd = rd_pick_intra4x4block(cpi, mb, idy, idx, &best_mode, - bmode_costs, t_above + idx, t_left + idy, + bmode_costs, + xd->plane[0].above_context + idx, + xd->plane[0].left_context + idy, &r, &ry, &d, bsize, best_rd - total_rd); + if (this_rd >= best_rd - total_rd) return INT64_MAX;
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index 8a34fd9..f684507 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c
@@ -303,14 +303,26 @@ FLAG_SKIP_INTRA_LOWVAR; sf->adaptive_pred_interp_filter = 2; - // Disable reference masking if using spatial scaling or for dynamic - // resizing (internal or external) since pred_mv_sad will not be set - // (since vp9_mv_pred will not be called). - // TODO(marpan): Fix this condition to allow reference masking for when - // all references have same resolution as source frame. - sf->reference_masking = (cpi->external_resize == 0 && - cpi->oxcf.resize_mode != RESIZE_DYNAMIC && - cpi->svc.number_spatial_layers == 1) ? 1 : 0; + // Reference masking only enabled for 1 spatial layer, and if none of the + // references have been scaled. The latter condition needs to be checked + // for external or internal dynamic resize. + sf->reference_masking = (cpi->svc.number_spatial_layers == 1); + if (sf->reference_masking == 1 && + (cpi->external_resize == 1 || + cpi->oxcf.resize_mode == RESIZE_DYNAMIC)) { + MV_REFERENCE_FRAME ref_frame; + static const int flag_list[4] = + {0, VP9_LAST_FLAG, VP9_GOLD_FLAG, VP9_ALT_FLAG}; + for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) { + const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame); + if (yv12 != NULL && (cpi->ref_frame_flags & flag_list[ref_frame])) { + const struct scale_factors *const scale_fac = + &cm->frame_refs[ref_frame - 1].sf; + if (vp9_is_scaled(scale_fac)) + sf->reference_masking = 0; + } + } + } sf->disable_filter_search_var_thresh = 50; sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
diff --git a/vpx_dsp/intrapred.c b/vpx_dsp/intrapred.c index dcc9b30..b1076f8 100644 --- a/vpx_dsp/intrapred.c +++ b/vpx_dsp/intrapred.c
@@ -320,6 +320,7 @@ const int K = above[2]; const int L = above[3]; const int M = above[4]; + (void)left; dst[0] = AVG3(H, I, J); dst[1] = AVG3(I, J, K);
diff --git a/vpxenc.c b/vpxenc.c index c61d060..f14470a 100644 --- a/vpxenc.c +++ b/vpxenc.c
@@ -1470,6 +1470,8 @@ global->codec->fourcc, pixel_aspect_ratio); } +#else + (void)pixel_aspect_ratio; #endif if (!stream->config.write_webm) {