2010-05-18 19:58:33 +04:00
|
|
|
/*
|
2016-09-02 00:32:49 +03:00
|
|
|
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
|
2010-05-18 19:58:33 +04:00
|
|
|
*
|
2016-09-02 00:32:49 +03:00
|
|
|
* This source code is subject to the terms of the BSD 2 Clause License and
|
|
|
|
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
|
|
|
|
* was not distributed with this source code in the LICENSE file, you can
|
|
|
|
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
|
|
|
|
* Media Patent License 1.0 was not distributed with this source code in the
|
|
|
|
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
2010-05-18 19:58:33 +04:00
|
|
|
*/
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#ifndef AOM_SCALE_YV12CONFIG_H_
|
|
|
|
#define AOM_SCALE_YV12CONFIG_H_
|
2012-12-19 03:31:19 +04:00
|
|
|
|
2010-05-18 19:58:33 +04:00
|
|
|
#ifdef __cplusplus
|
2012-12-19 03:31:19 +04:00
|
|
|
extern "C" {
|
2010-05-18 19:58:33 +04:00
|
|
|
#endif
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#include "./aom_config.h"
|
|
|
|
#include "aom/aom_codec.h"
|
|
|
|
#include "aom/aom_frame_buffer.h"
|
|
|
|
#include "aom/aom_integer.h"
|
2012-12-19 03:31:19 +04:00
|
|
|
|
2016-08-11 03:28:05 +03:00
|
|
|
#define VP8BORDERINPIXELS 32
|
2016-03-07 16:46:39 +03:00
|
|
|
#if CONFIG_EXT_PARTITION
|
2016-08-31 00:01:10 +03:00
|
|
|
#define AOMINNERBORDERINPIXELS 160
|
2016-03-07 16:46:39 +03:00
|
|
|
#else
|
2016-08-31 00:01:10 +03:00
|
|
|
#define AOMINNERBORDERINPIXELS 96
|
2016-03-07 16:46:39 +03:00
|
|
|
#endif // CONFIG_EXT_PARTITION
|
2016-08-31 00:01:10 +03:00
|
|
|
#define AOM_INTERP_EXTEND 4
|
|
|
|
#define AOM_ENC_BORDER_IN_PIXELS 160
|
|
|
|
#define AOM_DEC_BORDER_IN_PIXELS 160
|
2010-05-18 19:58:33 +04:00
|
|
|
|
2014-02-11 08:08:28 +04:00
|
|
|
typedef struct yv12_buffer_config {
|
2016-08-11 03:28:05 +03:00
|
|
|
int y_width;
|
|
|
|
int y_height;
|
|
|
|
int y_crop_width;
|
|
|
|
int y_crop_height;
|
|
|
|
int y_stride;
|
|
|
|
|
|
|
|
int uv_width;
|
|
|
|
int uv_height;
|
|
|
|
int uv_crop_width;
|
|
|
|
int uv_crop_height;
|
|
|
|
int uv_stride;
|
|
|
|
|
|
|
|
int alpha_width;
|
|
|
|
int alpha_height;
|
|
|
|
int alpha_stride;
|
2013-05-16 03:29:20 +04:00
|
|
|
|
2014-02-11 08:08:28 +04:00
|
|
|
uint8_t *y_buffer;
|
|
|
|
uint8_t *u_buffer;
|
|
|
|
uint8_t *v_buffer;
|
|
|
|
uint8_t *alpha_buffer;
|
2010-05-18 19:58:33 +04:00
|
|
|
|
2014-02-11 08:08:28 +04:00
|
|
|
uint8_t *buffer_alloc;
|
2016-08-30 21:48:44 +03:00
|
|
|
size_t buffer_alloc_sz;
|
2014-02-11 08:08:28 +04:00
|
|
|
int border;
|
2016-08-30 21:48:44 +03:00
|
|
|
size_t frame_size;
|
2014-10-01 22:23:57 +04:00
|
|
|
int subsampling_x;
|
|
|
|
int subsampling_y;
|
2014-09-02 23:25:44 +04:00
|
|
|
unsigned int bit_depth;
|
2016-08-31 00:01:10 +03:00
|
|
|
aom_color_space_t color_space;
|
|
|
|
aom_color_range_t color_range;
|
2015-09-26 04:51:55 +03:00
|
|
|
int render_width;
|
|
|
|
int render_height;
|
2010-12-16 18:46:31 +03:00
|
|
|
|
2014-02-11 08:08:28 +04:00
|
|
|
int corrupted;
|
|
|
|
int flags;
|
|
|
|
} YV12_BUFFER_CONFIG;
|
2010-05-18 19:58:33 +04:00
|
|
|
|
2015-02-07 03:32:20 +03:00
|
|
|
#define YV12_FLAG_HIGHBITDEPTH 8
|
2014-08-26 23:35:15 +04:00
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
int aom_alloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
|
2016-08-11 03:28:05 +03:00
|
|
|
int ss_x, int ss_y,
|
2016-08-31 00:01:10 +03:00
|
|
|
#if CONFIG_AOM_HIGHBITDEPTH
|
2014-08-26 23:35:15 +04:00
|
|
|
int use_highbitdepth,
|
|
|
|
#endif
|
2014-12-15 23:00:09 +03:00
|
|
|
int border, int byte_alignment);
|
2014-02-06 05:44:42 +04:00
|
|
|
|
2014-12-15 23:00:09 +03:00
|
|
|
// Updates the yv12 buffer config with the frame buffer. |byte_alignment| must
|
|
|
|
// be a power of 2, from 32 to 1024. 0 sets legacy alignment. If cb is not
|
2016-08-23 02:08:15 +03:00
|
|
|
// NULL, then libaom is using the frame buffer callbacks to handle memory.
|
|
|
|
// If cb is not NULL, libaom will call cb with minimum size in bytes needed
|
|
|
|
// to decode the current frame. If cb is NULL, libaom will allocate memory
|
2014-02-11 08:08:28 +04:00
|
|
|
// internally to decode the current frame. Returns 0 on success. Returns < 0
|
|
|
|
// on failure.
|
2016-08-31 00:01:10 +03:00
|
|
|
int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height,
|
2016-08-11 03:28:05 +03:00
|
|
|
int ss_x, int ss_y,
|
2016-08-31 00:01:10 +03:00
|
|
|
#if CONFIG_AOM_HIGHBITDEPTH
|
2014-08-26 23:35:15 +04:00
|
|
|
int use_highbitdepth,
|
|
|
|
#endif
|
2016-08-11 03:28:05 +03:00
|
|
|
int border, int byte_alignment,
|
2016-08-31 00:01:10 +03:00
|
|
|
aom_codec_frame_buffer_t *fb,
|
|
|
|
aom_get_frame_buffer_cb_fn_t cb, void *cb_priv);
|
|
|
|
int aom_free_frame_buffer(YV12_BUFFER_CONFIG *ybf);
|
2013-05-07 02:52:06 +04:00
|
|
|
|
2010-05-18 19:58:33 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-08-31 00:01:10 +03:00
|
|
|
#endif // AOM_SCALE_YV12CONFIG_H_
|