]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: qcom: iris: Simplify COMV size calculation
authorWangao Wang <wangao.wang@oss.qualcomm.com>
Tue, 12 May 2026 08:55:15 +0000 (16:55 +0800)
committerBryan O'Donoghue <bod@kernel.org>
Sat, 30 May 2026 07:41:48 +0000 (08:41 +0100)
Unify AVC/HEVC handling by computing codec and lcu_size upfront.

Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
drivers/media/platform/qcom/iris/iris_vpu_buffer.c

index c2cd4adc082394a9ab6f32a37fe4e57678019d89..f55db869fee4d64273763fd3f98d286f58e2e7b1 100644 (file)
@@ -1014,16 +1014,13 @@ static u32 iris_vpu_enc_comv_size(struct iris_inst *inst)
        u32 height = iris_vpu_enc_get_bitstream_height(inst);
        u32 width = iris_vpu_enc_get_bitstream_width(inst);
        u32 num_recon = hfi_buffer_get_recon_count(inst);
-       u32 lcu_size = 16;
+       u32 codec, lcu_size;
 
-       if (inst->codec == V4L2_PIX_FMT_HEVC) {
-               lcu_size = 32;
-               return hfi_buffer_comv_enc(width, height, lcu_size,
-                                          num_recon + 1, HFI_CODEC_ENCODE_HEVC);
-       }
+       codec = (inst->codec == V4L2_PIX_FMT_HEVC) ?
+               HFI_CODEC_ENCODE_HEVC : HFI_CODEC_ENCODE_AVC;
+       lcu_size = (inst->codec == V4L2_PIX_FMT_HEVC) ? 32 : 16;
 
-       return hfi_buffer_comv_enc(width, height, lcu_size,
-                                  num_recon + 1, HFI_CODEC_ENCODE_AVC);
+       return hfi_buffer_comv_enc(width, height, lcu_size, num_recon + 1, codec);
 }
 
 static inline