media: cedrus: Use H264_SCALING_MATRIX only when required
Baseline, Main and Extended profiles are specified to not support a scaling matrix. Also, High profiles can optionally specify a scaling matrix, using SPS and PPS NAL units. To meet this expectation, applications are required to set the V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX control and set the V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT flag only when a scaling matrix is specified for a picture. Implement this on cedrus, which has hardware support for this case. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
e6de6b3fac
commit
b3a23db0e2
@ -76,7 +76,7 @@ static const struct cedrus_control cedrus_controls[] = {
|
|||||||
.id = V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX,
|
.id = V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX,
|
||||||
},
|
},
|
||||||
.codec = CEDRUS_CODEC_H264,
|
.codec = CEDRUS_CODEC_H264,
|
||||||
.required = true,
|
.required = false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cfg = {
|
.cfg = {
|
||||||
|
@ -238,8 +238,12 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx,
|
|||||||
{
|
{
|
||||||
const struct v4l2_ctrl_h264_scaling_matrix *scaling =
|
const struct v4l2_ctrl_h264_scaling_matrix *scaling =
|
||||||
run->h264.scaling_matrix;
|
run->h264.scaling_matrix;
|
||||||
|
const struct v4l2_ctrl_h264_pps *pps = run->h264.pps;
|
||||||
struct cedrus_dev *dev = ctx->dev;
|
struct cedrus_dev *dev = ctx->dev;
|
||||||
|
|
||||||
|
if (!(pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT))
|
||||||
|
return;
|
||||||
|
|
||||||
cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_8x8_0,
|
cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_8x8_0,
|
||||||
scaling->scaling_list_8x8[0],
|
scaling->scaling_list_8x8[0],
|
||||||
sizeof(scaling->scaling_list_8x8[0]));
|
sizeof(scaling->scaling_list_8x8[0]));
|
||||||
@ -442,6 +446,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
|||||||
reg |= (pps->second_chroma_qp_index_offset & 0x3f) << 16;
|
reg |= (pps->second_chroma_qp_index_offset & 0x3f) << 16;
|
||||||
reg |= (pps->chroma_qp_index_offset & 0x3f) << 8;
|
reg |= (pps->chroma_qp_index_offset & 0x3f) << 8;
|
||||||
reg |= (pps->pic_init_qp_minus26 + 26 + slice->slice_qp_delta) & 0x3f;
|
reg |= (pps->pic_init_qp_minus26 + 26 + slice->slice_qp_delta) & 0x3f;
|
||||||
|
if (pps->flags & V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT)
|
||||||
|
reg |= VE_H264_SHS_QP_SCALING_MATRIX_DEFAULT;
|
||||||
cedrus_write(dev, VE_H264_SHS_QP, reg);
|
cedrus_write(dev, VE_H264_SHS_QP, reg);
|
||||||
|
|
||||||
// clear status flags
|
// clear status flags
|
||||||
|
Loading…
x
Reference in New Issue
Block a user