shithub: libvpx

Download patch

ref: 439bd095c6c1b6aa107326c34b9b1c6afff2a7bf
parent: c7d719325e70133720f429f9b1347904f76ab34f
parent: a30774c50d2b1b626b05a99dcd29aa766f0b223b
author: Deb Mukherjee <[email protected]>
date: Wed Oct 1 15:54:46 EDT 2014

Merge "Adds support of 440 content."

--- a/vp9/vp9_iface_common.h
+++ b/vp9/vp9_iface_common.h
@@ -28,8 +28,13 @@
       bps = 16;
     }
   } else {
-    img->fmt = VPX_IMG_FMT_I420;
-    bps = 12;
+    if (!ss_x) {
+      img->fmt = VPX_IMG_FMT_I440;
+      bps = 16;
+    } else {
+      img->fmt = VPX_IMG_FMT_I420;
+      bps = 12;
+    }
   }
   img->bit_depth = 8;
   img->w = yv12->y_stride;
--- a/vpx/src/vpx_image.c
+++ b/vpx/src/vpx_image.c
@@ -70,6 +70,7 @@
       bps = 12;
       break;
     case VPX_IMG_FMT_I422:
+    case VPX_IMG_FMT_I440:
       bps = 16;
       break;
     case VPX_IMG_FMT_I444:
@@ -79,6 +80,7 @@
       bps = 24;
       break;
     case VPX_IMG_FMT_I42216:
+    case VPX_IMG_FMT_I44016:
       bps = 32;
       break;
     case VPX_IMG_FMT_I44416:
@@ -107,10 +109,12 @@
 
   switch (fmt) {
     case VPX_IMG_FMT_I420:
+    case VPX_IMG_FMT_I440:
     case VPX_IMG_FMT_YV12:
     case VPX_IMG_FMT_VPXI420:
     case VPX_IMG_FMT_VPXYV12:
     case VPX_IMG_FMT_I42016:
+    case VPX_IMG_FMT_I44016:
       ycs = 1;
       break;
     default:
--- a/vpx/vpx_image.h
+++ b/vpx/vpx_image.h
@@ -58,10 +58,12 @@
     VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4,
     VPX_IMG_FMT_I422    = VPX_IMG_FMT_PLANAR | 5,
     VPX_IMG_FMT_I444    = VPX_IMG_FMT_PLANAR | 6,
-    VPX_IMG_FMT_444A    = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 7,
+    VPX_IMG_FMT_I440    = VPX_IMG_FMT_PLANAR | 7,
+    VPX_IMG_FMT_444A    = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 6,
     VPX_IMG_FMT_I42016    = VPX_IMG_FMT_I420 | VPX_IMG_FMT_HIGHBITDEPTH,
     VPX_IMG_FMT_I42216    = VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH,
-    VPX_IMG_FMT_I44416    = VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH
+    VPX_IMG_FMT_I44416    = VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH,
+    VPX_IMG_FMT_I44016    = VPX_IMG_FMT_I440 | VPX_IMG_FMT_HIGHBITDEPTH
   } vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */
 
   /**\brief Image Descriptor */
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -541,6 +541,7 @@
     case VPX_IMG_FMT_I42016:
     case VPX_IMG_FMT_I42216:
     case VPX_IMG_FMT_I44416:
+    case VPX_IMG_FMT_I44016:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -580,6 +581,7 @@
     case VPX_IMG_FMT_I420:
     case VPX_IMG_FMT_I422:
     case VPX_IMG_FMT_I444:
+    case VPX_IMG_FMT_I440:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -626,6 +628,7 @@
     case VPX_IMG_FMT_I42016:
     case VPX_IMG_FMT_I42216:
     case VPX_IMG_FMT_I44416:
+    case VPX_IMG_FMT_I44016:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -664,6 +667,7 @@
     case VPX_IMG_FMT_I420:
     case VPX_IMG_FMT_I422:
     case VPX_IMG_FMT_I444:
