media: cedrus: h265: Fix logic for not low delay flag
Now that we know real purpose of "not low delay" flag, logic for applying this flag should be fixed too. According to vendor and reference implementation, low delay is signaled when POC of current frame is lower than POC of at least one reference of a slice. Implement mentioned logic and invert it to conform to flag meaning. Also don't apply flag for I frames. They don't have any reference. This fixes decoding of 3 reference bitstreams. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
104a70e1d0
commit
f1a413902a
@ -301,6 +301,31 @@ static void cedrus_h265_write_scaling_list(struct cedrus_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
static int cedrus_h265_is_low_delay(struct cedrus_run *run)
|
||||
{
|
||||
const struct v4l2_ctrl_hevc_slice_params *slice_params;
|
||||
const struct v4l2_hevc_dpb_entry *dpb;
|
||||
s32 poc;
|
||||
int i;
|
||||
|
||||
slice_params = run->h265.slice_params;
|
||||
poc = run->h265.decode_params->pic_order_cnt_val;
|
||||
dpb = run->h265.decode_params->dpb;
|
||||
|
||||
for (i = 0; i < slice_params->num_ref_idx_l0_active_minus1 + 1; i++)
|
||||
if (dpb[slice_params->ref_idx_l0[i]].pic_order_cnt_val > poc)
|
||||
return 1;
|
||||
|
||||
if (slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_B)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < slice_params->num_ref_idx_l1_active_minus1 + 1; i++)
|
||||
if (dpb[slice_params->ref_idx_l1[i]].pic_order_cnt_val > poc)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
struct cedrus_run *run)
|
||||
{
|
||||
@ -588,7 +613,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED,
|
||||
slice_params->flags);
|
||||
|
||||
if (decode_params->num_poc_st_curr_after == 0)
|
||||
if (slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_I && !cedrus_h265_is_low_delay(run))
|
||||
reg |= VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY;
|
||||
|
||||
cedrus_write(dev, VE_DEC_H265_DEC_SLICE_HDR_INFO1, reg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user