From 78df9ead2103eded7e588fe596e281747764fb3c Mon Sep 17 00:00:00 2001 From: Deb Mukherjee Date: Fri, 11 Jul 2014 15:42:39 -0700 Subject: [PATCH] Fix for raw yuv input Sets fmt correctly for raw yuv inputs, and reads frame correctly. Change-Id: I05405b2265545d5c6d1cf7b086db9548cbe5d8ba --- tools_common.c | 3 ++- vpxenc.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools_common.c b/tools_common.c index 4f2ac7401..a7120457f 100644 --- a/tools_common.c +++ b/tools_common.c @@ -83,6 +83,7 @@ int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) { struct FileTypeDetectionBuffer *detect = &input_ctx->detect; int plane = 0; int shortread = 0; + const int bytespp = (input_ctx->fmt & VPX_IMG_FMT_HIGH) ? 2 : 1; for (plane = 0; plane < 3; ++plane) { uint8_t *ptr; @@ -108,7 +109,7 @@ int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) { } for (r = 0; r < h; ++r) { - size_t needed = w; + size_t needed = w * bytespp; size_t buf_position = 0; const size_t left = detect->buf_read - detect->position; if (left > 0) { diff --git a/vpxenc.c b/vpxenc.c index 58ae5474e..747590241 100644 --- a/vpxenc.c +++ b/vpxenc.c @@ -1970,6 +1970,7 @@ int main(int argc, const char **argv_) { else if (stream->config.cfg.g_bit_depth == VPX_BITS_12) input.bit_depth = stream->config.cfg.g_in_bit_depth = 12; }); + if (input.bit_depth > 8) input.fmt |= VPX_IMG_FMT_HIGH; } else { FOREACH_STREAM({ stream->config.cfg.g_in_bit_depth = input.bit_depth;