From c5dc3373dbd442ea299bacf276c4258fa7ce0559 Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 9 Jan 2018 12:46:45 -0800 Subject: [PATCH 1/7] work around pic issue with gcc 6 Enable pic when building sse2 or higher optimizations. BUG=webm:1464 Change-Id: I36c6e83ed716649f3d9ee10ce3aa9bb847cac2d9 --- build/make/configure.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/make/configure.sh b/build/make/configure.sh index d7e40b83f..683b43037 100644 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -1312,6 +1312,11 @@ EOF check_gcc_machine_option ${ext%_*} $ext fi fi + + # https://bugs.chromium.org/p/webm/issues/detail?id=1464 + # The assembly optimizations for vpx_sub_pixel_variance do not link with + # gcc 6. + enabled sse2 && soft_enable pic done if enabled external_build; then From 7d197399492ab417ab8ba76fff9aa1b5309edd36 Mon Sep 17 00:00:00 2001 From: paulwilkins Date: Thu, 4 Jan 2018 16:02:42 +0000 Subject: [PATCH 2/7] Fix bug in use of zoom metric as part of arf breakout. The in/out (or zoom metrics) in accumulate_frame_motion_stats() are in effect a % of the blocks that have a motion vector pointing either towards or away from the center. As such they are already normalized in terms of image size and the thresholds against which these are tested should be image size independent. In practice a zoom either in or out is an indicator for a shorter group length so the abs value is more important as a breakout clause. This patch fixes the threshold test. Clips without noticeable zoom show no effect but some with strong zooms such as "station" show a big gain (5-10%). Average psnr-hvs gain on hdres set was 0.292% Change-Id: I4f97a72b0e273e4e844ade15285749c32cd81c1c (cherry picked from commit 0226ce79e9389ccf7d10ed7acacba6840ad911c9) --- vp9/encoder/vp9_firstpass.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index eefbdff51..fb6b132a5 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -44,7 +44,6 @@ #define COMPLEXITY_STATS_OUTPUT 0 #define FIRST_PASS_Q 10.0 -#define GF_MAX_BOOST 96.0 #define INTRA_MODE_PENALTY 1024 #define MIN_ARF_GF_BOOST 240 #define MIN_DECAY_FACTOR 0.01 @@ -1949,6 +1948,7 @@ static void accumulate_frame_motion_stats(const FIRSTPASS_STATS *stats, } #define BASELINE_ERR_PER_MB 12500.0 +#define GF_MAX_BOOST 96.0 static double calc_frame_boost(VP9_COMP *cpi, const FIRSTPASS_STATS *this_frame, double this_frame_mv_in_out) { double frame_boost; @@ -2383,6 +2383,8 @@ static void adjust_group_arnr_filter(VP9_COMP *cpi, double section_noise, // Analyse and define a gf/arf group. #define ARF_DECAY_BREAKOUT 0.10 +#define ARF_ABS_ZOOM_THRESH 4.0 + static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { VP9_COMMON *const cm = &cpi->common; RATE_CONTROL *const rc = &cpi->rc; @@ -2411,7 +2413,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { double mv_in_out_accumulator = 0.0; double abs_mv_in_out_accumulator = 0.0; double mv_ratio_accumulator_thresh; - double mv_in_out_thresh; double abs_mv_in_out_thresh; double sr_accumulator = 0.0; const double av_err = get_distribution_av_err(cpi, twopass); @@ -2457,8 +2458,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // Motion breakout threshold for loop below depends on image size. mv_ratio_accumulator_thresh = (cpi->initial_height + cpi->initial_width) / 4.0; - mv_in_out_thresh = (cpi->initial_height + cpi->initial_width) / 300.0; - abs_mv_in_out_thresh = (cpi->initial_height + cpi->initial_width) / 200.0; + abs_mv_in_out_thresh = ARF_ABS_ZOOM_THRESH; // Set a maximum and minimum interval for the GF group. // If the image appears almost completely static we can extend beyond this. @@ -2562,7 +2562,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { (!flash_detected) && ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) || (abs_mv_in_out_accumulator > abs_mv_in_out_thresh) || - (mv_in_out_accumulator < -mv_in_out_thresh) || (sr_accumulator > next_frame.intra_error)))) { break; } From eedda5f9249de8446d8406d4c30d6a1b211552d1 Mon Sep 17 00:00:00 2001 From: Vignesh Venkatasubramanian Date: Tue, 16 Jan 2018 15:42:43 -0800 Subject: [PATCH 3/7] vp8dx.h: Add macro for skipping loop filter Without this applications cannot use the vpx_codec_control macro for VP9_SET_SKIP_LOOP_FILTER. The tests only cover the underscored version vpx_codec_control_(). Change-Id: I3e6c1888307b76636fdc1a8deae70b5c14238163 (cherry picked from commit 373e08f921e5bfd5a96963fabbbbe16ec793d44e) --- vpx/vp8dx.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vpx/vp8dx.h b/vpx/vp8dx.h index 41c53e48d..398c67022 100644 --- a/vpx/vp8dx.h +++ b/vpx/vp8dx.h @@ -179,6 +179,8 @@ VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int) #define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER #define VPX_CTRL_VP9_DECODE_SVC_SPATIAL_LAYER VPX_CTRL_USE_TYPE(VP9_DECODE_SVC_SPATIAL_LAYER, int) +#define VPX_CTRL_VP9_SET_SKIP_LOOP_FILTER +VPX_CTRL_USE_TYPE(VP9_SET_SKIP_LOOP_FILTER, int) /*!\endcond */ /*! @} - end defgroup vp8_decoder */ From f87a4594fbd0b19071a2befebf52d3f5fabd1a9e Mon Sep 17 00:00:00 2001 From: Johann Date: Wed, 17 Jan 2018 11:26:31 -0800 Subject: [PATCH 4/7] Revert "Add frame width & height to frame pkt. Add test." This reverts commit bd1d995cd38b4e31a01356079f1d94067273eb28. Remove the feature from the release as it requires additional work. BUG=webm:1485 Change-Id: I1a01ac2525703af97a456a3eed85718306c0f734 --- test/resize_test.cc | 40 ---------------------------------------- vp8/vp8_cx_iface.c | 2 -- vp9/vp9_cx_iface.c | 2 -- vpx/vpx_encoder.h | 4 +--- 4 files changed, 1 insertion(+), 47 deletions(-) diff --git a/test/resize_test.cc b/test/resize_test.cc index 39952074b..e95dc6651 100644 --- a/test/resize_test.cc +++ b/test/resize_test.cc @@ -277,29 +277,12 @@ class ResizeTest SetMode(GET_PARAM(1)); } - virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { - ASSERT_NE(static_cast(pkt->data.frame.width), 0); - ASSERT_NE(static_cast(pkt->data.frame.height), 0); - encode_frame_width_.push_back(pkt->data.frame.width); - encode_frame_height_.push_back(pkt->data.frame.height); - } - - unsigned int GetFrameWidth(size_t idx) const { - return encode_frame_width_[idx]; - } - - unsigned int GetFrameHeight(size_t idx) const { - return encode_frame_height_[idx]; - } - virtual void DecompressedFrameHook(const vpx_image_t &img, vpx_codec_pts_t pts) { frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h)); } std::vector frame_info_list_; - std::vector encode_frame_width_; - std::vector encode_frame_height_; }; TEST_P(ResizeTest, TestExternalResizeWorks) { @@ -313,9 +296,6 @@ TEST_P(ResizeTest, TestExternalResizeWorks) { const unsigned int frame = static_cast(info->pts); unsigned int expected_w; unsigned int expected_h; - const size_t idx = info - frame_info_list_.begin(); - ASSERT_EQ(info->w, GetFrameWidth(idx)); - ASSERT_EQ(info->h, GetFrameHeight(idx)); ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w, &expected_h, 0); EXPECT_EQ(expected_w, info->w) @@ -484,23 +464,8 @@ class ResizeRealtimeTest ++mismatch_nframes_; } - virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { - ASSERT_NE(static_cast(pkt->data.frame.width), 0); - ASSERT_NE(static_cast(pkt->data.frame.height), 0); - encode_frame_width_.push_back(pkt->data.frame.width); - encode_frame_height_.push_back(pkt->data.frame.height); - } - unsigned int GetMismatchFrames() { return mismatch_nframes_; } - unsigned int GetFrameWidth(size_t idx) const { - return encode_frame_width_[idx]; - } - - unsigned int GetFrameHeight(size_t idx) const { - return encode_frame_height_[idx]; - } - void DefaultConfig() { cfg_.rc_buf_initial_sz = 500; cfg_.rc_buf_optimal_sz = 600; @@ -528,8 +493,6 @@ class ResizeRealtimeTest bool change_bitrate_; double mismatch_psnr_; int mismatch_nframes_; - std::vector encode_frame_width_; - std::vector encode_frame_height_; }; TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) { @@ -619,9 +582,6 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) { int resize_count = 0; for (std::vector::const_iterator info = frame_info_list_.begin(); info != frame_info_list_.end(); ++info) { - const size_t idx = info - frame_info_list_.begin(); - ASSERT_EQ(info->w, GetFrameWidth(idx)); - ASSERT_EQ(info->h, GetFrameHeight(idx)); if (info->w != last_w || info->h != last_h) { resize_count++; if (resize_count == 1) { diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index 8f0a782bc..af6689fd9 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -902,8 +902,6 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx, (unsigned long)((delta * ctx->cfg.g_timebase.den + round) / ctx->cfg.g_timebase.num / 10000000); pkt.data.frame.flags = lib_flags << 16; - pkt.data.frame.width = cpi->common.Width; - pkt.data.frame.height = cpi->common.Height; if (lib_flags & FRAMEFLAGS_KEY) { pkt.data.frame.flags |= VPX_FRAME_IS_KEY; diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index efe42e1ec..881caae78 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1260,8 +1260,6 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, pkt.data.frame.duration = (unsigned long)ticks_to_timebase_units( timebase, dst_end_time_stamp - dst_time_stamp); pkt.data.frame.flags = get_frame_pkt_flags(cpi, lib_flags); - pkt.data.frame.width = cpi->common.width; - pkt.data.frame.height = cpi->common.height; if (ctx->pending_cx_data) { ctx->pending_frame_sizes[ctx->pending_frame_count++] = size; diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h index e7670bdf0..464bc408c 100644 --- a/vpx/vpx_encoder.h +++ b/vpx/vpx_encoder.h @@ -63,7 +63,7 @@ extern "C" { * fields to structures */ #define VPX_ENCODER_ABI_VERSION \ - (7 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/ + (6 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/ /*! \brief Encoder capabilities bitfield * @@ -182,8 +182,6 @@ typedef struct vpx_codec_cx_pkt { * Only applicable when "output partition" mode is enabled. First * partition has id 0.*/ int partition_id; - unsigned int width; /**< frame width */ - unsigned int height; /**< frame height */ } frame; /**< data for compressed frame packet */ vpx_fixed_buf_t twopass_stats; /**< data for two-pass packet */ vpx_fixed_buf_t firstpass_mb_stats; /**< first pass mb packet */ From 9f36419bf21a5922ffc32c289e09dd9fa0eb4eb2 Mon Sep 17 00:00:00 2001 From: Jerome Jiang Date: Wed, 17 Jan 2018 11:23:55 -0800 Subject: [PATCH 5/7] Fix crash invalid params for vp8 multres. Add test. Fix is from the patch in the issue. Release memories allocated before early exit. BUG=webm:1482 Change-Id: I64952af99c58241496e03fa55da09fd129a07c77 (cherry picked from commit 5b6ae020b6a972b67b59b3dbf7cf9cbd3140a80d) --- test/encode_api_test.cc | 72 +++++++++++++++++++++++++++++++++++++++++ vpx/src/vpx_encoder.c | 50 +++++++++++++++------------- 2 files changed, 100 insertions(+), 22 deletions(-) diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc index 164db5a7b..13de53464 100644 --- a/test/encode_api_test.cc +++ b/test/encode_api_test.cc @@ -106,4 +106,76 @@ TEST(EncodeAPI, ImageSizeSetting) { } #endif +#if CONFIG_MULTI_RES_ENCODING +// Set up 2 spatial streams with 2 temporal layers per stream, and generate +// invalid configuration by setting the temporal layer rate allocation +// (ts_target_bitrate[]) to 0 for both layers. +TEST(EncodeAPI, VP8MultiResEncode) { + const int width = 1280; + const int height = 720; + const int width_down = width / 2; + const int height_down = height / 2; + const int target_bitrate = 1000; + const int framerate = 30; + vpx_codec_ctx_t enc[2]; + vpx_codec_enc_cfg_t cfg[2]; + vpx_rational_t dsf[2] = { { 2, 1 }, { 2, 1 } }; + + memset(enc, 0, sizeof(enc)); + + for (int i = 0; i < 2; i++) { + vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &cfg[i], 0); + } + + /* Highest-resolution encoder settings */ + cfg[0].g_w = width; + cfg[0].g_h = height; + cfg[0].rc_dropframe_thresh = 0; + cfg[0].rc_end_usage = VPX_CBR; + cfg[0].rc_resize_allowed = 0; + cfg[0].rc_min_quantizer = 2; + cfg[0].rc_max_quantizer = 56; + cfg[0].rc_undershoot_pct = 100; + cfg[0].rc_overshoot_pct = 15; + cfg[0].rc_buf_initial_sz = 500; + cfg[0].rc_buf_optimal_sz = 600; + cfg[0].rc_buf_sz = 1000; + cfg[0].g_error_resilient = 1; /* Enable error resilient mode */ + cfg[0].g_lag_in_frames = 0; + + cfg[0].kf_mode = VPX_KF_AUTO; + cfg[0].kf_min_dist = 3000; + cfg[0].kf_max_dist = 3000; + + cfg[0].rc_target_bitrate = target_bitrate; /* Set target bitrate */ + cfg[0].g_timebase.num = 1; /* Set fps */ + cfg[0].g_timebase.den = framerate; + + memcpy(&cfg[1], &cfg[0], sizeof(cfg[0])); + cfg[1].rc_target_bitrate = 500; + cfg[1].g_w = width_down; + cfg[1].g_h = height_down; + + for (int i = 0; i < 2; i++) { + cfg[i].ts_number_layers = 2; + cfg[i].ts_periodicity = 2; + cfg[i].ts_rate_decimator[0] = 2; + cfg[i].ts_rate_decimator[1] = 1; + cfg[i].ts_layer_id[0] = 0; + cfg[i].ts_layer_id[1] = 1; + // Invalid parameters. + cfg[i].ts_target_bitrate[0] = 0; + cfg[i].ts_target_bitrate[1] = 0; + } + + EXPECT_EQ(VPX_CODEC_INVALID_PARAM, + vpx_codec_enc_init_multi(&enc[0], vpx_codec_vp8_cx(), &cfg[0], 2, 0, + &dsf[0])); + + for (int i = 0; i < 2; i++) { + vpx_codec_destroy(&enc[i]); + } +} +#endif + } // namespace diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c index 4390cf7c8..a26204bc4 100644 --- a/vpx/src/vpx_encoder.c +++ b/vpx/src/vpx_encoder.c @@ -12,8 +12,11 @@ * \brief Provides the high level interface to wrap encoder algorithms. * */ +#include #include +#include #include +#include "vp8/common/blockd.h" #include "vpx_config.h" #include "vpx/internal/vpx_codec_internal.h" @@ -89,28 +92,27 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver( if (dsf->num < 1 || dsf->num > 4096 || dsf->den < 1 || dsf->den > dsf->num) { res = VPX_CODEC_INVALID_PARAM; - break; + } else { + mr_cfg.mr_low_res_mode_info = mem_loc; + mr_cfg.mr_total_resolutions = num_enc; + mr_cfg.mr_encoder_id = num_enc - 1 - i; + mr_cfg.mr_down_sampling_factor.num = dsf->num; + mr_cfg.mr_down_sampling_factor.den = dsf->den; + + /* Force Key-frame synchronization. Namely, encoder at higher + * resolution always use the same frame_type chosen by the + * lowest-resolution encoder. + */ + if (mr_cfg.mr_encoder_id) cfg->kf_mode = VPX_KF_DISABLED; + + ctx->iface = iface; + ctx->name = iface->name; + ctx->priv = NULL; + ctx->init_flags = flags; + ctx->config.enc = cfg; + res = ctx->iface->init(ctx, &mr_cfg); } - mr_cfg.mr_low_res_mode_info = mem_loc; - mr_cfg.mr_total_resolutions = num_enc; - mr_cfg.mr_encoder_id = num_enc - 1 - i; - mr_cfg.mr_down_sampling_factor.num = dsf->num; - mr_cfg.mr_down_sampling_factor.den = dsf->den; - - /* Force Key-frame synchronization. Namely, encoder at higher - * resolution always use the same frame_type chosen by the - * lowest-resolution encoder. - */ - if (mr_cfg.mr_encoder_id) cfg->kf_mode = VPX_KF_DISABLED; - - ctx->iface = iface; - ctx->name = iface->name; - ctx->priv = NULL; - ctx->init_flags = flags; - ctx->config.enc = cfg; - res = ctx->iface->init(ctx, &mr_cfg); - if (res) { const char *error_detail = ctx->priv ? ctx->priv->err_detail : NULL; /* Destroy current ctx */ @@ -124,10 +126,14 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver( vpx_codec_destroy(ctx); i--; } +#if CONFIG_MULTI_RES_ENCODING + assert(mem_loc); + free(((LOWER_RES_FRAME_INFO *)mem_loc)->mb_info); + free(mem_loc); +#endif + return SAVE_STATUS(ctx, res); } - if (res) break; - ctx++; cfg++; dsf++; From 81d66e2cc6ca895051f51373b540a842b888df9e Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 23 Jan 2018 13:01:23 -0800 Subject: [PATCH 6/7] vpx_codec_enc_init_multi: fix segfault w/vp9 vp9 does not support multi-res encoding, the request should not crash. + encode_api_test: unconditionally expose multi-res test vpx_codec_enc_init_multi should fail independent of CONFIG_MULTI_RES_ENCODING if not for the same reason. Change-Id: I44fc58ef70ee4e0e482cb6a5736885f4cb2a8517 (cherry picked from commit 004fb91416e355986dc098883791becf39ffc1f7) --- test/encode_api_test.cc | 118 ++++++++++++++++++++++------------------ vpx/src/vpx_encoder.c | 2 + 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc index 13de53464..87e29b61d 100644 --- a/test/encode_api_test.cc +++ b/test/encode_api_test.cc @@ -106,76 +106,90 @@ TEST(EncodeAPI, ImageSizeSetting) { } #endif -#if CONFIG_MULTI_RES_ENCODING // Set up 2 spatial streams with 2 temporal layers per stream, and generate // invalid configuration by setting the temporal layer rate allocation -// (ts_target_bitrate[]) to 0 for both layers. -TEST(EncodeAPI, VP8MultiResEncode) { +// (ts_target_bitrate[]) to 0 for both layers. This should fail independent of +// CONFIG_MULTI_RES_ENCODING. +TEST(EncodeAPI, MultiResEncode) { + static const vpx_codec_iface_t *kCodecs[] = { +#if CONFIG_VP8_ENCODER + &vpx_codec_vp8_cx_algo, +#endif +#if CONFIG_VP9_ENCODER + &vpx_codec_vp9_cx_algo, +#endif + }; const int width = 1280; const int height = 720; const int width_down = width / 2; const int height_down = height / 2; const int target_bitrate = 1000; const int framerate = 30; - vpx_codec_ctx_t enc[2]; - vpx_codec_enc_cfg_t cfg[2]; - vpx_rational_t dsf[2] = { { 2, 1 }, { 2, 1 } }; - memset(enc, 0, sizeof(enc)); + for (int c = 0; c < NELEMENTS(kCodecs); ++c) { + const vpx_codec_iface_t *const iface = kCodecs[c]; + vpx_codec_ctx_t enc[2]; + vpx_codec_enc_cfg_t cfg[2]; + vpx_rational_t dsf[2] = { { 2, 1 }, { 2, 1 } }; - for (int i = 0; i < 2; i++) { - vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &cfg[i], 0); - } + memset(enc, 0, sizeof(enc)); - /* Highest-resolution encoder settings */ - cfg[0].g_w = width; - cfg[0].g_h = height; - cfg[0].rc_dropframe_thresh = 0; - cfg[0].rc_end_usage = VPX_CBR; - cfg[0].rc_resize_allowed = 0; - cfg[0].rc_min_quantizer = 2; - cfg[0].rc_max_quantizer = 56; - cfg[0].rc_undershoot_pct = 100; - cfg[0].rc_overshoot_pct = 15; - cfg[0].rc_buf_initial_sz = 500; - cfg[0].rc_buf_optimal_sz = 600; - cfg[0].rc_buf_sz = 1000; - cfg[0].g_error_resilient = 1; /* Enable error resilient mode */ - cfg[0].g_lag_in_frames = 0; + for (int i = 0; i < 2; i++) { + vpx_codec_enc_config_default(iface, &cfg[i], 0); + } - cfg[0].kf_mode = VPX_KF_AUTO; - cfg[0].kf_min_dist = 3000; - cfg[0].kf_max_dist = 3000; + /* Highest-resolution encoder settings */ + cfg[0].g_w = width; + cfg[0].g_h = height; + cfg[0].rc_dropframe_thresh = 0; + cfg[0].rc_end_usage = VPX_CBR; + cfg[0].rc_resize_allowed = 0; + cfg[0].rc_min_quantizer = 2; + cfg[0].rc_max_quantizer = 56; + cfg[0].rc_undershoot_pct = 100; + cfg[0].rc_overshoot_pct = 15; + cfg[0].rc_buf_initial_sz = 500; + cfg[0].rc_buf_optimal_sz = 600; + cfg[0].rc_buf_sz = 1000; + cfg[0].g_error_resilient = 1; /* Enable error resilient mode */ + cfg[0].g_lag_in_frames = 0; - cfg[0].rc_target_bitrate = target_bitrate; /* Set target bitrate */ - cfg[0].g_timebase.num = 1; /* Set fps */ - cfg[0].g_timebase.den = framerate; + cfg[0].kf_mode = VPX_KF_AUTO; + cfg[0].kf_min_dist = 3000; + cfg[0].kf_max_dist = 3000; - memcpy(&cfg[1], &cfg[0], sizeof(cfg[0])); - cfg[1].rc_target_bitrate = 500; - cfg[1].g_w = width_down; - cfg[1].g_h = height_down; + cfg[0].rc_target_bitrate = target_bitrate; /* Set target bitrate */ + cfg[0].g_timebase.num = 1; /* Set fps */ + cfg[0].g_timebase.den = framerate; - for (int i = 0; i < 2; i++) { - cfg[i].ts_number_layers = 2; - cfg[i].ts_periodicity = 2; - cfg[i].ts_rate_decimator[0] = 2; - cfg[i].ts_rate_decimator[1] = 1; - cfg[i].ts_layer_id[0] = 0; - cfg[i].ts_layer_id[1] = 1; - // Invalid parameters. - cfg[i].ts_target_bitrate[0] = 0; - cfg[i].ts_target_bitrate[1] = 0; - } + memcpy(&cfg[1], &cfg[0], sizeof(cfg[0])); + cfg[1].rc_target_bitrate = 500; + cfg[1].g_w = width_down; + cfg[1].g_h = height_down; - EXPECT_EQ(VPX_CODEC_INVALID_PARAM, - vpx_codec_enc_init_multi(&enc[0], vpx_codec_vp8_cx(), &cfg[0], 2, 0, - &dsf[0])); + for (int i = 0; i < 2; i++) { + cfg[i].ts_number_layers = 2; + cfg[i].ts_periodicity = 2; + cfg[i].ts_rate_decimator[0] = 2; + cfg[i].ts_rate_decimator[1] = 1; + cfg[i].ts_layer_id[0] = 0; + cfg[i].ts_layer_id[1] = 1; + // Invalid parameters. + cfg[i].ts_target_bitrate[0] = 0; + cfg[i].ts_target_bitrate[1] = 0; + } - for (int i = 0; i < 2; i++) { - vpx_codec_destroy(&enc[i]); + // VP9 should report incapable, VP8 invalid for all configurations. + const char kVP9Name[] = "WebM Project VP9"; + const bool is_vp9 = strncmp(kVP9Name, vpx_codec_iface_name(iface), + sizeof(kVP9Name) - 1) == 0; + EXPECT_EQ(is_vp9 ? VPX_CODEC_INCAPABLE : VPX_CODEC_INVALID_PARAM, + vpx_codec_enc_init_multi(&enc[0], iface, &cfg[0], 2, 0, &dsf[0])); + + for (int i = 0; i < 2; i++) { + vpx_codec_destroy(&enc[i]); + } } } -#endif } // namespace diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c index a26204bc4..1cf2dca69 100644 --- a/vpx/src/vpx_encoder.c +++ b/vpx/src/vpx_encoder.c @@ -84,6 +84,8 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver( int i; void *mem_loc = NULL; + if (iface->enc.mr_get_mem_loc == NULL) return VPX_CODEC_INCAPABLE; + if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) { for (i = 0; i < num_enc; i++) { vpx_codec_priv_enc_mr_cfg_t mr_cfg; From f80be22a1099b2a431c2796f529bb261064ec6b4 Mon Sep 17 00:00:00 2001 From: Johann Date: Thu, 4 Jan 2018 10:54:28 -0800 Subject: [PATCH 7/7] Release 1.7.0 Mandarin Duck Change-Id: I186440f3643a85694f45400393efb661f6d012fc --- .mailmap | 4 ++++ AUTHORS | 16 ++++++++++++++-- CHANGELOG | 25 +++++++++++++++++++++++++ README | 4 +++- libs.mk | 4 ++-- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/.mailmap b/.mailmap index 166c45ee8..29af51065 100644 --- a/.mailmap +++ b/.mailmap @@ -3,6 +3,7 @@ Aℓex Converse Aℓex Converse Alexis Ballier Alpha Lam +Chris Cunningham Daniele Castagna Deb Mukherjee Erik Niemeyer @@ -21,18 +22,21 @@ Marco Paniconi Marco Paniconi Pascal Massimino Paul Wilkins +Peter Boström Peter de Rivaz Peter de Rivaz Ralph Giles Ralph Giles Ronald S. Bultje Sami Pietilä +Shiyou Yin Tamar Levy Tamar Levy Tero Rintaluoma Timothy B. Terriberry Tom Finegan Tom Finegan +Urvang Joshi Yaowu Xu Yaowu Xu Yaowu Xu diff --git a/AUTHORS b/AUTHORS index fc2ef8f43..04c287243 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,13 +3,13 @@ Aaron Watry Abo Talib Mahfoodh -Adam Xu Adrian Grange Aℓex Converse Ahmad Sharif Aleksey Vasenev Alexander Potapenko Alexander Voronov +Alexandra Hájková Alexis Ballier Alok Ahuja Alpha Lam @@ -17,6 +17,7 @@ A.Mahfoodh Ami Fischman Andoni Morales Alastruey Andres Mejia +Andrew Lewis Andrew Russell Angie Chiang Aron Rosenberg @@ -24,7 +25,9 @@ Attila Nagy Brion Vibber changjun.yang Charles 'Buck' Krasic +Cheng Chen chm +Chris Cunningham Christian Duvivier Daniele Castagna Daniel Kang @@ -46,10 +49,12 @@ Geza Lore Ghislain MARY Giuseppe Scrivano Gordana Cmiljanovic +Gregor Jasny Guillaume Martres Guillermo Ballester Valor Hangyu Kuang Hanno Böck +Han Shen Henrik Lundin Hui Su Ivan Krasin @@ -83,6 +88,7 @@ Justin Clift Justin Lebar Kaustubh Raste KO Myung-Hun +Kyle Siefring Lawrence Velázquez Linfeng Zhang Lou Quillio @@ -101,6 +107,7 @@ Mikhal Shemer Min Chen Minghai Shang Min Ye +Moriyoshi Koizumi Morton Jonuschat Nathan E. Egge Nico Weber @@ -111,12 +118,15 @@ Paul Wilkins Pavol Rusnak Paweł Hajdan Pengchong Jin -Peter Boström +Peter Boström +Peter Collingbourne Peter de Rivaz Philip Jägenstedt Priit Laes Rafael Ávila de Espíndola Rafaël Carré +Rafael de Lucena Valle +Rahul Chaudhry Ralph Giles Ranjit Kumar Tulabandu Rob Bradford @@ -135,6 +145,7 @@ Shiyou Yin Shunyao Li Stefan Holmer Suman Sunkara +Sylvestre Ledru Taekhyun Kim Takanori MATSUURA Tamar Levy @@ -147,6 +158,7 @@ Tom Finegan Tristan Matthews Urvang Joshi Vignesh Venkatasubramanian +Vlad Tsyrklevich Yaowu Xu Yi Luo Yongzhe Wang diff --git a/CHANGELOG b/CHANGELOG index 7e7aec67a..2281394c8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,28 @@ +2017-01-04 v1.7.0 "Mandarin Duck" + This release focused on high bit depth performance (10/12 bit) and vp9 + encoding improvements. + + - Upgrading: + This release is ABI incompatible due to new vp9 encoder features. + + Frame parallel decoding for vp9 has been removed. + + - Enhancements: + vp9 encoding supports additional threads with --row-mt. This can be greater + than the number of tiles. + + Two new vp9 encoder options have been added: + --corpus-complexity + --tune-content=film + + Additional tooling for respecting the vp9 "level" profiles has been added. + + - Bug fixes: + A variety of fuzzing issues. + vp8 threading fix for ARM. + Codec control VP9_SET_SKIP_LOOP_FILTER fixed. + Reject invalid multi resolution configurations. + 2017-01-09 v1.6.1 "Long Tailed Duck" This release improves upon the VP9 encoder and speeds up the encoding and decoding processes. diff --git a/README b/README index f910ce761..73304dd62 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README - 26 January 2017 +README - 24 January 2018 Welcome to the WebM VP8/VP9 Codec SDK! @@ -63,6 +63,8 @@ COMPILING THE APPLICATIONS/LIBRARIES: armv8-linux-gcc mips32-linux-gcc mips64-linux-gcc + ppc64-linux-gcc + ppc64le-linux-gcc sparc-solaris-gcc x86-android-gcc x86-darwin8-gcc diff --git a/libs.mk b/libs.mk index ba75b4a4f..a3e2f9d0e 100644 --- a/libs.mk +++ b/libs.mk @@ -233,8 +233,8 @@ OBJS-yes += $(LIBVPX_OBJS) LIBS-$(if yes,$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS) -SO_VERSION_MAJOR := 4 -SO_VERSION_MINOR := 1 +SO_VERSION_MAJOR := 5 +SO_VERSION_MINOR := 0 SO_VERSION_PATCH := 0 ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS)) LIBVPX_SO := libvpx.$(SO_VERSION_MAJOR).dylib