[go: up one dir, main page]

blob: 4f0417e386d5d7cacd7127e3aa499b4166f5d9f2 [file] [log] [blame]
John Koleszarc377bf02010-11-02 13:11:571/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
Tom Finegan00a35aa2013-11-14 20:37:4210
Dmitry Kovalev2dad0e12014-02-27 22:00:4111#include <math.h>
Tom Finegan03848f52013-11-05 18:02:1812#include <stdarg.h>
Tom Finegan00a35aa2013-11-14 20:37:4213#include <stdio.h>
Tom Finegan03848f52013-11-05 18:02:1814#include <stdlib.h>
Tom Finegan00a35aa2013-11-14 20:37:4215#include <string.h>
Tom Finegan03848f52013-11-05 18:02:1816
Dmitry Kovalev2dad0e12014-02-27 22:00:4117#include "./tools_common.h"
18
Jim Bankoskic96ecc22016-01-20 18:15:2019#if CONFIG_VP10_ENCODER
Dmitry Kovalev70d96642014-02-12 05:12:2320#include "vpx/vp8cx.h"
21#endif
22
Jim Bankoskic96ecc22016-01-20 18:15:2023#if CONFIG_VP10_DECODER
Dmitry Kovalev7ec27692014-01-27 21:40:2924#include "vpx/vp8dx.h"
25#endif
26
John Koleszar82b1a342012-11-06 20:08:0527#if defined(_WIN32) || defined(__OS2__)
John Koleszarc377bf02010-11-02 13:11:5728#include <io.h>
29#include <fcntl.h>
John Koleszar82b1a342012-11-06 20:08:0530
31#ifdef __OS2__
clang-format99e28b82016-01-27 20:42:4532#define _setmode setmode
33#define _fileno fileno
34#define _O_BINARY O_BINARY
John Koleszar82b1a342012-11-06 20:08:0535#endif
John Koleszarc377bf02010-11-02 13:11:5736#endif
37
clang-format99e28b82016-01-27 20:42:4538#define LOG_ERROR(label) \
39 do { \
40 const char *l = label; \
41 va_list ap; \
42 va_start(ap, fmt); \
43 if (l) fprintf(stderr, "%s: ", l); \
44 vfprintf(stderr, fmt, ap); \
45 fprintf(stderr, "\n"); \
46 va_end(ap); \
47 } while (0)
Tom Finegan03848f52013-11-05 18:02:1848
John Koleszarc6b90392012-07-13 22:21:2949FILE *set_binary_mode(FILE *stream) {
50 (void)stream;
John Koleszar82b1a342012-11-06 20:08:0551#if defined(_WIN32) || defined(__OS2__)
John Koleszarc6b90392012-07-13 22:21:2952 _setmode(_fileno(stream), _O_BINARY);
John Koleszarc377bf02010-11-02 13:11:5753#endif
John Koleszarc6b90392012-07-13 22:21:2954 return stream;
John Koleszarc377bf02010-11-02 13:11:5755}
Tom Finegan03848f52013-11-05 18:02:1856
57void die(const char *fmt, ...) {
58 LOG_ERROR(NULL);
59 usage_exit();
60}
61
62void fatal(const char *fmt, ...) {
63 LOG_ERROR("Fatal");
64 exit(EXIT_FAILURE);
65}
66
clang-format99e28b82016-01-27 20:42:4567void warn(const char *fmt, ...) { LOG_ERROR("Warning"); }
Tom Finegan00a35aa2013-11-14 20:37:4268
Dmitry Kovalev7ec27692014-01-27 21:40:2969void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
70 const char *detail = vpx_codec_error_detail(ctx);
71
72 printf("%s: %s\n", s, vpx_codec_error(ctx));
clang-format99e28b82016-01-27 20:42:4573 if (detail) printf(" %s\n", detail);
Dmitry Kovalev7ec27692014-01-27 21:40:2974 exit(EXIT_FAILURE);
75}
76
Tom Finegan00a35aa2013-11-14 20:37:4277int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) {
78 FILE *f = input_ctx->file;
79 struct FileTypeDetectionBuffer *detect = &input_ctx->detect;
80 int plane = 0;
81 int shortread = 0;
Deb Mukherjee5acfafb2014-08-26 19:35:1582 const int bytespp = (yuv_frame->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
Tom Finegan00a35aa2013-11-14 20:37:4283
84 for (plane = 0; plane < 3; ++plane) {
85 uint8_t *ptr;
Deb Mukherjee449e5f22014-07-11 18:43:3186 const int w = vpx_img_plane_width(yuv_frame, plane);
87 const int h = vpx_img_plane_height(yuv_frame, plane);
Tom Finegan00a35aa2013-11-14 20:37:4288 int r;
89
90 /* Determine the correct plane based on the image format. The for-loop
91 * always counts in Y,U,V order, but this may not match the order of
92 * the data on disk.
93 */
94 switch (plane) {
95 case 1:
clang-format99e28b82016-01-27 20:42:4596 ptr =
97 yuv_frame->planes[yuv_frame->fmt == VPX_IMG_FMT_YV12 ? VPX_PLANE_V
98 : VPX_PLANE_U];
Tom Finegan00a35aa2013-11-14 20:37:4299 break;
100 case 2:
clang-format99e28b82016-01-27 20:42:45101 ptr =
102 yuv_frame->planes[yuv_frame->fmt == VPX_IMG_FMT_YV12 ? VPX_PLANE_U
103 : VPX_PLANE_V];
Tom Finegan00a35aa2013-11-14 20:37:42104 break;
clang-format99e28b82016-01-27 20:42:45105 default: ptr = yuv_frame->planes[plane];
Tom Finegan00a35aa2013-11-14 20:37:42106 }
107
108 for (r = 0; r < h; ++r) {
Deb Mukherjee449e5f22014-07-11 18:43:31109 size_t needed = w * bytespp;
Tom Finegan00a35aa2013-11-14 20:37:42110 size_t buf_position = 0;
111 const size_t left = detect->buf_read - detect->position;
112 if (left > 0) {
113 const size_t more = (left < needed) ? left : needed;
114 memcpy(ptr, detect->buf + detect->position, more);
115 buf_position = more;
116 needed -= more;
117 detect->position += more;
118 }
119 if (needed > 0) {
120 shortread |= (fread(ptr + buf_position, 1, needed, f) < needed);
121 }
122
123 ptr += yuv_frame->stride[plane];
124 }
125 }
126
127 return shortread;
128}
Dmitry Kovalev7ec27692014-01-27 21:40:29129
James Zern8465c932015-08-10 23:45:49130#if CONFIG_ENCODERS
131
Dmitry Kovalev70d96642014-02-12 05:12:23132static const VpxInterface vpx_encoders[] = {
Jingning Han5dccce52015-08-15 22:57:54133#if CONFIG_VP10_ENCODER
clang-format99e28b82016-01-27 20:42:45134 { "vp10", VP10_FOURCC, &vpx_codec_vp10_cx },
Jingning Han5dccce52015-08-15 22:57:54135#endif
Dmitry Kovalev70d96642014-02-12 05:12:23136};
137
James Zern5a73bbd2015-05-09 17:40:51138int get_vpx_encoder_count(void) {
Dmitry Kovalev70d96642014-02-12 05:12:23139 return sizeof(vpx_encoders) / sizeof(vpx_encoders[0]);
140}
141
clang-format99e28b82016-01-27 20:42:45142const VpxInterface *get_vpx_encoder_by_index(int i) { return &vpx_encoders[i]; }
Dmitry Kovalev70d96642014-02-12 05:12:23143
144const VpxInterface *get_vpx_encoder_by_name(const char *name) {
145 int i;
146
147 for (i = 0; i < get_vpx_encoder_count(); ++i) {
148 const VpxInterface *encoder = get_vpx_encoder_by_index(i);
clang-format99e28b82016-01-27 20:42:45149 if (strcmp(encoder->name, name) == 0) return encoder;
Dmitry Kovalev7ec27692014-01-27 21:40:29150 }
Dmitry Kovalev70d96642014-02-12 05:12:23151
152 return NULL;
153}
154
James Zern8465c932015-08-10 23:45:49155#endif // CONFIG_ENCODERS
156
157#if CONFIG_DECODERS
158
Dmitry Kovalev70d96642014-02-12 05:12:23159static const VpxInterface vpx_decoders[] = {
Jingning Han3ee6db62015-08-06 02:00:31160#if CONFIG_VP10_DECODER
clang-format99e28b82016-01-27 20:42:45161 { "vp10", VP10_FOURCC, &vpx_codec_vp10_dx },
Jingning Han3ee6db62015-08-06 02:00:31162#endif
Dmitry Kovalev70d96642014-02-12 05:12:23163};
164
James Zernd1999cb2015-05-09 17:41:54165int get_vpx_decoder_count(void) {
Dmitry Kovalev70d96642014-02-12 05:12:23166 return sizeof(vpx_decoders) / sizeof(vpx_decoders[0]);
167}
168
clang-format99e28b82016-01-27 20:42:45169const VpxInterface *get_vpx_decoder_by_index(int i) { return &vpx_decoders[i]; }
Dmitry Kovalev70d96642014-02-12 05:12:23170
171const VpxInterface *get_vpx_decoder_by_name(const char *name) {
172 int i;
173
174 for (i = 0; i < get_vpx_decoder_count(); ++i) {
clang-format99e28b82016-01-27 20:42:45175 const VpxInterface *const decoder = get_vpx_decoder_by_index(i);
176 if (strcmp(decoder->name, name) == 0) return decoder;
Dmitry Kovalev70d96642014-02-12 05:12:23177 }
178
179 return NULL;
180}
181
182const VpxInterface *get_vpx_decoder_by_fourcc(uint32_t fourcc) {
183 int i;
184
185 for (i = 0; i < get_vpx_decoder_count(); ++i) {
186 const VpxInterface *const decoder = get_vpx_decoder_by_index(i);
clang-format99e28b82016-01-27 20:42:45187 if (decoder->fourcc == fourcc) return decoder;
Dmitry Kovalev70d96642014-02-12 05:12:23188 }
189
Dmitry Kovalev7ec27692014-01-27 21:40:29190 return NULL;
191}
192
James Zern8465c932015-08-10 23:45:49193#endif // CONFIG_DECODERS
194
Dmitry Kovalev2bdd43d2014-02-13 02:36:36195// TODO(dkovalev): move this function to vpx_image.{c, h}, so it will be part
196// of vpx_image_t support
197int vpx_img_plane_width(const vpx_image_t *img, int plane) {
198 if (plane > 0 && img->x_chroma_shift > 0)
199 return (img->d_w + 1) >> img->x_chroma_shift;
200 else
201 return img->d_w;
202}
203
204int vpx_img_plane_height(const vpx_image_t *img, int plane) {
clang-format99e28b82016-01-27 20:42:45205 if (plane > 0 && img->y_chroma_shift > 0)
Dmitry Kovalev2bdd43d2014-02-13 02:36:36206 return (img->d_h + 1) >> img->y_chroma_shift;
207 else
208 return img->d_h;
209}
210
Dmitry Kovalev7ec27692014-01-27 21:40:29211void vpx_img_write(const vpx_image_t *img, FILE *file) {
Dmitry Kovalev2bdd43d2014-02-13 02:36:36212 int plane;
Dmitry Kovalev7ec27692014-01-27 21:40:29213
214 for (plane = 0; plane < 3; ++plane) {
215 const unsigned char *buf = img->planes[plane];
216 const int stride = img->stride[plane];
Deb Mukherjee9ed23de2014-09-25 22:46:50217 const int w = vpx_img_plane_width(img, plane) *
clang-format99e28b82016-01-27 20:42:45218 ((img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1);
Dmitry Kovalev2bdd43d2014-02-13 02:36:36219 const int h = vpx_img_plane_height(img, plane);
220 int y;
Dmitry Kovalev592936b2014-02-07 19:37:39221
Dmitry Kovalev7ec27692014-01-27 21:40:29222 for (y = 0; y < h; ++y) {
223 fwrite(buf, 1, w, file);
224 buf += stride;
225 }
226 }
227}
Dmitry Kovalev592936b2014-02-07 19:37:39228
229int vpx_img_read(vpx_image_t *img, FILE *file) {
230 int plane;
231
232 for (plane = 0; plane < 3; ++plane) {
233 unsigned char *buf = img->planes[plane];
234 const int stride = img->stride[plane];
Deb Mukherjee5acfafb2014-08-26 19:35:15235 const int w = vpx_img_plane_width(img, plane) *
clang-format99e28b82016-01-27 20:42:45236 ((img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1);
Dmitry Kovalev2bdd43d2014-02-13 02:36:36237 const int h = vpx_img_plane_height(img, plane);
Dmitry Kovalev592936b2014-02-07 19:37:39238 int y;
239
240 for (y = 0; y < h; ++y) {
clang-format99e28b82016-01-27 20:42:45241 if (fread(buf, 1, w, file) != (size_t)w) return 0;
Dmitry Kovalev592936b2014-02-07 19:37:39242 buf += stride;
243 }
244 }
245
246 return 1;
247}
248
Dmitry Kovalev2dad0e12014-02-27 22:00:41249// TODO(dkovalev) change sse_to_psnr signature: double -> int64_t
250double sse_to_psnr(double samples, double peak, double sse) {
251 static const double kMaxPSNR = 100.0;
252
253 if (sse > 0.0) {
254 const double psnr = 10.0 * log10(samples * peak * peak / sse);
255 return psnr > kMaxPSNR ? kMaxPSNR : psnr;
256 } else {
257 return kMaxPSNR;
258 }
259}
Deb Mukherjee7a2a6112014-10-07 03:46:11260
261// TODO(debargha): Consolidate the functions below into a separate file.
Yaowu Xu3246fc02016-01-21 00:13:04262#if CONFIG_VPX_HIGHBITDEPTH
Deb Mukherjee7a2a6112014-10-07 03:46:11263static void highbd_img_upshift(vpx_image_t *dst, vpx_image_t *src,
264 int input_shift) {
265 // Note the offset is 1 less than half.
266 const int offset = input_shift > 0 ? (1 << (input_shift - 1)) - 1 : 0;
267 int plane;
Deb Mukherjee23fc1f72014-10-15 17:01:34268 if (dst->d_w != src->d_w || dst->d_h != src->d_h ||
Deb Mukherjee7a2a6112014-10-07 03:46:11269 dst->x_chroma_shift != src->x_chroma_shift ||
clang-format99e28b82016-01-27 20:42:45270 dst->y_chroma_shift != src->y_chroma_shift || dst->fmt != src->fmt ||
271 input_shift < 0) {
Deb Mukherjee7a2a6112014-10-07 03:46:11272 fatal("Unsupported image conversion");
273 }
274 switch (src->fmt) {
275 case VPX_IMG_FMT_I42016:
276 case VPX_IMG_FMT_I42216:
277 case VPX_IMG_FMT_I44416:
clang-format99e28b82016-01-27 20:42:45278 case VPX_IMG_FMT_I44016: break;
279 default: fatal("Unsupported image conversion"); break;
Deb Mukherjee7a2a6112014-10-07 03:46:11280 }
281 for (plane = 0; plane < 3; plane++) {
Deb Mukherjee23fc1f72014-10-15 17:01:34282 int w = src->d_w;
283 int h = src->d_h;
Deb Mukherjee7a2a6112014-10-07 03:46:11284 int x, y;
285 if (plane) {
Deb Mukherjee23fc1f72014-10-15 17:01:34286 w = (w + src->x_chroma_shift) >> src->x_chroma_shift;
287 h = (h + src->y_chroma_shift) >> src->y_chroma_shift;
Deb Mukherjee7a2a6112014-10-07 03:46:11288 }
289 for (y = 0; y < h; y++) {
290 uint16_t *p_src =
291 (uint16_t *)(src->planes[plane] + y * src->stride[plane]);
292 uint16_t *p_dst =
293 (uint16_t *)(dst->planes[plane] + y * dst->stride[plane]);
clang-format99e28b82016-01-27 20:42:45294 for (x = 0; x < w; x++) *p_dst++ = (*p_src++ << input_shift) + offset;
Deb Mukherjee7a2a6112014-10-07 03:46:11295 }
296 }
297}
298
299static void lowbd_img_upshift(vpx_image_t *dst, vpx_image_t *src,
300 int input_shift) {
301 // Note the offset is 1 less than half.
302 const int offset = input_shift > 0 ? (1 << (input_shift - 1)) - 1 : 0;
303 int plane;
Deb Mukherjee23fc1f72014-10-15 17:01:34304 if (dst->d_w != src->d_w || dst->d_h != src->d_h ||
Deb Mukherjee7a2a6112014-10-07 03:46:11305 dst->x_chroma_shift != src->x_chroma_shift ||
306 dst->y_chroma_shift != src->y_chroma_shift ||
clang-format99e28b82016-01-27 20:42:45307 dst->fmt != src->fmt + VPX_IMG_FMT_HIGHBITDEPTH || input_shift < 0) {
Deb Mukherjee7a2a6112014-10-07 03:46:11308 fatal("Unsupported image conversion");
309 }
310 switch (src->fmt) {
311 case VPX_IMG_FMT_I420:
312 case VPX_IMG_FMT_I422:
313 case VPX_IMG_FMT_I444:
clang-format99e28b82016-01-27 20:42:45314 case VPX_IMG_FMT_I440: break;
315 default: fatal("Unsupported image conversion"); break;
Deb Mukherjee7a2a6112014-10-07 03:46:11316 }
317 for (plane = 0; plane < 3; plane++) {
Deb Mukherjee23fc1f72014-10-15 17:01:34318 int w = src->d_w;
319 int h = src->d_h;
Deb Mukherjee7a2a6112014-10-07 03:46:11320 int x, y;
321 if (plane) {
322 w = (w + src->x_chroma_shift) >> src->x_chroma_shift;
323 h = (h + src->y_chroma_shift) >> src->y_chroma_shift;
324 }
325 for (y = 0; y < h; y++) {
326 uint8_t *p_src = src->planes[plane] + y * src->stride[plane];
327 uint16_t *p_dst =
328 (uint16_t *)(dst->planes[plane] + y * dst->stride[plane]);
329 for (x = 0; x < w; x++) {
330 *p_dst++ = (*p_src++ << input_shift) + offset;
331 }
332 }
333 }
334}
335
clang-format99e28b82016-01-27 20:42:45336void vpx_img_upshift(vpx_image_t *dst, vpx_image_t *src, int input_shift) {
Deb Mukherjee7a2a6112014-10-07 03:46:11337 if (src->fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
338 highbd_img_upshift(dst, src, input_shift);
339 } else {
340 lowbd_img_upshift(dst, src, input_shift);
341 }
342}
343
344void vpx_img_truncate_16_to_8(vpx_image_t *dst, vpx_image_t *src) {
345 int plane;
clang-format99e28b82016-01-27 20:42:45346 if (dst->fmt + VPX_IMG_FMT_HIGHBITDEPTH != src->fmt || dst->d_w != src->d_w ||
347 dst->d_h != src->d_h || dst->x_chroma_shift != src->x_chroma_shift ||
Deb Mukherjee7a2a6112014-10-07 03:46:11348 dst->y_chroma_shift != src->y_chroma_shift) {
349 fatal("Unsupported image conversion");
350 }
351 switch (dst->fmt) {
352 case VPX_IMG_FMT_I420:
353 case VPX_IMG_FMT_I422:
354 case VPX_IMG_FMT_I444:
clang-format99e28b82016-01-27 20:42:45355 case VPX_IMG_FMT_I440: break;
356 default: fatal("Unsupported image conversion"); break;
Deb Mukherjee7a2a6112014-10-07 03:46:11357 }
358 for (plane = 0; plane < 3; plane++) {
359 int w = src->d_w;
360 int h = src->d_h;
361 int x, y;
362 if (plane) {
Deb Mukherjee23fc1f72014-10-15 17:01:34363 w = (w + src->x_chroma_shift) >> src->x_chroma_shift;
364 h = (h + src->y_chroma_shift) >> src->y_chroma_shift;
Deb Mukherjee7a2a6112014-10-07 03:46:11365 }
366 for (y = 0; y < h; y++) {
367 uint16_t *p_src =
368 (uint16_t *)(src->planes[plane] + y * src->stride[plane]);
369 uint8_t *p_dst = dst->planes[plane] + y * dst->stride[plane];
370 for (x = 0; x < w; x++) {
Yaowu Xuc369daf2015-07-07 21:22:07371 *p_dst++ = (uint8_t)(*p_src++);
Deb Mukherjee7a2a6112014-10-07 03:46:11372 }
373 }
374 }
375}
376
377static void highbd_img_downshift(vpx_image_t *dst, vpx_image_t *src,
378 int down_shift) {
379 int plane;
380 if (dst->d_w != src->d_w || dst->d_h != src->d_h ||
381 dst->x_chroma_shift != src->x_chroma_shift ||
clang-format99e28b82016-01-27 20:42:45382 dst->y_chroma_shift != src->y_chroma_shift || dst->fmt != src->fmt ||
383 down_shift < 0) {
Deb Mukherjee7a2a6112014-10-07 03:46:11384 fatal("Unsupported image conversion");
385 }
386 switch (src->fmt) {
387 case VPX_IMG_FMT_I42016:
388 case VPX_IMG_FMT_I42216:
389 case VPX_IMG_FMT_I44416:
clang-format99e28b82016-01-27 20:42:45390 case VPX_IMG_FMT_I44016: break;
391 default: fatal("Unsupported image conversion"); break;
Deb Mukherjee7a2a6112014-10-07 03:46:11392 }
393 for (plane = 0; plane < 3; plane++) {
394 int w = src->d_w;
395 int h = src->d_h;
396 int x, y;
397 if (plane) {
398 w = (w + src->x_chroma_shift) >> src->x_chroma_shift;
399 h = (h + src->y_chroma_shift) >> src->y_chroma_shift;
400 }
401 for (y = 0; y < h; y++) {
402 uint16_t *p_src =
403 (uint16_t *)(src->planes[plane] + y * src->stride[plane]);
404 uint16_t *p_dst =
405 (uint16_t *)(dst->planes[plane] + y * dst->stride[plane]);
clang-format99e28b82016-01-27 20:42:45406 for (x = 0; x < w; x++) *p_dst++ = *p_src++ >> down_shift;
Deb Mukherjee7a2a6112014-10-07 03:46:11407 }
408 }
409}
410
411static void lowbd_img_downshift(vpx_image_t *dst, vpx_image_t *src,
412 int down_shift) {
413 int plane;
414 if (dst->d_w != src->d_w || dst->d_h != src->d_h ||
415 dst->x_chroma_shift != src->x_chroma_shift ||
416 dst->y_chroma_shift != src->y_chroma_shift ||
clang-format99e28b82016-01-27 20:42:45417 src->fmt != dst->fmt + VPX_IMG_FMT_HIGHBITDEPTH || down_shift < 0) {
Deb Mukherjee7a2a6112014-10-07 03:46:11418 fatal("Unsupported image conversion");
419 }
420 switch (dst->fmt) {
421 case VPX_IMG_FMT_I420:
422 case VPX_IMG_FMT_I422:
423 case VPX_IMG_FMT_I444:
clang-format99e28b82016-01-27 20:42:45424 case VPX_IMG_FMT_I440: break;
425 default: fatal("Unsupported image conversion"); break;
Deb Mukherjee7a2a6112014-10-07 03:46:11426 }
427 for (plane = 0; plane < 3; plane++) {
428 int w = src->d_w;
429 int h = src->d_h;
430 int x, y;
431 if (plane) {
432 w = (w + src->x_chroma_shift) >> src->x_chroma_shift;
433 h = (h + src->y_chroma_shift) >> src->y_chroma_shift;
434 }
435 for (y = 0; y < h; y++) {
436 uint16_t *p_src =
437 (uint16_t *)(src->planes[plane] + y * src->stride[plane]);
438 uint8_t *p_dst = dst->planes[plane] + y * dst->stride[plane];
439 for (x = 0; x < w; x++) {
440 *p_dst++ = *p_src++ >> down_shift;
441 }
442 }
443 }
444}
445
clang-format99e28b82016-01-27 20:42:45446void vpx_img_downshift(vpx_image_t *dst, vpx_image_t *src, int down_shift) {
Deb Mukherjee7a2a6112014-10-07 03:46:11447 if (dst->fmt & VPX_IMG_FMT_HIGHBITDEPTH) {
448 highbd_img_downshift(dst, src, down_shift);
449 } else {
450 lowbd_img_downshift(dst, src, down_shift);
451 }
452}
Yaowu Xu3246fc02016-01-21 00:13:04453#endif // CONFIG_VPX_HIGHBITDEPTH