Merge "faster vp8_regular_quantize_b_sse4_1" into main
diff --git a/build/make/configure.sh b/build/make/configure.sh
index 81d30a1..b24e79a 100644
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -774,7 +774,7 @@
tgt_isa=x86_64
tgt_os=`echo $gcctarget | sed 's/.*\(darwin1[0-9]\).*/\1/'`
;;
- *darwin20*)
+ *darwin2[0-1]*)
tgt_isa=`uname -m`
tgt_os=`echo $gcctarget | sed 's/.*\(darwin2[0-9]\).*/\1/'`
;;
@@ -918,9 +918,9 @@
add_cflags "-mmacosx-version-min=10.15"
add_ldflags "-mmacosx-version-min=10.15"
;;
- *-darwin20-*)
- add_cflags "-mmacosx-version-min=10.16 -arch ${toolchain%%-*}"
- add_ldflags "-mmacosx-version-min=10.16 -arch ${toolchain%%-*}"
+ *-darwin2[0-1]-*)
+ add_cflags "-arch ${toolchain%%-*}"
+ add_ldflags "-arch ${toolchain%%-*}"
;;
*-iphonesimulator-*)
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
diff --git a/configure b/configure
index e3babbe..d39db6c 100755
--- a/configure
+++ b/configure
@@ -100,6 +100,7 @@
all_platforms="${all_platforms} arm64-android-gcc"
all_platforms="${all_platforms} arm64-darwin-gcc"
all_platforms="${all_platforms} arm64-darwin20-gcc"
+all_platforms="${all_platforms} arm64-darwin21-gcc"
all_platforms="${all_platforms} arm64-linux-gcc"
all_platforms="${all_platforms} arm64-win64-gcc"
all_platforms="${all_platforms} arm64-win64-vs15"
@@ -152,6 +153,7 @@
all_platforms="${all_platforms} x86_64-darwin18-gcc"
all_platforms="${all_platforms} x86_64-darwin19-gcc"
all_platforms="${all_platforms} x86_64-darwin20-gcc"
+all_platforms="${all_platforms} x86_64-darwin21-gcc"
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
all_platforms="${all_platforms} x86_64-linux-gcc"
all_platforms="${all_platforms} x86_64-linux-icc"
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc
index dec19b2..6f940b6 100644
--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -19,7 +19,14 @@
namespace {
-#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
+const vpx_codec_iface_t *kCodecIfaces[] = {
+#if CONFIG_VP8_ENCODER
+ &vpx_codec_vp8_cx_algo,
+#endif
+#if CONFIG_VP9_ENCODER
+ &vpx_codec_vp9_cx_algo,
+#endif
+};
bool IsVP9(const vpx_codec_iface_t *iface) {
static const char kVP9Name[] = "WebM Project VP9";
@@ -28,14 +35,6 @@
}
TEST(EncodeAPI, InvalidParams) {
- 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
- };
uint8_t buf[1] = { 0 };
vpx_image_t img;
vpx_codec_ctx_t enc;
@@ -58,17 +57,17 @@
vpx_codec_enc_config_default(nullptr, &cfg, 0));
EXPECT_NE(vpx_codec_error(nullptr), nullptr);
- for (int i = 0; i < NELEMENTS(kCodecs); ++i) {
- SCOPED_TRACE(vpx_codec_iface_name(kCodecs[i]));
+ for (const auto *iface : kCodecIfaces) {
+ SCOPED_TRACE(vpx_codec_iface_name(iface));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
- vpx_codec_enc_init(nullptr, kCodecs[i], nullptr, 0));
+ vpx_codec_enc_init(nullptr, iface, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
- vpx_codec_enc_init(&enc, kCodecs[i], nullptr, 0));
+ vpx_codec_enc_init(&enc, iface, nullptr, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
- vpx_codec_enc_config_default(kCodecs[i], &cfg, 1));
+ vpx_codec_enc_config_default(iface, &cfg, 1));
- EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(kCodecs[i], &cfg, 0));
- EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_init(&enc, kCodecs[i], &cfg, 0));
+ EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(iface, &cfg, 0));
+ EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_init(&enc, iface, &cfg, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_encode(&enc, nullptr, 0, 0, 0, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&enc));
@@ -124,14 +123,6 @@
// (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;
@@ -139,8 +130,7 @@
const int target_bitrate = 1000;
const int framerate = 30;
- for (int c = 0; c < NELEMENTS(kCodecs); ++c) {
- const vpx_codec_iface_t *const iface = kCodecs[c];
+ for (const auto *iface : kCodecIfaces) {
vpx_codec_ctx_t enc[2];
vpx_codec_enc_cfg_t cfg[2];
vpx_rational_t dsf[2] = { { 2, 1 }, { 2, 1 } };
diff --git a/test/video_source.h b/test/video_source.h
index 2ba3f64..7a2dbe7 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -191,6 +191,7 @@
void ReallocImage() {
vpx_img_free(img_);
img_ = vpx_img_alloc(NULL, format_, width_, height_, 32);
+ ASSERT_NE(img_, nullptr);
raw_sz_ = ((img_->w + 31) & ~31u) * img_->h * img_->bps / 8;
}
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index e38464c..ac34611 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -223,9 +223,10 @@
if (target > rc->max_frame_bandwidth) target = rc->max_frame_bandwidth;
if (oxcf->rc_max_inter_bitrate_pct) {
- const int max_rate =
- rc->avg_frame_bandwidth * oxcf->rc_max_inter_bitrate_pct / 100;
- target = VPXMIN(target, max_rate);
+ const int64_t max_rate =
+ (int64_t)rc->avg_frame_bandwidth * oxcf->rc_max_inter_bitrate_pct / 100;
+ // target is of type int and VPXMIN cannot evaluate to larger than target
+ target = (int)VPXMIN(target, max_rate);
}
return target;
}
@@ -234,9 +235,9 @@
const RATE_CONTROL *rc = &cpi->rc;
const VP9EncoderConfig *oxcf = &cpi->oxcf;
if (oxcf->rc_max_intra_bitrate_pct) {
- const int max_rate =
- rc->avg_frame_bandwidth * oxcf->rc_max_intra_bitrate_pct / 100;
- target = VPXMIN(target, max_rate);
+ const int64_t max_rate =
+ (int64_t)rc->avg_frame_bandwidth * oxcf->rc_max_intra_bitrate_pct / 100;
+ target = (int)VPXMIN(target, max_rate);
}
if (target > rc->max_frame_bandwidth) target = rc->max_frame_bandwidth;
return target;