summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-01-17 12:19:19 -0800
committerDmitry Kovalev <dkovalev@google.com>2014-01-17 12:19:19 -0800
commit3c054811bde9f4430ae40e9f07d1e14589c8d7e0 (patch)
tree1a9a4d985c46d064f7589a16fda8fe0976df4cca
parent6f8b3039afbb5c3118bf1363d4c7ff854e506d97 (diff)
downloadlibvpx-3c054811bde9f4430ae40e9f07d1e14589c8d7e0.tar.gz
Adding vpx_image_scale() function in vpxdec.
Change-Id: I29eaffff5089b26e8778a977c3b3da11800f1c49
-rw-r--r--vpxdec.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/vpxdec.c b/vpxdec.c
index e08ca9136..731feedbb 100644
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -131,6 +131,21 @@ static const arg_def_t *vp8_pp_args[] = {
};
#endif
+static int vpx_image_scale(vpx_image_t *src, vpx_image_t *dst,
+ FilterMode mode) {
+ assert(src->fmt == VPX_IMG_FMT_I420);
+ assert(dst->fmt == VPX_IMG_FMT_I420);
+ return I420Scale(src->planes[VPX_PLANE_Y], src->stride[VPX_PLANE_Y],
+ src->planes[VPX_PLANE_U], src->stride[VPX_PLANE_U],
+ src->planes[VPX_PLANE_V], src->stride[VPX_PLANE_V],
+ src->d_w, src->d_h,
+ dst->planes[VPX_PLANE_Y], dst->stride[VPX_PLANE_Y],
+ dst->planes[VPX_PLANE_U], dst->stride[VPX_PLANE_U],
+ dst->planes[VPX_PLANE_V], dst->stride[VPX_PLANE_V],
+ dst->d_w, dst->d_h,
+ mode);
+}
+
void usage_exit() {
int i;
@@ -490,8 +505,6 @@ int main_loop(int argc, const char **argv_) {
int num_external_frame_buffers = 0;
int fb_lru_cache = 0;
vpx_codec_frame_buffer_t *frame_buffers = NULL;
- int display_width = 0;
- int display_height = 0;
struct VpxDecInputContext input = {0};
struct VpxInputContext vpx_input_ctx = {0};
@@ -866,8 +879,8 @@ int main_loop(int argc, const char **argv_) {
// use the width and height specified in the container. If either of
// these is set to 0, use the display size set in the first frame
// header.
- display_width = vpx_input_ctx.width;
- display_height = vpx_input_ctx.height;
+ int display_width = vpx_input_ctx.width;
+ int display_height = vpx_input_ctx.height;
if (!display_width || !display_height) {
int display_size[2];
if (vpx_codec_control(&decoder, VP9D_GET_DISPLAY_SIZE,
@@ -884,23 +897,12 @@ int main_loop(int argc, const char **argv_) {
display_height, 16);
}
- if (img->d_w != display_width || img->d_h != display_height) {
- assert(img->fmt == VPX_IMG_FMT_I420);
- I420Scale(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y],
- img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U],
- img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V],
- img->d_w, img->d_h,
- scaled_img->planes[VPX_PLANE_Y],
- scaled_img->stride[VPX_PLANE_Y],
- scaled_img->planes[VPX_PLANE_U],
- scaled_img->stride[VPX_PLANE_U],
- scaled_img->planes[VPX_PLANE_V],
- scaled_img->stride[VPX_PLANE_V],
- display_width, display_height,
- kFilterBox);
+ if (img->d_w != scaled_img->d_w || img->d_h != scaled_img->d_h) {
+ vpx_image_scale(img, scaled_img, kFilterBox);
img = scaled_img;
}
}
+
if (img) {
const int PLANES_YUV[] = {VPX_PLANE_Y, VPX_PLANE_U, VPX_PLANE_V};
const int PLANES_YVU[] = {VPX_PLANE_Y, VPX_PLANE_V, VPX_PLANE_U};