Re: [PATCH v2 2/2] media: cedrus: Add HEVC/H.265 decoding support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, Jan 24, 2019 at 02:10:25PM +0100, Paul Kocialkowski wrote:
> 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@xxxxxxxxxxx>
> > 
> > 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?

Yeah, the 80-chars limit can be ignored. But there's more warnings and
checks that should be addressed.

> > > +	/* 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.

Then you can still pass directly the vb2 buffer pointer, that would
remove the mv_col_buf_addr, dst_luma_addr and dst_chroma_addr. The
idea here is that the less arguments you have in your function, the
easier it is to understand.

> > > +
> > > +	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.

The DPB and num_active_dpb_entries will not change from one run to the
other though. And having intermediate functions if that allows to be
clearer is fine as well.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux