Update frame size in actual encoding
authorCheng Chen <chengchen@google.com>
Mon, 4 Dec 2023 23:34:50 +0000 (15:34 -0800)
committerWan-Teh Chang <wtc@google.com>
Fri, 8 Dec 2023 21:34:57 +0000 (21:34 +0000)
commit6bb806b177b133edde6be45fadfa3e0d453376f3
treea0fa3535e0b4421cd63a544f295dff3daf8cbd55
parent75d7727f58ddf751b4333a4df94cab1fd920a35c
Update frame size in actual encoding

Issue explanation:
The unit test calls set_config function twice after encoding the
first frame.
The first call of set_config reduces frame width, but is still within
half of the first frame.
The second call reduces frame width even more, making is less than
half of the first frame, which according to the encoder logic,
there is no valid ref frames, and this frame should be set as a
forced keyframe. This leads to null pointer access in scale_factors
later.

Solution:
To make sure the correct detection of a forced key frame,
we need to update the frame width and height only when the actual
encoding is performed.

Bug: b/311985118

Change-Id: Ie2cd3b760d4a4b399845693d7421c4eb11a12775
(cherry picked from commit 1ed56a46b3f6b18e1fb89a091e60d80ae20eec01)
test/encode_api_test.cc
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h
vp9/vp9_cx_iface.c