Skip to content

Commit

Permalink
WIP: media: rkvdec: h264: return early when no reference pictures
Browse files Browse the repository at this point in the history
NOTE: also change from a switch statement to access reflists from a pointer array,
should simplify once we add support for field reference list

Signed-off-by: Jonas Karlman <[email protected]>
  • Loading branch information
Kwiboo authored and sigmaris committed Aug 3, 2020
1 parent 6c28dce commit 6ab4708
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions drivers/staging/media/rkvdec/rkvdec-h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,13 +734,17 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx,
const struct v4l2_ctrl_h264_sps *sps = run->sps;
struct rkvdec_h264_priv_tbl *priv_tbl = h264_ctx->priv_tbl.cpu;
u32 max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4);
u8 *reflists[3] = { h264_ctx->reflists.p, h264_ctx->reflists.b0, h264_ctx->reflists.b1 };

u32 *hw_rps = priv_tbl->rps;
u32 i, j;
u16 *p = (u16 *)hw_rps;

memset(hw_rps, 0, sizeof(priv_tbl->rps));

if (!h264_ctx->reflists.num_valid)
return;

/*
* Assign an invalid pic_num if DPB entry at that position is inactive.
* If we assign 0 in that position hardware will treat that as a real
Expand All @@ -763,19 +767,7 @@ static void assemble_hw_rps(struct rkvdec_ctx *ctx,
for (j = 0; j < RKVDEC_NUM_REFLIST; j++) {
for (i = 0; i < h264_ctx->reflists.num_valid; i++) {
u8 dpb_valid = 0;
u8 idx = 0;

switch (j) {
case 0:
idx = h264_ctx->reflists.p[i];
break;
case 1:
idx = h264_ctx->reflists.b0[i];
break;
case 2:
idx = h264_ctx->reflists.b1[i];
break;
}
u8 idx = reflists[j][i];

if (idx >= ARRAY_SIZE(dec_params->dpb))
continue;
Expand Down

0 comments on commit 6ab4708

Please sign in to comment.