[FFmpeg-devel] [PATCH 2/2] avcodec/libutvideodec: Support YUV422P10

Michael Niedermayer michaelni at gmx.at
Sat Oct 25 00:14:14 CEST 2014


On Sun, Oct 19, 2014 at 08:35:08PM +0200, Benoit Fouet wrote:
> Hi,
> 
> On 19 October 2014 14:52:17 CEST, Michael Niedermayer <michaelni at gmx.at> wrote:
> >Based on ConvertToPlanar() from libutvideo
> >libutvideo sadly does not seem to support exporting its internal planar
> >buffers
> >
> >Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >---
> >libavcodec/libutvideodec.cpp |   55
> >+++++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 54 insertions(+), 1 deletion(-)
> >
> >diff --git a/libavcodec/libutvideodec.cpp
> >b/libavcodec/libutvideodec.cpp
> >index 36dc952..f76a53a 100644
> >--- a/libavcodec/libutvideodec.cpp
> >+++ b/libavcodec/libutvideodec.cpp
> 
> [...]
> 
> >@@ -88,6 +94,8 @@ static av_cold int utvideo_decode_init(AVCodecContext
> >*avctx)
> > 
> >     /* Only allocate the buffer once */
> >utv->buf_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
> >avctx->height);
> >+    if (format == UTVF_v210)
> >+        utv->buf_size += avctx->height * ((avctx->width + 47) / 48) *
> >128;
> 
> A comment on the rounding would be cool.

added


> 
> >   utv->buffer = (uint8_t *)av_malloc(utv->buf_size * sizeof(uint8_t));
> > 
> >     if (utv->buffer == NULL) {
> >@@ -155,6 +163,51 @@ static int utvideo_decode_frame(AVCodecContext
> >*avctx, void *data,
> >         pic->linesize[0] = w * 2;
> >         pic->data[0] = utv->buffer;
> >         break;
> >+    case AV_PIX_FMT_YUV422P10: {
> >+        uint16_t *y, *u, *v;
> >+        int i,j;
> >+        int linesize = ((w + 47) / 48) * 128;
> >+
> >+        pic->linesize[0] = w * 2;
> >+        pic->linesize[1] =
> >+        pic->linesize[2] = w;
> >+        pic->data[0] = utv->buffer + linesize * h;
> >+        pic->data[1] = pic->data[0] + h*pic->linesize[0];
> >+        pic->data[2] = pic->data[1] + h*pic->linesize[1];
> >+        y = (uint16_t*)pic->data[0];
> >+        u = (uint16_t*)pic->data[1];
> >+        v = (uint16_t*)pic->data[2];
> >+        for (j = 0; j < h; j++) {
> >+            const uint8_t *in = utv->buffer + j * linesize;
> >+
> >+            for (i = 0; i + 1 < w; i += 6, in += 4) {
> >+                *u++ = (AV_RL32(in+0)    ) & 0x3FF;
> >+                *y++ = (AV_RL32(in+0)>>10) & 0x3FF;
> >+                *v++ = (AV_RL32(in+0)>>20) & 0x3FF;
> 
> Couldn't this be using a temp variable for AV_RL32 (here and below)?

changed

patch applied

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141025/2efcc04f/attachment.asc>


More information about the ffmpeg-devel mailing list