[FFmpeg-devel] [PATCH] avcodec: add Actimagine VX video decoder

Florian Nouwt fnouwt2 at gmail.com
Mon Mar 15 23:54:58 EET 2021


Now that I think about it, it might not be possible to an accurate
straightforward conversion to regular yuv because of the subsampling. The u
and v cannot just linearly be scaled to line up with the required values
for regular yuv. That would mean the output would have to be in rgb format.
It wouldn't really be an issue, but not the most elegant solution. Wouldn't
it be possible to support these alternative coefficients in libswscale or
so? I suppose that would still give issues with applications that have
their own conversion algorithms.

Op ma 15 mrt. 2021 22:20 schreef Lynne <dev at lynne.ee>:

> Mar 15, 2021, 22:02 by fnouwt2 at gmail.com:
>
> > It's actually closer to normal yuv than ycocg. If you look at the
> > coefficients of normal yuv
> > r = y + 1.14v
> > g = y - 0.39u - 0.58v
> > b = y + 2.03u
> >
> > ycocg
> > r = y + co - cg
> > g = y + cg
> > b = y - co - cg
> >
> > the format used in actimagine
> > r = y + 2v
> > g = y - 0.5u - v
> > b = y + 2u
> >
> > You can see it's more like yuv than ycocg. That's also why currently the
> > decoded colors still look "alright". I think it wouldn't be a good idea
> to
> > use converted ref frames and then convert back as it would likely
> introduce
> > errors. But like you are saying, this coded is as far as I know, never
> used
> > for large frame sizes, so it shouldn't really be an issue to have an
> extra
> > frame and it prevents other problems.
> >
>
> Right, I couldn't remember the YUV formula offhand, and the shifts
> made it look like YCoCg.
> In that case, you can generate the magic constants to multiply, and
> then shift the v and u components. For such small numbers you can
> even do it by hand, for example 1.14/2 = 0.57 = (584 * v) >> 10.
> You'll want to go as high as you can when you multiply without
> overflowing, then shift down to decrease rounding error (it always
> rounds to 0).
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list