Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H.264 320x240 encode produces a duplicate frame #541

Open
edwarddavidbaker opened this issue Oct 28, 2021 · 1 comment
Open

H.264 320x240 encode produces a duplicate frame #541

edwarddavidbaker opened this issue Oct 28, 2021 · 1 comment

Comments

@edwarddavidbaker
Copy link
Contributor

Hi all, Recently I've been investigating an issue on GLK where H.264 encode at 320x240 produces a duplicate frame. Specifically VAProfileH264ConstrainedBaseline VAEntrypointEncSlice CBR with the quality level set to 7 and a target bitrate of 400,000 bps.

/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests \
    --codec=h264 \
    --bitrate=400000 \
    --output_bitstream  \
    --gtest_filter=*FlushAtEndOfStream football_320x240.yv12.yuv

The issue is that all of the macroblocks for the 3rd picture are skip, which results in a duplicate picture 2. If I set the quality level to the default (4), the issue is not present. I searched for all variables which the quality level indexes into. I then trimmed the possibilities to every list where the values in 4 and 7 do not match. Then for each variable I set the value at preset 7 to the value in preset 4. The result from each test is in the "Fix?" column.

                                                  Fix?  Col 0  Col 1  Col 2  Col 3  Col 4  Col 5   Col 6   Col 7
gen9_avc_all_fractional[PRESET_NUM]                 No      0      3      3      3      3      3       3       0
gen9_avc_b_me_method[PRESET_NUM]                    No      0      4      4      6      6      6       6       4
gen9_avc_b_search_x[PRESET_NUM]                     No      0     32     32     32     32      32      32     24
gen9_avc_b_search_y[PRESET_NUM]                     No      0     32     32     32     32      32      32     24
gen9_avc_enable_adaptive_search[PRESET_NUM]         No      0      1      1      1      1      1       0       0
gen9_avc_enable_adaptive_tx_decision[PRESET_NUM]    No      0      1      1      1      1      1       1       0
gen9_avc_kernel_mode[PRESET_NUM]                    No      1      0      0      1      1      1       1       2
gen9_avc_max_b_ref_id0[PRESET_NUM]                  No      0      3      3      1      1      1       0       0
gen9_avc_max_ftq_based_skip[PRESET_NUM]             No      0      3      3      3      3      3       3       0
gen9_avc_max_len_sp[PRESET_NUM]                     No      0     57     57     25     25     25      16       9
gen9_avc_max_ref_id0_progressive_4k[PRESET_NUM]     No      0      3      3      2      2      2       0       0
gen9_avc_max_ref_id0[PRESET_NUM]                    No      0      7      5      2      2      2       0       0
gen9_avc_max_ref_id1[PRESET_NUM]                    No      0      1      1      1      1      1       0       0
gen9_avc_p_me_method[PRESET_NUM]                    No      0      4      4      6      6      6       6       4
gen9_avc_search_x[PRESET_NUM]                      Yes      0     48     48     48     48     48      48      28
gen9_avc_search_y[PRESET_NUM]                      Yes      0     40     40     40     40     40      40      28
gen9_avc_super_combine_dist[PRESET_NUM]             No      0      1      1      5      5      5       9       9
gen9_avc_ultra_hme[PRESET_NUM]                      No      0      1      1      1      1      1       1       0

Forcing gen9_avc_search x and y for preset 7 to the values in preset 4 seems to fix this issue.

diff --git a/src/i965_avc_const_def.c b/src/i965_avc_const_def.c
index 34d0335..f68d6d6 100644
--- a/src/i965_avc_const_def.c
+++ b/src/i965_avc_const_def.c
@@ -1022,10 +1022,10 @@ const unsigned int gen9_avc_hme_combine_len[PRESET_NUM] = {
 };
 
 const unsigned int gen9_avc_search_x[PRESET_NUM] = {
-    0, 48, 48, 48, 48, 48, 48, 28
+    0, 48, 48, 48, 48, 48, 48, 48
 };
 const unsigned int gen9_avc_search_y[PRESET_NUM] = {
-    0, 40, 40, 40, 40, 40, 40, 28
+    0, 40, 40, 40, 40, 40, 40, 40
 };
edwarddavidbaker added a commit to edwarddavidbaker/intel-vaapi-driver that referenced this issue Oct 28, 2021
This commit forces the values in preset 7 to the same values as preset
index 4. Fixes intel#541.
@edwarddavidbaker
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant