lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2160325f5b9bae5b437a37069db926d2a464e8d.camel@collabora.com>
Date:   Fri, 08 May 2020 13:26:21 -0300
From:   Ezequiel Garcia <ezequiel@...labora.com>
To:     Hans Verkuil <hverkuil@...all.nl>, linux-media@...r.kernel.org,
        linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     Tomasz Figa <tfiga@...omium.org>, kernel@...labora.com,
        Jonas Karlman <jonas@...boo.se>,
        Heiko Stuebner <heiko@...ech.de>,
        Alexandre Courbot <acourbot@...omium.org>,
        Jeffrey Kardatzke <jkardatzke@...omium.org>,
        gustavo.padovan@...labora.com,
        Boris Brezillon <boris.brezillon@...labora.com>
Subject: Re: [PATCH v3 3/3] media: rkvdec: Add the VP9 backend

On Fri, 2020-05-08 at 12:34 +0200, Hans Verkuil wrote:
> On 05/05/2020 15:41, Ezequiel Garcia wrote:
> > From: Boris Brezillon <boris.brezillon@...labora.com>
> > 
> > The Rockchip VDEC supports VP9 profile 0 up to 4096x2304@...ps. Add
> > a backend for this new format.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@...labora.com>
> > Signed-off-by: Ezequiel Garcia <ezequiel@...labora.com>
> > ---
> >  drivers/staging/media/rkvdec/Makefile     |    2 +-
> >  drivers/staging/media/rkvdec/rkvdec-vp9.c | 1577 +++++++++++++++++++++
> >  drivers/staging/media/rkvdec/rkvdec.c     |   56 +-
> >  drivers/staging/media/rkvdec/rkvdec.h     |    6 +
> >  4 files changed, 1637 insertions(+), 4 deletions(-)
> >  create mode 100644 drivers/staging/media/rkvdec/rkvdec-vp9.c
> > 
> > diff --git a/drivers/staging/media/rkvdec/Makefile b/drivers/staging/media/rkvdec/Makefile
> > index c08fed0a39f9..cb86b429cfaa 100644
> > --- a/drivers/staging/media/rkvdec/Makefile
> > +++ b/drivers/staging/media/rkvdec/Makefile
> > @@ -1,3 +1,3 @@
> >  obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC) += rockchip-vdec.o
> >  
> > -rockchip-vdec-y += rkvdec.o rkvdec-h264.o
> > +rockchip-vdec-y += rkvdec.o rkvdec-h264.o rkvdec-vp9.o
> > diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c
> > new file mode 100644
> > index 000000000000..37d0ea4e3570
> > --- /dev/null
> > +++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c
> > @@ -0,0 +1,1577 @@
> 
> <snip>
> 
> > +static void init_inter_probs(struct rkvdec_ctx *ctx,
> > +			     const struct rkvdec_vp9_run *run)
> > +{
> > +	const struct v4l2_ctrl_vp9_frame_decode_params *dec_params;
> > +	struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv;
> > +	struct rkvdec_vp9_priv_tbl *tbl = vp9_ctx->priv_tbl.cpu;
> > +	struct rkvdec_vp9_inter_frame_probs *rkprobs;
> > +	const struct v4l2_vp9_probabilities *probs;
> > +	unsigned int i, j, k;
> > +
> > +	rkprobs = &tbl->probs.inter;
> > +	dec_params = run->decode_params;
> > +	probs = &dec_params->probs;
> > +
> > +	/*
> > +	 * inter probs
> > +	 * 151 x 128 bits, aligned to 152 x 128 bits
> > +	 * inter only
> > +	 * intra_y_mode & inter_block info 6 x 128 bits
> > +	 */
> > +
> > +	memcpy(rkprobs->y_mode, probs->y_mode, sizeof(rkprobs->y_mode));
> > +	memcpy(rkprobs->comp_mode, probs->comp_mode,
> > +	       sizeof(rkprobs->comp_mode));
> > +	memcpy(rkprobs->comp_ref, probs->comp_ref,
> > +	       sizeof(rkprobs->comp_ref));
> > +	memcpy(rkprobs->single_ref, probs->single_ref,
> > +	       sizeof(rkprobs->single_ref));
> > +	memcpy(rkprobs->inter_mode, probs->inter_mode,
> > +	       sizeof(rkprobs->inter_mode));
> > +	memcpy(rkprobs->interp_filter, probs->interp_filter,
> > +	       sizeof(rkprobs->interp_filter));
> > +
> > +	/* 128 x 128 bits coeff related */
> > +	for (i = 0; i < ARRAY_SIZE(probs->coef); i++) {
> > +		for (j = 0; j < ARRAY_SIZE(probs->coef[0]); j++) {
> > +			for (k = 0; k < ARRAY_SIZE(probs->coef[0][0]); k++)
> > +				write_coeff_plane(probs->coef[i][j][k],
> > +						  rkprobs->coef[k][i][j]);
> > +		}
> > +	}
> > +
> > +	/* intra uv mode 6 x 128 */
> > +	memcpy(rkprobs->uv_mode_0_2, &probs->uv_mode[0],
> > +	       sizeof(rkprobs->uv_mode_0_2));
> > +	memcpy(rkprobs->uv_mode_3_5, &probs->uv_mode[3],
> > +	       sizeof(rkprobs->uv_mode_3_5));
> > +	memcpy(rkprobs->uv_mode_6_8, &probs->uv_mode[6],
> > +	       sizeof(rkprobs->uv_mode_6_8));
> > +	memcpy(rkprobs->uv_mode_9, &probs->uv_mode[9],
> > +	       sizeof(rkprobs->uv_mode_9));
> > +
> > +	/* mv related 6 x 128 */
> > +	memcpy(rkprobs->mv.joint, probs->mv.joint,
> > +	       sizeof(rkprobs->mv.joint));
> > +	memcpy(rkprobs->mv.sign, probs->mv.sign,
> > +	       sizeof(rkprobs->mv.sign));
> > +	memcpy(rkprobs->mv.class, probs->mv.class,
> > +	       sizeof(rkprobs->mv.class));
> > +	memcpy(rkprobs->mv.class0_bit, probs->mv.class0_bit,
> > +	       sizeof(rkprobs->mv.class0_bit));
> > +	memcpy(rkprobs->mv.bits, probs->mv.bits,
> > +	       sizeof(rkprobs->mv.bits));
> > +	memcpy(rkprobs->mv.class0_fr, probs->mv.class0_fr,
> > +	       sizeof(rkprobs->mv.class0_fr));
> > +	memcpy(rkprobs->mv.fr, probs->mv.fr,
> > +	       sizeof(rkprobs->mv.fr));
> > +	memcpy(rkprobs->mv.class0_hp, probs->mv.class0_hp,
> > +	       sizeof(rkprobs->mv.class0_hp));
> > +	memcpy(rkprobs->mv.hp, probs->mv.hp,
> > +	       sizeof(rkprobs->mv.hp));
> 
> Can't you just do: 'rkprobs->mv = probs->mv'?
> 

I think I'd like to keep this as-is.

Having the memcpy makes it explicit that we are copying
these structs around. While the assignment would
bring type checking, it can be misleading for readers.

Thanks,
Ezequiel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