From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: linux-arm-kernel@lists.infradead.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
acourbot@chromium.org, jonas@kwiboo.se, jenskuske@gmail.com,
linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org,
tfiga@chromium.org,
Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
Chen-Yu Tsai <wens@csie.org>,
hans.verkuil@cisco.com,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
sakari.ailus@linux.intel.com, nicolas.dufresne@collabora.com,
ezequiel@collabora.com, posciak@chromium.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH v4 2/2] media: cedrus: Add H264 decoding support
Date: Wed, 06 Mar 2019 19:17:49 +0100 [thread overview]
Message-ID: <3704630.sSNj3ip9hk@jernej-laptop> (raw)
In-Reply-To: <20190306105708.kjp7xjom42azhl6y@flea>
Dne sreda, 06. marec 2019 ob 11:57:08 CET je Maxime Ripard napisal(a):
> Hi,
>
> On Tue, Mar 05, 2019 at 06:05:08PM +0100, Jernej Škrabec wrote:
> > Dne torek, 05. marec 2019 ob 11:17:32 CET je Maxime Ripard napisal(a):
> > > Hi Jernej,
> > >
> > > On Wed, Feb 20, 2019 at 06:50:54PM +0100, Jernej Škrabec wrote:
> > > > I really wanted to do another review on previous series but got
> > > > distracted
> > > > by analyzing one particulary troublesome H264 sample. It still doesn't
> > > > work correctly, so I would ask you if you can test it with your stack
> > > > (it
> > > > might be userspace issue):
> > > >
> > > > http://jernej.libreelec.tv/videos/problematic/test.mkv
> > > >
> > > > Please take a look at my comments below.
> > >
> > > I'd really prefer to focus on getting this merged at this point, and
> > > then fixing odd videos and / or setups we can find later
> > > on. Especially when new stacks are going to be developped on top of
> > > this, I'm sure we're going to have plenty of bugs to address :)
> >
> > I forgot to mention, you can add:
> > Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
> >
> > once you fix issues.
>
> Great, thanks :)
>
> > > > > + for (i = 0; i < ARRAY_SIZE(pred_weight->weight_factors); i++) {
> > > > > + const struct v4l2_h264_weight_factors *factors =
> > > > > + &pred_weight->weight_factors[i];
> > > > > +
> > > > > + for (j = 0; j < ARRAY_SIZE(factors->luma_weight); j++)
> >
> > {
> >
> > > > > + u32 val;
> > > > > +
> > > > > + val = ((factors->luma_offset[j] & 0x1ff) <<
> >
> > 16)
> >
> > > > > + (factors->luma_weight[j] &
0x1ff);
> > > > > + cedrus_write(dev, VE_AVC_SRAM_PORT_DATA,
> > > >
> > > > val);
> > > >
> > > > You should cast offset varible to wider type. Currently some videos
> > > > which
> > > > use prediction weight table don't work for me, unless offset is casted
> > > > to
> > > > u32 first. Shifting 8 bit variable for 16 places gives you 0 every
> > > > time.
> > >
> > > I'll do it.
> > >
> > > > Luma offset and weight are defined as s8, so having wider mask doesn't
> > > > really make sense. However, I think weight should be s16 anyway,
> > > > because
> > > > standard says that it's value could be 2^denominator for default value
> > > > or
> > > > in range -128..127. Worst case would be 2^7 = 128 and -128. To cover
> > > > both
> > > > values you need at least 9 bits.
> > >
> > > But if I understood the spec right, in that case you would just have
> > > the denominator set, and not the offset, while the offset is used if
> > > you don't use the default formula (and therefore remains in the -128
> > > 127 range which is covered by the s8), right?
> >
> > Yeah, default offset is 0 and s8 is sufficient for that. I'm talking about
> > weight. Default weight is "1 << denominator", which might be 1 << 7 or
> > 128.
> >
> > We could also add a flag, which would signal default table. In that case
> > we
> > could just set a bit to tell VPU to use default values. Even if some VPUs
> > need default table to be set explicitly, it's very easy to calculate
> > values as mentioned in previous paragraph.
>
> Yeah, sorry, I meant weight. Would that make any difference? Can we
> have situations where both the denominator and the weight would be
> set, with the weight set to 128?
Yes, that's the case when default weight is used and (log2) denominator is 7.
Weight is then "1 << denominator".
>
> I've checked in the libva and ffmpeg, and libva uses a short, while
> ffmpeg uses an int, both for the weight and offset. For consistency I
> guess we could change both to shorts just like libva?
>
> What do you think?
Yes, that would work for me. Maybe someone else has opinion about this? But I
think there is a reason why libva uses shorts.
Best regards,
Jernej
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-03-06 18:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 14:17 [PATCH v4 0/2] media: cedrus: Add H264 decoding support Maxime Ripard
2019-02-20 14:17 ` [PATCH v4 1/2] media: uapi: Add H264 low-level decoder API compound controls Maxime Ripard
2019-02-22 7:46 ` Tomasz Figa
2019-02-22 16:59 ` Ezequiel Garcia
2019-02-27 10:01 ` Maxime Ripard
2019-02-27 20:57 ` Nicolas Dufresne
2019-03-05 11:16 ` Maxime Ripard
2019-03-05 19:54 ` Ezequiel Garcia
2019-03-04 18:49 ` Ezequiel Garcia
2019-03-05 9:43 ` Maxime Ripard
2019-02-20 14:17 ` [PATCH v4 2/2] media: cedrus: Add H264 decoding support Maxime Ripard
2019-02-20 17:50 ` Jernej Škrabec
2019-02-21 18:21 ` Jernej Škrabec
2019-03-05 10:17 ` Maxime Ripard
2019-03-05 17:05 ` Jernej Škrabec
2019-03-06 10:57 ` Maxime Ripard
2019-03-06 18:17 ` Jernej Škrabec [this message]
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=3704630.sSNj3ip9hk@jernej-laptop \
--to=jernej.skrabec@gmail.com \
--cc=acourbot@chromium.org \
--cc=ezequiel@collabora.com \
--cc=hans.verkuil@cisco.com \
--cc=jenskuske@gmail.com \
--cc=jonas@kwiboo.se \
--cc=laurent.pinchart@ideasonboard.com \
--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=nicolas.dufresne@collabora.com \
--cc=paul.kocialkowski@bootlin.com \
--cc=posciak@chromium.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tfiga@chromium.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wens@csie.org \
/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