vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffer");
}
+ cm->frame_bufs[cm->new_fb_idx].buf.subsampling_x = cm->subsampling_x;
+ cm->frame_bufs[cm->new_fb_idx].buf.subsampling_y = cm->subsampling_y;
cm->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
}
RefBuffer *const ref_frame = &cm->frame_refs[i];
if (!valid_ref_frame_img_fmt(
ref_frame->buf->bit_depth,
- ref_frame->buf->uv_crop_width < ref_frame->buf->y_crop_width,
- ref_frame->buf->uv_crop_height < ref_frame->buf->y_crop_height,
+ ref_frame->buf->subsampling_x,
+ ref_frame->buf->subsampling_y,
cm->bit_depth,
cm->subsampling_x,
cm->subsampling_y))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffer");
}
+ cm->frame_bufs[cm->new_fb_idx].buf.subsampling_x = cm->subsampling_x;
+ cm->frame_bufs[cm->new_fb_idx].buf.subsampling_y = cm->subsampling_y;
cm->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
}
VP9_COMMON *cm = &cpi->common;
struct vpx_usec_timer timer;
int res = 0;
- const int subsampling_x = sd->uv_width < sd->y_width;
- const int subsampling_y = sd->uv_height < sd->y_height;
+ const int subsampling_x = sd->subsampling_x;
+ const int subsampling_y = sd->subsampling_y;
#if CONFIG_VP9_HIGHBITDEPTH
const int use_highbitdepth = sd->flags & YV12_FLAG_HIGHBITDEPTH;
check_initial_width(cpi, use_highbitdepth, subsampling_x, subsampling_y);
* the Y, U, and V planes, nor other alignment adjustments that
* might be representable by a YV12_BUFFER_CONFIG, so we just
* initialize all the fields.*/
- const int ss_x = yv12->uv_crop_width < yv12->y_crop_width;
- const int ss_y = yv12->uv_crop_height < yv12->y_crop_height;
int bps;
- if (!ss_y) {
- if (!ss_x) {
+ if (!yv12->subsampling_y) {
+ if (!yv12->subsampling_x) {
img->fmt = VPX_IMG_FMT_I444;
bps = 24;
} else {
bps = 16;
}
} else {
- if (!ss_x) {
+ if (!yv12->subsampling_x) {
img->fmt = VPX_IMG_FMT_I440;
bps = 16;
} else {
img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3);
img->d_w = yv12->y_crop_width;
img->d_h = yv12->y_crop_height;
- img->x_chroma_shift = ss_x;
- img->y_chroma_shift = ss_y;
+ img->x_chroma_shift = yv12->subsampling_x;
+ img->y_chroma_shift = yv12->subsampling_y;
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
img->planes[VPX_PLANE_U] = yv12->u_buffer;
img->planes[VPX_PLANE_V] = yv12->v_buffer;
#else
yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
#endif // CONFIG_VP9_HIGHBITDEPTH
+ yv12->subsampling_x = img->x_chroma_shift;
+ yv12->subsampling_y = img->y_chroma_shift;
return VPX_CODEC_OK;
}
ybf->border = border;
ybf->frame_size = (int)frame_size;
+ ybf->subsampling_x = ss_x;
+ ybf->subsampling_y = ss_y;
#if CONFIG_VP9_HIGHBITDEPTH
if (use_highbitdepth) {
int buffer_alloc_sz;
int border;
int frame_size;
+ int subsampling_x;
+ int subsampling_y;
unsigned int bit_depth;
int corrupted;