Skip to content

Commit 3383144

Browse files
committed
vp9: Fixes for CONFIG_REALTIME_ONLY
For CONFIG_REALTIME_ONLY build the speed setting is clamped to 5 (done in both the default config and in the control for setting the speed/cpu_used), but for !CONFIG_REALTIME_ONLY and realtime encoding (VPX_DL_REALTIME) the speed is not clamped and can be set down to speeds < 5. Fix this by adding the clamp in pick_quickcompress_mode() where the REALTIME mode is set. Fix the kCpuUsedVectors[] in vp9_end_to_end_test.cc, as the psnr thresholds (kPsnrThreshold[cpu_used_][encoding_mode_]) for the tests are set based on these cpu_used settings, and this was causing failures for CONFIG_REALTIME_ONLY (which was encoding with speed 5 but using psnr-thresholds set for speed < 5). And fix the threshold for the ResizeCspWorks test to make it pass at speed 5. Bug: 454987857 Change-Id: I1669da872ac42b65b8a2fc3a6e2d795e54e33d8a
1 parent b0be221 commit 3383144

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

test/resize_test.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,9 @@ class ResizeCspTest : public ResizeTest {
773773

774774
void PreEncodeFrameHook(libvpx_test::VideoSource *video,
775775
libvpx_test::Encoder *encoder) override {
776+
if (video->frame() == 0) {
777+
encoder->Control(VP8E_SET_CPUUSED, 5);
778+
}
776779
if (CspForFrameNumber(video->frame()) != VPX_IMG_FMT_I420 &&
777780
cfg_.g_profile != 1) {
778781
cfg_.g_profile = 1;
@@ -787,7 +790,7 @@ class ResizeCspTest : public ResizeTest {
787790

788791
void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
789792
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
790-
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
793+
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 3.5);
791794
}
792795

793796
#if WRITE_COMPRESSED_STREAM

test/vp9_end_to_end_test.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ const libvpx_test::TestMode kEncodingModeVectors[] = {
7777
};
7878

7979
// Speed settings tested
80+
#if CONFIG_REALTIME_ONLY
81+
const int kCpuUsedVectors[] = { 5, 6, 7 };
82+
#else
8083
const int kCpuUsedVectors[] = { 1, 2, 3, 5, 6, 7 };
84+
#endif
8185

8286
int is_extension_y4m(const char *filename) {
8387
const char *dot = strrchr(filename, '.');

vp9/vp9_cx_iface.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ static vpx_codec_err_t pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
12201220
if (deadline == VPX_DL_REALTIME) {
12211221
ctx->oxcf.pass = 0;
12221222
new_mode = REALTIME;
1223+
ctx->oxcf.speed = VPXMAX(ctx->oxcf.speed, 5);
12231224
}
12241225

12251226
if (ctx->oxcf.mode != new_mode) {

0 commit comments

Comments
 (0)