Adds support of 440 content.

Adds enums and corresponding vpx level code.

Change-Id: Ia402d47490a4466988d7edc6b7e3e5163f20a381
This commit is contained in:
Deb Mukherjee 2014-10-01 12:17:37 -07:00
parent 30fbf23fda
commit a30774c50d
6 changed files with 41 additions and 6 deletions

View File

@ -28,8 +28,13 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12,
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;

View File

@ -70,6 +70,7 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img,
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 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img,
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 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img,
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:

View File

@ -58,10 +58,12 @@ extern "C" {
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 */

View File

@ -541,6 +541,7 @@ static void high_img_upshift(vpx_image_t *dst, vpx_image_t *src,
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 @@ static void low_img_upshift(vpx_image_t *dst, vpx_image_t *src,
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 @@ static void high_img_downshift(vpx_image_t *dst, vpx_image_t *src,
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 @@ static void low_img_downshift(vpx_image_t *dst, vpx_image_t *src,
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 @@ int main_loop(int argc, const char **argv_) {
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 @@ int main_loop(int argc, const char **argv_) {
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),

View File

@ -140,6 +140,8 @@ static const arg_def_t use_i422 = ARG_DEF(NULL, "i422", 0,
"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 @@ static const arg_def_t lag_in_frames = ARG_DEF(NULL, "lag-in-frames", 1,
"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 @@ static void parse_global_config(struct VpxEncoderConfig *global, char **argv) {
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 @@ static const char* image_format_to_string(vpx_img_fmt_t f) {
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 @@ static void high_img_upshift(vpx_image_t *dst, vpx_image_t *src,
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 @@ static void low_img_upshift(vpx_image_t *dst, vpx_image_t *src,
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 @@ static void img_cast_16_to_8(vpx_image_t *dst, vpx_image_t *src) {
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");
@ -1993,6 +2005,9 @@ int main(int argc, const char **argv_) {
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;
break;

View File

@ -26,6 +26,7 @@ typedef enum {
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;