Re: [PATCH 5/5] vo_xv: Support NV12/21

Alexander Strasser <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
On 2017-06-15 01:37 +0200, Alexander Strasser wrote:
> On 2017-06-15 00:50 +0200, Alexander Strasser wrote:
> > Based-on-a-patch-by: Ville Syrjälä >syrjala sci fi<
> > Signed-off-by: Alexander Strasser <[email protected]>
> > ---
> >  libvo/vo_xv.c | 19 ++++++++++++++++++-
> >  1 file changed, 18 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
> > index 3febbf748..222c72f5f 100644
> > --- a/libvo/vo_xv.c
> > +++ b/libvo/vo_xv.c
> [...]
> > @@ -398,9 +399,14 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h,
> >          idx_p1 = 2; idx_p2 = 1;
> >      case IMGFMT_I420:
> >      case IMGFMT_IYUV:
> > +        num_planes = 3;
> >          x /= 2;
> > -        y /= 2;
> >          w /= 2;
> > +    case IMGFMT_NV12:
> > +    case IMGFMT_NV21:
> 
> > +        x &= ~1;
> > +        w &= ~1;
> 
> After reading this hunk again; I think it is wrong. Those two lines should
> only be in the path for NV12/21.
> 
> I wonder if the choice of the switch is that good after all. Maybe it's still
> OK I have to try again after rewriting and separating the tail parts for 
> NV12/21 and the others.

Replacement patch attachend.


[...]

  Alexander

_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
0005-vo_xv-Support-NV12-21.patch (text/plain, 2 KB)
From 50888a3834861fae8832e14d58caa7b61afa1020 Mon Sep 17 00:00:00 2001
From: Alexander Strasser <[email protected]>
Date: Tue, 16 May 2017 23:57:59 +0200
Subject: [PATCH] vo_xv: Support NV12/21
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Based-on-a-patch-by: Ville Syrjälä >syrjala sci fi<
---
 libvo/vo_xv.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 3febbf7..7a523aa 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -413,6 +413,18 @@ static int draw_slice(uint8_t * image[], int stride[], int w, int h,
             memcpy_pic(dst, image[idx_p2], w, h, xvimage[current_buf]->pitches[2],
                        stride[idx_p2]);
         break;
+    case IMGFMT_NV12:
+    case IMGFMT_NV21:
+        x &= ~1;
+        y /= 2;
+        w &= ~1;
+        h /= 2;
+
+        dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] +
+            xvimage[current_buf]->pitches[1] * y + x;
+            memcpy_pic(dst, image[idx_p1], w, h, xvimage[current_buf]->pitches[1],
+                       stride[idx_p1]);
+        break;
     }
 
     return 0;
@@ -496,6 +508,13 @@ static uint32_t get_image(mp_image_t * mpi)
             mpi->stride[1] = xvimage[current_buf]->pitches[idx_p1];
             mpi->stride[2] = xvimage[current_buf]->pitches[idx_p2];
             break;
+        case IMGFMT_NV12:
+        case IMGFMT_NV21:
+            mpi->planes[1] =
+                xvimage[current_buf]->data +
+                xvimage[current_buf]->offsets[1];
+            mpi->stride[1] = xvimage[current_buf]->pitches[1];
+            break;
         }
         mpi->flags |= MP_IMGFLAG_DIRECT;
         mpi->priv = (void *)(intptr_t)current_buf;
@@ -511,6 +530,8 @@ static int is_supported_format(uint32_t format)
     case IMGFMT_YV12:
     case IMGFMT_I420:
     case IMGFMT_IYUV:
+    case IMGFMT_NV12:
+    case IMGFMT_NV21:
         return 1;
     default:
         return 0;
-- 
2.8.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.