mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 17:50:12 +01:00
radeon: Add cropping to encoded H.265 when padding is used
Because the VCN encoder needs the surface to be memory aligned, the resolution of the image passed to the encoder might be larger and have extra padding added - this change crops the resulting output to compensate for the extra padding that might have been added. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4559 Signed-off-by: Thong Thai <thong.thai@amd.com> Reviewed-by: Leo Liu <leo.liu@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10137>
This commit is contained in:
parent
77fdabdfa5
commit
e62c7e7c6c
2 changed files with 31 additions and 18 deletions
|
|
@ -404,8 +404,14 @@ static void radeon_enc_nalu_sps_hevc(struct radeon_encoder *enc)
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.crop_right);
|
radeon_enc_code_ue(enc, enc->enc_pic.crop_right);
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.crop_top);
|
radeon_enc_code_ue(enc, enc->enc_pic.crop_top);
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.crop_bottom);
|
radeon_enc_code_ue(enc, enc->enc_pic.crop_bottom);
|
||||||
|
} else if (enc->enc_pic.session_init.padding_width != 0 ||
|
||||||
|
enc->enc_pic.session_init.padding_height != 0) {
|
||||||
|
radeon_enc_code_fixed_bits(enc, 0x1, 1);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_width / 2);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_width / 2);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_height / 2);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_height / 2);
|
||||||
} else
|
} else
|
||||||
radeon_enc_code_fixed_bits(enc, 0x0, 1);
|
|
||||||
|
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.bit_depth_luma_minus8);
|
radeon_enc_code_ue(enc, enc->enc_pic.bit_depth_luma_minus8);
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.bit_depth_chroma_minus8);
|
radeon_enc_code_ue(enc, enc->enc_pic.bit_depth_chroma_minus8);
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,13 @@ static void radeon_enc_nalu_sps_hevc(struct radeon_encoder *enc)
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.crop_right);
|
radeon_enc_code_ue(enc, enc->enc_pic.crop_right);
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.crop_top);
|
radeon_enc_code_ue(enc, enc->enc_pic.crop_top);
|
||||||
radeon_enc_code_ue(enc, enc->enc_pic.crop_bottom);
|
radeon_enc_code_ue(enc, enc->enc_pic.crop_bottom);
|
||||||
|
} else if (enc->enc_pic.session_init.padding_width != 0 ||
|
||||||
|
enc->enc_pic.session_init.padding_height != 0) {
|
||||||
|
radeon_enc_code_fixed_bits(enc, 0x1, 1);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_width / 2);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_width / 2);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_height / 2);
|
||||||
|
radeon_enc_code_ue(enc, enc->enc_pic.session_init.padding_height / 2);
|
||||||
} else
|
} else
|
||||||
radeon_enc_code_fixed_bits(enc, 0x0, 1);
|
radeon_enc_code_fixed_bits(enc, 0x0, 1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue