Commit 5acfafb1 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Adds config opt for highbitdepth + misc. vpx

Adds config parameter vp9_highbitdepth, to support highbitdepth profiles.
Also includes most vpx level high bit-depth functions. However
encode/decode in the highbitdepth profiles will not work until
the rest of the code is in place.

Change-Id: I34c53b253c38873611057a6cbc89a1361b8985a6
parent 72037944
...@@ -334,6 +334,7 @@ CONFIG_LIST=" ...@@ -334,6 +334,7 @@ CONFIG_LIST="
multi_res_encoding multi_res_encoding
temporal_denoising temporal_denoising
coefficient_range_checking coefficient_range_checking
vp9_highbitdepth
experimental experimental
size_limit size_limit
${EXPERIMENT_LIST} ${EXPERIMENT_LIST}
...@@ -392,6 +393,7 @@ CMDLINE_SELECT=" ...@@ -392,6 +393,7 @@ CMDLINE_SELECT="
multi_res_encoding multi_res_encoding
temporal_denoising temporal_denoising
coefficient_range_checking coefficient_range_checking
vp9_highbitdepth
experimental experimental
" "
......
...@@ -28,7 +28,8 @@ class MD5 { ...@@ -28,7 +28,8 @@ class MD5 {
// plane, we never want to round down and thus skip a pixel so if // plane, we never want to round down and thus skip a pixel so if
// we are shifting by 1 (chroma_shift) we add 1 before doing the shift. // we are shifting by 1 (chroma_shift) we add 1 before doing the shift.
// This works only for chroma_shift of 0 and 1. // This works only for chroma_shift of 0 and 1.
const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGH) ? 2 : 1; const int bytes_per_sample =
(img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
const int h = plane ? (img->d_h + img->y_chroma_shift) >> const int h = plane ? (img->d_h + img->y_chroma_shift) >>
img->y_chroma_shift : img->d_h; img->y_chroma_shift : img->d_h;
const int w = (plane ? (img->d_w + img->x_chroma_shift) >> const int w = (plane ? (img->d_w + img->x_chroma_shift) >>
......
...@@ -57,7 +57,7 @@ static void write_image_file(const vpx_image_t *img, FILE *file) { ...@@ -57,7 +57,7 @@ static void write_image_file(const vpx_image_t *img, FILE *file) {
for (plane = 0; plane < 3; ++plane) { for (plane = 0; plane < 3; ++plane) {
const unsigned char *buf = img->planes[plane]; const unsigned char *buf = img->planes[plane];
const int stride = img->stride[plane]; const int stride = img->stride[plane];
const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGH) ? 2 : 1; const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
const int h = (plane ? (img->d_h + img->y_chroma_shift) >> const int h = (plane ? (img->d_h + img->y_chroma_shift) >>
img->y_chroma_shift : img->d_h); img->y_chroma_shift : img->d_h);
const int w = (plane ? (img->d_w + img->x_chroma_shift) >> const int w = (plane ? (img->d_w + img->x_chroma_shift) >>
......
...@@ -83,7 +83,7 @@ int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) { ...@@ -83,7 +83,7 @@ int read_yuv_frame(struct VpxInputContext *input_ctx, vpx_image_t *yuv_frame) {
struct FileTypeDetectionBuffer *detect = &input_ctx->detect; struct FileTypeDetectionBuffer *detect = &input_ctx->detect;
int plane = 0; int plane = 0;
int shortread = 0; int shortread = 0;
const int bytespp = (yuv_frame->fmt & VPX_IMG_FMT_HIGH) ? 2 : 1; const int bytespp = (yuv_frame->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
for (plane = 0; plane < 3; ++plane) { for (plane = 0; plane < 3; ++plane) {
uint8_t *ptr; uint8_t *ptr;
...@@ -241,7 +241,8 @@ int vpx_img_read(vpx_image_t *img, FILE *file) { ...@@ -241,7 +241,8 @@ int vpx_img_read(vpx_image_t *img, FILE *file) {
for (plane = 0; plane < 3; ++plane) { for (plane = 0; plane < 3; ++plane) {
unsigned char *buf = img->planes[plane]; unsigned char *buf = img->planes[plane];
const int stride = img->stride[plane]; const int stride = img->stride[plane];
const int w = vpx_img_plane_width(img, plane); const int w = vpx_img_plane_width(img, plane) *
((img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1);
const int h = vpx_img_plane_height(img, plane); const int h = vpx_img_plane_height(img, plane);
int y; int y;
......
...@@ -1244,6 +1244,9 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = ...@@ -1244,6 +1244,9 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
320, /* g_width */ 320, /* g_width */
240, /* g_height */ 240, /* g_height */
VPX_BITS_8, /* g_bit_depth */
8, /* g_input_bit_depth */
{1, 30}, /* g_timebase */ {1, 30}, /* g_timebase */
0, /* g_error_resilient */ 0, /* g_error_resilient */
......
...@@ -177,7 +177,11 @@ int vp9_alloc_ref_frame_buffers(VP9_COMMON *cm, int width, int height) { ...@@ -177,7 +177,11 @@ int vp9_alloc_ref_frame_buffers(VP9_COMMON *cm, int width, int height) {
for (i = 0; i < FRAME_BUFFERS; ++i) { for (i = 0; i < FRAME_BUFFERS; ++i) {
cm->frame_bufs[i].ref_count = 0; cm->frame_bufs[i].ref_count = 0;
if (vp9_alloc_frame_buffer(&cm->frame_bufs[i].buf, width, height, if (vp9_alloc_frame_buffer(&cm->frame_bufs[i].buf, width, height,
ss_x, ss_y, VP9_ENC_BORDER_IN_PIXELS) < 0) ss_x, ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS) < 0)
goto fail; goto fail;
} }
...@@ -185,6 +189,9 @@ int vp9_alloc_ref_frame_buffers(VP9_COMMON *cm, int width, int height) { ...@@ -185,6 +189,9 @@ int vp9_alloc_ref_frame_buffers(VP9_COMMON *cm, int width, int height) {
#if CONFIG_INTERNAL_STATS || CONFIG_VP9_POSTPROC #if CONFIG_INTERNAL_STATS || CONFIG_VP9_POSTPROC
if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y, if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, width, height, ss_x, ss_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS) < 0) VP9_ENC_BORDER_IN_PIXELS) < 0)
goto fail; goto fail;
#endif #endif
......
...@@ -64,6 +64,11 @@ static INLINE int get_unsigned_bits(unsigned int num_values) { ...@@ -64,6 +64,11 @@ static INLINE int get_unsigned_bits(unsigned int num_values) {
return num_values > 0 ? get_msb(num_values) + 1 : 0; return num_values > 0 ? get_msb(num_values) + 1 : 0;
} }
#if CONFIG_VP9_HIGHBITDEPTH
#define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1))
#define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 ))
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_DEBUG #if CONFIG_DEBUG
#define CHECK_MEM_ERROR(cm, lval, expr) do { \ #define CHECK_MEM_ERROR(cm, lval, expr) do { \
lval = (expr); \ lval = (expr); \
......
...@@ -40,12 +40,6 @@ typedef enum BITSTREAM_PROFILE { ...@@ -40,12 +40,6 @@ typedef enum BITSTREAM_PROFILE {
MAX_PROFILES MAX_PROFILES
} BITSTREAM_PROFILE; } BITSTREAM_PROFILE;
typedef enum BIT_DEPTH {
BITS_8,
BITS_10,
BITS_12
} BIT_DEPTH;
typedef enum BLOCK_SIZE { typedef enum BLOCK_SIZE {
BLOCK_4X4, BLOCK_4X4,
BLOCK_4X8, BLOCK_4X8,
......
...@@ -84,6 +84,10 @@ typedef struct VP9Common { ...@@ -84,6 +84,10 @@ typedef struct VP9Common {
int subsampling_x; int subsampling_x;
int subsampling_y; int subsampling_y;
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth; // Marks if we need to use 16bit frame buffers.
#endif
YV12_BUFFER_CONFIG *frame_to_show; YV12_BUFFER_CONFIG *frame_to_show;
RefCntBuffer frame_bufs[FRAME_BUFFERS]; RefCntBuffer frame_bufs[FRAME_BUFFERS];
...@@ -179,8 +183,8 @@ typedef struct VP9Common { ...@@ -179,8 +183,8 @@ typedef struct VP9Common {
unsigned int current_video_frame; unsigned int current_video_frame;
BITSTREAM_PROFILE profile; BITSTREAM_PROFILE profile;
// BITS_8 in versions 0 and 1, BITS_10 or BITS_12 in version 2 // VPX_BITS_8 in profile 0 or 1, VPX_BITS_10 or VPX_BITS_12 in profile 2 or 3.
BIT_DEPTH bit_depth; vpx_bit_depth_t bit_depth;
#if CONFIG_VP9_POSTPROC #if CONFIG_VP9_POSTPROC
struct postproc_state postproc_state; struct postproc_state postproc_state;
......
...@@ -653,7 +653,11 @@ static void setup_frame_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { ...@@ -653,7 +653,11 @@ static void setup_frame_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
if (vp9_realloc_frame_buffer( if (vp9_realloc_frame_buffer(
get_frame_new_buffer(cm), cm->width, cm->height, get_frame_new_buffer(cm), cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, VP9_DEC_BORDER_IN_PIXELS, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_DEC_BORDER_IN_PIXELS,
&cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb, &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb,
cm->cb_priv)) { cm->cb_priv)) {
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
...@@ -700,7 +704,11 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm, ...@@ -700,7 +704,11 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
if (vp9_realloc_frame_buffer( if (vp9_realloc_frame_buffer(
get_frame_new_buffer(cm), cm->width, cm->height, get_frame_new_buffer(cm), cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, VP9_DEC_BORDER_IN_PIXELS, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_DEC_BORDER_IN_PIXELS,
&cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb, &cm->frame_bufs[cm->new_fb_idx].raw_frame_buffer, cm->get_fb_cb,
cm->cb_priv)) { cm->cb_priv)) {
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
...@@ -1100,7 +1108,7 @@ BITSTREAM_PROFILE vp9_read_profile(struct vp9_read_bit_buffer *rb) { ...@@ -1100,7 +1108,7 @@ BITSTREAM_PROFILE vp9_read_profile(struct vp9_read_bit_buffer *rb) {
static void read_bitdepth_colorspace_sampling( static void read_bitdepth_colorspace_sampling(
VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
if (cm->profile >= PROFILE_2) if (cm->profile >= PROFILE_2)
cm->bit_depth = vp9_rb_read_bit(rb) ? BITS_12 : BITS_10; cm->bit_depth = vp9_rb_read_bit(rb) ? VPX_BITS_12 : VPX_BITS_10;
cm->color_space = (COLOR_SPACE)vp9_rb_read_literal(rb, 3); cm->color_space = (COLOR_SPACE)vp9_rb_read_literal(rb, 3);
if (cm->color_space != SRGB) { if (cm->color_space != SRGB) {
vp9_rb_read_bit(rb); // [16,235] (including xvycc) vs [0,255] range vp9_rb_read_bit(rb); // [16,235] (including xvycc) vs [0,255] range
...@@ -1144,6 +1152,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi, ...@@ -1144,6 +1152,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
"Invalid frame marker"); "Invalid frame marker");
cm->profile = vp9_read_profile(rb); cm->profile = vp9_read_profile(rb);
if (cm->profile >= MAX_PROFILES) if (cm->profile >= MAX_PROFILES)
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"Unsupported bitstream profile"); "Unsupported bitstream profile");
...@@ -1402,7 +1411,7 @@ void vp9_decode_frame(VP9Decoder *pbi, ...@@ -1402,7 +1411,7 @@ void vp9_decode_frame(VP9Decoder *pbi,
if (!first_partition_size) { if (!first_partition_size) {
// showing a frame directly // showing a frame directly
*p_data_end = data + 1; *p_data_end = data + (cm->profile <= PROFILE_2 ? 1 : 2);
return; return;
} }
......
...@@ -66,6 +66,7 @@ VP9Decoder *vp9_decoder_create() { ...@@ -66,6 +66,7 @@ VP9Decoder *vp9_decoder_create() {
cm->current_video_frame = 0; cm->current_video_frame = 0;
pbi->ready_for_new_data = 1; pbi->ready_for_new_data = 1;
cm->bit_depth = VPX_BITS_8;
// vp9_init_dequantizer() is first called here. Add check in // vp9_init_dequantizer() is first called here. Add check in
// frame_init_dequantizer() to avoid unnecessary calling of // frame_init_dequantizer() to avoid unnecessary calling of
......
...@@ -1046,8 +1046,8 @@ static void write_profile(BITSTREAM_PROFILE profile, ...@@ -1046,8 +1046,8 @@ static void write_profile(BITSTREAM_PROFILE profile,
static void write_bitdepth_colorspace_sampling( static void write_bitdepth_colorspace_sampling(
VP9_COMMON *const cm, struct vp9_write_bit_buffer *wb) { VP9_COMMON *const cm, struct vp9_write_bit_buffer *wb) {
if (cm->profile >= PROFILE_2) { if (cm->profile >= PROFILE_2) {
assert(cm->bit_depth > BITS_8); assert(cm->bit_depth > VPX_BITS_8);
vp9_wb_write_bit(wb, cm->bit_depth - BITS_10); vp9_wb_write_bit(wb, cm->bit_depth == VPX_BITS_10 ? 0 : 1);
} }
vp9_wb_write_literal(wb, cm->color_space, 3); vp9_wb_write_literal(wb, cm->color_space, 3);
if (cm->color_space != SRGB) { if (cm->color_space != SRGB) {
......
...@@ -388,13 +388,21 @@ void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, unsigned int sse, ...@@ -388,13 +388,21 @@ void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, unsigned int sse,
} }
int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
int ssx, int ssy, int border) { int ssx, int ssy,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
int border) {
int i, fail; int i, fail;
assert(denoiser != NULL); assert(denoiser != NULL);
for (i = 0; i < MAX_REF_FRAMES; ++i) { for (i = 0; i < MAX_REF_FRAMES; ++i) {
fail = vp9_alloc_frame_buffer(&denoiser->running_avg_y[i], width, height, fail = vp9_alloc_frame_buffer(&denoiser->running_avg_y[i], width, height,
ssx, ssy, border); ssx, ssy,
#if CONFIG_VP9_HIGHBITDEPTH
use_highbitdepth,
#endif
border);
if (fail) { if (fail) {
vp9_denoiser_free(denoiser); vp9_denoiser_free(denoiser);
return 1; return 1;
...@@ -405,7 +413,11 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, ...@@ -405,7 +413,11 @@ int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
} }
fail = vp9_alloc_frame_buffer(&denoiser->mc_running_avg_y, width, height, fail = vp9_alloc_frame_buffer(&denoiser->mc_running_avg_y, width, height,
ssx, ssy, border); ssx, ssy,
#if CONFIG_VP9_HIGHBITDEPTH
use_highbitdepth,
#endif
border);
if (fail) { if (fail) {
vp9_denoiser_free(denoiser); vp9_denoiser_free(denoiser);
return 1; return 1;
......
...@@ -47,7 +47,11 @@ void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, ...@@ -47,7 +47,11 @@ void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi,
PICK_MODE_CONTEXT *ctx); PICK_MODE_CONTEXT *ctx);
int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height, int vp9_denoiser_alloc(VP9_DENOISER *denoiser, int width, int height,
int ssx, int ssy, int border); int ssx, int ssy,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
int border);
void vp9_denoiser_free(VP9_DENOISER *denoiser); void vp9_denoiser_free(VP9_DENOISER *denoiser);
......
...@@ -443,6 +443,9 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) { ...@@ -443,6 +443,9 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
cpi->lookahead = vp9_lookahead_init(oxcf->width, oxcf->height, cpi->lookahead = vp9_lookahead_init(oxcf->width, oxcf->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
oxcf->lag_in_frames); oxcf->lag_in_frames);
if (!cpi->lookahead) if (!cpi->lookahead)
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
...@@ -451,6 +454,9 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) { ...@@ -451,6 +454,9 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer, if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer,
oxcf->width, oxcf->height, oxcf->width, oxcf->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL)) VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate altref buffer"); "Failed to allocate altref buffer");
...@@ -468,6 +474,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) { ...@@ -468,6 +474,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
if (vp9_realloc_frame_buffer(&cpi->last_frame_uf, if (vp9_realloc_frame_buffer(&cpi->last_frame_uf,
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL)) VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate last frame buffer"); "Failed to allocate last frame buffer");
...@@ -475,6 +484,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) { ...@@ -475,6 +484,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
if (vp9_realloc_frame_buffer(&cpi->scaled_source, if (vp9_realloc_frame_buffer(&cpi->scaled_source,
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL)) VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate scaled source buffer"); "Failed to allocate scaled source buffer");
...@@ -482,6 +494,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) { ...@@ -482,6 +494,9 @@ static void alloc_util_frame_buffers(VP9_COMP *cpi) {
if (vp9_realloc_frame_buffer(&cpi->scaled_last_source, if (vp9_realloc_frame_buffer(&cpi->scaled_last_source,
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL)) VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate scaled last source buffer"); "Failed to allocate scaled last source buffer");
...@@ -514,6 +529,9 @@ static void update_frame_size(VP9_COMP *cpi) { ...@@ -514,6 +529,9 @@ static void update_frame_size(VP9_COMP *cpi) {
if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer, if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer,
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL)) VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to reallocate alt_ref_buffer"); "Failed to reallocate alt_ref_buffer");
...@@ -600,9 +618,9 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { ...@@ -600,9 +618,9 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cm->bit_depth = oxcf->bit_depth; cm->bit_depth = oxcf->bit_depth;
if (cm->profile <= PROFILE_1) if (cm->profile <= PROFILE_1)
assert(cm->bit_depth == BITS_8); assert(cm->bit_depth == VPX_BITS_8);
else else
assert(cm->bit_depth > BITS_8); assert(cm->bit_depth > VPX_BITS_8);
cpi->oxcf = *oxcf; cpi->oxcf = *oxcf;
...@@ -677,6 +695,9 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { ...@@ -677,6 +695,9 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
if (cpi->oxcf.noise_sensitivity > 0) { if (cpi->oxcf.noise_sensitivity > 0) {
vp9_denoiser_alloc(&(cpi->denoiser), cm->width, cm->height, vp9_denoiser_alloc(&(cpi->denoiser), cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS); VP9_ENC_BORDER_IN_PIXELS);
} }
#endif #endif
...@@ -1604,6 +1625,9 @@ void vp9_scale_references(VP9_COMP *cpi) { ...@@ -1604,6 +1625,9 @@ void vp9_scale_references(VP9_COMP *cpi) {
vp9_realloc_frame_buffer(&cm->frame_bufs[new_fb].buf, vp9_realloc_frame_buffer(&cm->frame_bufs[new_fb].buf,
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL); VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
scale_and_extend_frame(ref, &cm->frame_bufs[new_fb].buf); scale_and_extend_frame(ref, &cm->frame_bufs[new_fb].buf);
cpi->scaled_ref_idx[ref_frame - 1] = new_fb; cpi->scaled_ref_idx[ref_frame - 1] = new_fb;
...@@ -2699,6 +2723,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, ...@@ -2699,6 +2723,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
vp9_realloc_frame_buffer(get_frame_new_buffer(cm), vp9_realloc_frame_buffer(get_frame_new_buffer(cm),
cm->width, cm->height, cm->width, cm->height,
cm->subsampling_x, cm->subsampling_y, cm->subsampling_x, cm->subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
cm->use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL); VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL);
alloc_util_frame_buffers(cpi); alloc_util_frame_buffers(cpi);
......
...@@ -114,9 +114,10 @@ typedef enum { ...@@ -114,9 +114,10 @@ typedef enum {
typedef struct VP9EncoderConfig { typedef struct VP9EncoderConfig {
BITSTREAM_PROFILE profile; BITSTREAM_PROFILE profile;
BIT_DEPTH bit_depth; vpx_bit_depth_t bit_depth; // Codec bit-depth.
int width; // width of data passed to the compressor int width; // width of data passed to the compressor
int height; // height of data passed to the compressor int height; // height of data passed to the compressor
unsigned int input_bit_depth; // Input bit depth.
double init_framerate; // set to passed in framerate double init_framerate; // set to passed in framerate
int64_t target_bandwidth; // bandwidth to be used in kilobits per second int64_t target_bandwidth; // bandwidth to be used in kilobits per second
......
...@@ -50,6 +50,9 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width, ...@@ -50,6 +50,9 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
unsigned int height, unsigned int height,
unsigned int subsampling_x, unsigned int subsampling_x,
unsigned int subsampling_y, unsigned int subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
unsigned int depth) { unsigned int depth) {
struct lookahead_ctx *ctx = NULL; struct lookahead_ctx *ctx = NULL;
...@@ -70,6 +73,9 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width, ...@@ -70,6 +73,9 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
for (i = 0; i < depth; i++) for (i = 0; i < depth; i++)
if (vp9_alloc_frame_buffer(&ctx->buf[i].img, if (vp9_alloc_frame_buffer(&ctx->buf[i].img,
width, height, subsampling_x, subsampling_y, width, height, subsampling_x, subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
use_highbitdepth,
#endif
VP9_ENC_BORDER_IN_PIXELS)) VP9_ENC_BORDER_IN_PIXELS))
goto bail; goto bail;
} }
......
...@@ -56,6 +56,9 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width, ...@@ -56,6 +56,9 @@ struct lookahead_ctx *vp9_lookahead_init(unsigned int width,
unsigned int height, unsigned int height,
unsigned int subsampling_x, unsigned int subsampling_x,
unsigned int subsampling_y, unsigned int subsampling_y,
#if CONFIG_VP9_HIGHBITDEPTH
int use_highbitdepth,
#endif
unsigned int depth); unsigned int depth);
......
...@@ -465,6 +465,9 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { ...@@ -465,6 +465,9 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) {
if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used], if (vp9_realloc_frame_buffer(&cpi->svc.scaled_frames[frame_used],
cm->width, cm->height, cm->width, cm->height,