Procházet zdrojové kódy

video: driver: Add support to set AV1 bitstream format

Add support to set AV1 decoder bitstream format
(low-overhead or Annex-B).

Change-Id: Ie36eefe0488bf33af91802c0bee51b3fec2024ac
Signed-off-by: Mihir Ganu <[email protected]>
Mihir Ganu před 3 roky
rodič
revize
a723e35a03

+ 6 - 0
driver/platform/kalama/src/msm_vidc_kalama.c

@@ -347,6 +347,12 @@ static struct msm_platform_inst_capability instance_data_kalama[] = {
 		{0}, {0},
 		NULL, msm_vidc_set_nal_length},
 
+	{WITHOUT_STARTCODE, DEC, AV1,
+		V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_DISABLE,
+		1, V4L2_MPEG_MSM_VIDC_DISABLE,
+		V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE,
+		HFI_PROP_NAL_LENGTH_FIELD},
+
 	{NAL_LENGTH_FIELD, ENC, CODECS_ALL,
 		V4L2_MPEG_VIDEO_HEVC_SIZE_0,
 		V4L2_MPEG_VIDEO_HEVC_SIZE_4,

+ 36 - 0
driver/vidc/src/msm_vdec.c

@@ -796,6 +796,38 @@ static int msm_vdec_set_host_max_buf_count(struct msm_vidc_inst *inst,
 	return 0;
 }
 
+static int msm_vdec_set_av1_bitstream_format(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 annex_b;
+
+	if (inst->codec != MSM_VIDC_AV1)
+		return 0;
+
+	if (inst->capabilities->cap[WITHOUT_STARTCODE].value) {
+		i_vpr_e(inst,
+			"%s: Annex-B format is not supported\n", __func__);
+		return -EINVAL;
+	}
+
+	annex_b = 0;
+	i_vpr_h(inst, "%s: annex_b: %u\n", __func__, annex_b);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_NAL_LENGTH_FIELD,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32,
+			&annex_b,
+			sizeof(u32));
+	if (rc) {
+		i_vpr_e(inst, "%s: set property failed\n", __func__);
+		return rc;
+	}
+
+	return rc;
+}
+
 static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
@@ -837,6 +869,10 @@ static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 	if (rc)
 		return rc;
 
+	rc = msm_vdec_set_av1_bitstream_format(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
 	return rc;
 }
 

+ 2 - 0
driver/vidc/src/msm_vidc_driver.c

@@ -156,6 +156,8 @@ static const struct msm_vidc_cap_name cap_name_arr[] = {
 	{QUALITY_MODE,                   "QUALITY_MODE"               },
 	{CODED_FRAMES,                   "CODED_FRAMES"               },
 	{BIT_DEPTH,                      "BIT_DEPTH"                  },
+	{FILM_GRAIN,                     "FILM_GRAIN"                 },
+	{SUPER_BLOCK,                    "SUPER_BLOCK"                },
 	{CODEC_CONFIG,                   "CODEC_CONFIG"               },
 	{BITSTREAM_SIZE_OVERWRITE,       "BITSTREAM_SIZE_OVERWRITE"   },
 	{THUMBNAIL_MODE,                 "THUMBNAIL_MODE"             },