From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-sunxi@googlegroups.com, Randy Li <ayaka@soulik.info>,
Hans Verkuil <hverkuil@xs4all.nl>,
Ezequiel Garcia <ezequiel@collabora.com>,
Tomasz Figa <tfiga@chromium.org>,
Alexandre Courbot <acourbot@chromium.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v2 2/2] media: cedrus: Add HEVC/H.265 decoding support
Date: Thu, 24 Jan 2019 14:10:25 +0100 [thread overview]
Message-ID: <4f25de5bbcb7bf196fe4925f54e3335b50670bd2.camel@bootlin.com> (raw)
In-Reply-To: <20181127082119.xdemdwgclai7kj3r@flea>
Hi,
On Tue, 2018-11-27 at 09:21 +0100, Maxime Ripard wrote:
> Hi!
>
> On Fri, Nov 23, 2018 at 02:02:09PM +0100, Paul Kocialkowski wrote:
> > This introduces support for HEVC/H.265 to the Cedrus VPU driver, with
> > both uni-directional and bi-directional prediction modes supported.
> >
> > Field-coded (interlaced) pictures, custom quantization matrices and
> > 10-bit output are not supported at this point.
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
>
> Output from checkpatch:
> total: 0 errors, 68 warnings, 14 checks, 999 lines checked
Looks like many of the "line over 80 chars" are due to macros. I don't
think it would be a good idea to break them down or to change the
macros names since they are directly inherited from the bitstream
elements.
What do you think?
> > +/*
> > + * Note: Neighbor info buffer size is apparently doubled for H6, which may be
> > + * related to 10 bit H265 support.
> > + */
> > +#define CEDRUS_H265_NEIGHBOR_INFO_BUF_SIZE (397 * SZ_1K)
> > +#define CEDRUS_H265_ENTRY_POINTS_BUF_SIZE (4 * SZ_1K)
> > +#define CEDRUS_H265_MV_COL_BUF_UNIT_CTB_SIZE 160
>
> Having some information on where this is coming from would be useful.
Yes, definitely.
> > +static void cedrus_h265_sram_write_data(struct cedrus_dev *dev, u32 *data,
>
> Since the data pointer is pretty much an opaque structure, you should
> have a void pointer here, that would avoid the type casting you're
> doing when calling that function.
Sure, that would make more sense.
[...]
> > + /* Output frame. */
> > +
> > + output_pic_list_index = V4L2_HEVC_DPB_ENTRIES_NUM_MAX;
> > + pic_order_cnt[0] = pic_order_cnt[1] = slice_params->slice_pic_order_cnt;
> > + mv_col_buf_addr[0] = cedrus_h265_frame_info_mv_col_buf_addr(ctx,
> > + run->dst->vb2_buf.index, 0) - PHYS_OFFSET;
> > + mv_col_buf_addr[1] = cedrus_h265_frame_info_mv_col_buf_addr(ctx,
> > + run->dst->vb2_buf.index, 1) - PHYS_OFFSET;
> > + dst_luma_addr = cedrus_dst_buf_addr(ctx, run->dst->vb2_buf.index, 0) -
> > + PHYS_OFFSET;
> > + dst_chroma_addr = cedrus_dst_buf_addr(ctx, run->dst->vb2_buf.index, 1) -
> > + PHYS_OFFSET;
> > +
> > + cedrus_h265_frame_info_write_single(dev, output_pic_list_index,
> > + slice_params->pic_struct != 0,
> > + pic_order_cnt, mv_col_buf_addr,
> > + dst_luma_addr, dst_chroma_addr);
>
> You can only pass the run and slice_params pointers to that function.
The point is to make it independent from the context, so that the same
function can be called with either the slice_params or the dpb info.
I don't think making two variants or even two wrappers would bring any
significant benefit.
> > +
> > + cedrus_write(dev, VE_DEC_H265_OUTPUT_FRAME_IDX, output_pic_list_index);
> > +
> > + /* Reference picture list 0 (for P/B frames). */
> > + if (slice_params->slice_type != V4L2_HEVC_SLICE_TYPE_I) {
> > + cedrus_h265_ref_pic_list_write(dev, slice_params->ref_idx_l0,
> > + slice_params->num_ref_idx_l0_active_minus1 + 1,
> > + slice_params->dpb, slice_params->num_active_dpb_entries,
> > + VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST0);
> > +
>
> slice_params is enough.
The rationale is similar to the one above: being able to use the same
helper with either L0 or L1, which implies passing the relevant
elements directly.
> > + if (pps->weighted_pred_flag || pps->weighted_bipred_flag)
> > + cedrus_h265_pred_weight_write(dev,
> > + pred_weight_table->delta_luma_weight_l0,
> > + pred_weight_table->luma_offset_l0,
> > + pred_weight_table->delta_chroma_weight_l0,
> > + pred_weight_table->chroma_offset_l0,
> > + slice_params->num_ref_idx_l0_active_minus1 + 1,
> > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_LUMA_L0,
> > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_CHROMA_L0);
>
> Ditto, that function should only take the pred_weight_table and
> slice_params pointers
And same rational as well.
> > + }
> > +
> > + /* Reference picture list 1 (for B frames). */
> > + if (slice_params->slice_type == V4L2_HEVC_SLICE_TYPE_B) {
> > + cedrus_h265_ref_pic_list_write(dev, slice_params->ref_idx_l1,
> > + slice_params->num_ref_idx_l1_active_minus1 + 1,
> > + slice_params->dpb,
> > + slice_params->num_active_dpb_entries,
> > + VE_DEC_H265_SRAM_OFFSET_REF_PIC_LIST1);
> > +
> > + if (pps->weighted_bipred_flag)
> > + cedrus_h265_pred_weight_write(dev,
> > + pred_weight_table->delta_luma_weight_l1,
> > + pred_weight_table->luma_offset_l1,
> > + pred_weight_table->delta_chroma_weight_l1,
> > + pred_weight_table->chroma_offset_l1,
> > + slice_params->num_ref_idx_l1_active_minus1 + 1,
> > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_LUMA_L1,
> > + VE_DEC_H265_SRAM_OFFSET_PRED_WEIGHT_CHROMA_L1);
> > + }
>
> Ditto
>
> Looks good otherwise, thanks!
Thanks for the review!
Cheers,
Paul
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-01-24 13:10 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 13:02 [PATCH v2 0/2] HEVC/H.265 stateless support for V4L2 and Cedrus Paul Kocialkowski
2018-11-23 13:02 ` [PATCH v2 1/2] media: v4l: Add definitions for the HEVC slice format and controls Paul Kocialkowski
2018-12-05 13:18 ` Hans Verkuil
2018-12-05 20:59 ` [linux-sunxi] " Jernej Škrabec
2018-12-12 12:51 ` Paul Kocialkowski
2019-01-07 3:49 ` Randy Li
2019-01-07 9:57 ` Paul Kocialkowski
2019-01-08 1:16 ` Ayaka
2019-01-08 8:38 ` Paul Kocialkowski
2019-01-08 10:00 ` Ayaka
2019-01-10 13:32 ` ayaka
2019-01-24 10:27 ` Paul Kocialkowski
2019-01-24 12:23 ` Ayaka
2019-01-25 13:04 ` Paul Kocialkowski
2019-01-29 7:44 ` Alexandre Courbot
2019-01-29 8:09 ` Maxime Ripard
2019-01-29 9:39 ` Tomasz Figa
2019-01-29 21:41 ` Nicolas Dufresne
2019-01-30 2:28 ` Alexandre Courbot
2019-01-30 3:35 ` Tomasz Figa
2019-01-30 6:27 ` Ayaka
2019-01-30 7:17 ` Tomasz Figa
2019-01-30 9:54 ` Ayaka
2019-01-30 7:57 ` Maxime Ripard
2019-01-30 7:03 ` Ayaka
2019-01-24 10:36 ` Paul Kocialkowski
2019-01-24 12:19 ` Ayaka
2018-11-23 13:02 ` [PATCH v2 2/2] media: cedrus: Add HEVC/H.265 decoding support Paul Kocialkowski
2018-11-27 8:21 ` Maxime Ripard
2019-01-24 13:10 ` Paul Kocialkowski [this message]
2019-01-25 10:10 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f25de5bbcb7bf196fe4925f54e3335b50670bd2.camel@bootlin.com \
--to=paul.kocialkowski@bootlin.com \
--cc=acourbot@chromium.org \
--cc=ayaka@soulik.info \
--cc=devel@driverdev.osuosl.org \
--cc=ezequiel@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=maxime.ripard@bootlin.com \
--cc=mchehab@kernel.org \
--cc=tfiga@chromium.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox