changeset 35147:4d8d26a9d66a

Remove nv12/nv21 decoding from vd_hmblck. The codecs.conf doesn't list nv12/nv21 in the hmblck section, so the hmblck is never actually used for decoding them. Instead these pixel formats are passed through rawnv12/21 (vd_raw). They can be converted to yv12 by vf_scale. When swscale support hm12 pixel format, this decoder could be completely removed.
author iive
date Thu, 11 Oct 2012 21:50:18 +0000
parents c17eeb84bec7
children 89660feadcce
files libmpcodecs/vd_hmblck.c
diffstat 1 files changed, 3 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_hmblck.c	Thu Oct 11 16:39:30 2012 +0000
+++ b/libmpcodecs/vd_hmblck.c	Thu Oct 11 21:50:18 2012 +0000
@@ -25,7 +25,7 @@
 #include "vd_internal.h"
 
 static const vd_info_t info = {
-	"Hauppauge Macroblock/NV12/NV21 Decoder",
+	"Hauppauge Macroblock Decoder",
 	"hmblck",
 	"Alex <d18c7db@hotmail.com>, A'rpi, Alex Beregszaszi",
 	"Alex <d18c7db@hotmail.com>",
@@ -73,41 +73,6 @@
 }
 
 /*************************************************************************
- * convert a nv12 buffer to yv12
- */
-static int nv12_to_yv12(unsigned char *data, int len, mp_image_t* mpi, int swapped) {
-    unsigned int Y_size  = mpi->width * mpi->height;
-    unsigned int UV_size = mpi->chroma_width * mpi->chroma_height;
-    unsigned int idx;
-    unsigned char *dst_Y = mpi->planes[0];
-    unsigned char *dst_U = mpi->planes[1];
-    unsigned char *dst_V = mpi->planes[2];
-    unsigned char *src   = data + Y_size;
-
-    // sanity check raw stream
-    if ( (len != (Y_size + (UV_size<<1))) ) {
-        mp_msg(MSGT_DECVIDEO, MSGL_ERR,
-               "hmblck: Image size inconsistent with data size.\n");
-        return 0;
-    }
-    if (mpi->num_planes != 3) {
-        mp_msg(MSGT_DECVIDEO,MSGL_ERR,
-               "hmblck: Incorrect number of image planes.\n");
-        return 0;
-    }
-
-    // luma data is easy, just copy it
-    memcpy(dst_Y, data, Y_size);
-
-    // chroma data is interlaced UVUV... so deinterlace it
-    for(idx=0; idx<UV_size; idx++ ) {
-        *(dst_U + idx) = *(src + (idx<<1) + (swapped ? 1 : 0));
-        *(dst_V + idx) = *(src + (idx<<1) + (swapped ? 0 : 1));
-    }
-    return 1;
-}
-
-/*************************************************************************
  * set/get/query special features/parameters
  */
 static int control(sh_video_t *sh,int cmd, void *arg,...){
@@ -136,15 +101,10 @@
         sh->disp_w, sh->disp_h);
     if(!mpi) return NULL;
 
-    if(sh->format == IMGFMT_HM12) {
-        //if(!de_macro(sh, data, len, flags, mpi)) return NULL;
-	de_macro_y(mpi->planes[0],data,mpi->stride[0],mpi->w,mpi->h);
-	de_macro_uv(mpi->planes[1],mpi->planes[2],
+    de_macro_y(mpi->planes[0],data,mpi->stride[0],mpi->w,mpi->h);
+    de_macro_uv(mpi->planes[1],mpi->planes[2],
                     (unsigned char *)data+mpi->w*mpi->h,mpi->stride[1],
                     mpi->w/2,mpi->h/2);
-    } else {
-	if(!nv12_to_yv12(data, len, mpi,(sh->format == IMGFMT_NV21))) return NULL;
-    }
 
     return mpi;
 }