All pastes #548082 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-06-07 16:32 UTC
rendered paste body
Index: etc/codecs.conf
===================================================================
--- etc/codecs.conf     (revision 23493)
+++ etc/codecs.conf     (working copy)
@@ -2190,6 +2196,7 @@
   format 0x0 0x32595559
   format 0x20776172
   fourcc yuy2,YUY2
+  fourcc yuv2 # this needs actual "decoding" since chroma is stored unsigned
   out YUY2

 videocodec rawuyvy
Index: libmpcodecs/vd_raw.c
===================================================================
--- libmpcodecs/vd_raw.c        (revision 23493)
+++ libmpcodecs/vd_raw.c        (working copy)
@@ -22,6 +22,7 @@
     switch(cmd){
     case VDCTRL_QUERY_FORMAT:
        if (*(int *)arg == format) return CONTROL_TRUE;
+       if (*(int *)arg == IMGFMT_YUY2 && format == MKTAG('y', 'u', 'v', '2')) return CONTROL_TRUE;
        return CONTROL_FALSE;
     }
     return CONTROL_UNKNOWN;
@@ -57,6 +59,7 @@
 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
     mp_image_t* mpi;
     int frame_size;
+    int format = sh->bih ? sh->bih->biCompression : sh->format;

     if(len<=0) return NULL; // skipped frame

@@ -104,6 +107,11 @@
 #endif
        }
        frame_size=mpi->stride[0]*mpi->h;
+       if (format == MKTAG('y', 'u', 'v', '2')) {
+         int i;
+          for (i = 1; i < frame_size; i += 2)
+            mpi->planes[0][i] ^= 128;
+        }
        if(mpi->bpp<8) frame_size=frame_size*mpi->bpp/8;
     }