+    case VPX_IMG_FMT_I440:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -941,7 +945,7 @@
   if (use_y4m && !noblit) {
     if (!single_file) {
       fprintf(stderr, "YUV4MPEG2 not supported with output patterns,"
-              " try --i420 or --yv12.\n");
+              " try --i420 or --yv12 or --rawvideo.\n");
       return EXIT_FAILURE;
     }
 
@@ -1164,6 +1168,10 @@
         if (use_y4m) {
           char buf[Y4M_BUFFER_SIZE] = {0};
           size_t len = 0;
+          if (img->fmt == VPX_IMG_FMT_I440 || img->fmt == VPX_IMG_FMT_I44016) {
+            fprintf(stderr, "Cannot produce y4m output for 440 sampling.\n");
+            goto fail;
+          }
           if (frame_out == 1) {
             // Y4M file header
             len = y4m_write_file_header(buf, sizeof(buf),
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -140,6 +140,8 @@
                                           "Input file is I422");
 static const arg_def_t use_i444 = ARG_DEF(NULL, "i444", 0,
                                           "Input file is I444");
+static const arg_def_t use_i440 = ARG_DEF(NULL, "i440", 0,
+                                          "Input file is I440");
 static const arg_def_t codecarg = ARG_DEF(NULL, "codec", 1,
                                           "Codec to use");
 static const arg_def_t passes           = ARG_DEF("p", "passes", 1,
@@ -244,7 +246,7 @@
                                                   "Max number of frames to lag");
 
 static const arg_def_t *global_args[] = {
-  &use_yv12, &use_i420, &use_i422, &use_i444,
+  &use_yv12, &use_i420, &use_i422, &use_i444, &use_i440,
   &usage, &threads, &profile,
   &width, &height,
 #if CONFIG_WEBM_IO
@@ -829,6 +831,8 @@
       global->color_type = I422;
     else if (arg_match(&arg, &use_i444, argi))
       global->color_type = I444;
+    else if (arg_match(&arg, &use_i440, argi))
+      global->color_type = I440;
     else if (arg_match(&arg, &quietarg, argi))
       global->quiet = 1;
     else if (arg_match(&arg, &verbosearg, argi))
@@ -1288,7 +1292,12 @@
     case VPX_IMG_FMT_I420: return "I420";
     case VPX_IMG_FMT_I422: return "I422";
     case VPX_IMG_FMT_I444: return "I444";
+    case VPX_IMG_FMT_I440: return "I440";
     case VPX_IMG_FMT_YV12: return "YV12";
+    case VPX_IMG_FMT_I42016: return "I42016";
+    case VPX_IMG_FMT_I42216: return "I42216";
+    case VPX_IMG_FMT_I44416: return "I44416";
+    case VPX_IMG_FMT_I44016: return "I44016";
     default: return "Other";
   }
 }
@@ -1734,6 +1743,7 @@
     case VPX_IMG_FMT_I42016:
     case VPX_IMG_FMT_I42216:
     case VPX_IMG_FMT_I44416:
+    case VPX_IMG_FMT_I44016:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -1774,6 +1784,7 @@
     case VPX_IMG_FMT_I420:
     case VPX_IMG_FMT_I422:
     case VPX_IMG_FMT_I444:
+    case VPX_IMG_FMT_I440:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -1819,6 +1830,7 @@
     case VPX_IMG_FMT_I420:
     case VPX_IMG_FMT_I422:
     case VPX_IMG_FMT_I444:
+    case VPX_IMG_FMT_I440:
       break;
     default:
       fatal("Unsupported image conversion");
@@ -1992,6 +2004,9 @@
       break;
     case I444:
       input.fmt = VPX_IMG_FMT_I444;
+      break;
+    case I440:
+      input.fmt = VPX_IMG_FMT_I440;
       break;
     case YV12:
       input.fmt = VPX_IMG_FMT_YV12;
--- a/vpxenc.h
+++ b/vpxenc.h
@@ -26,6 +26,7 @@
   I420,  // 4:2:0 8+ bit-depth
   I422,  // 4:2:2 8+ bit-depth
   I444,  // 4:4:4 8+ bit-depth
+  I440,  // 4:4:0 8+ bit-depth
   YV12,  // 4:2:0 with uv flipped, only 8-bit depth
 } ColorInputType;