Remove unfinished VP9 alpha channel.

Change-Id: Ic5d3a3a0dac10b49495771886a31e793bb78b5ca
This commit is contained in:
Alex Converse 2014-07-17 11:29:59 -07:00
parent 765485cab2
commit 5926e7c0e8
17 changed files with 47 additions and 157 deletions

1
configure vendored
View File

@ -271,7 +271,6 @@ HAVE_LIST="
unistd_h
"
EXPERIMENT_LIST="
alpha
multiple_arf
spatial_svc
denoising

View File

@ -146,10 +146,4 @@ void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
xd->plane[i].subsampling_x = i ? ss_x : 0;
xd->plane[i].subsampling_y = i ? ss_y : 0;
}
#if CONFIG_ALPHA
// TODO(jkoleszar): Using the Y w/h for now
xd->plane[3].plane_type = PLANE_TYPE_Y;
xd->plane[3].subsampling_x = 0;
xd->plane[3].subsampling_y = 0;
#endif
}

View File

@ -168,11 +168,7 @@ enum mv_precision {
MV_PRECISION_Q4
};
#if CONFIG_ALPHA
enum { MAX_MB_PLANE = 4 };
#else
enum { MAX_MB_PLANE = 3 };
#endif
struct buf_2d {
uint8_t *buf;

View File

@ -27,10 +27,10 @@ extern "C" {
// Bitstream profiles indicated by 2-3 bits in the uncompressed header.
// 00: Profile 0. 8-bit 4:2:0 only.
// 10: Profile 1. Adds 4:4:4, 4:2:2, alpha to Profile 0.
// 10: Profile 1. Adds 4:4:4, 4:2:2, and 4:4:0 to Profile 0.
// 01: Profile 2. Supports 10-bit and 12-bit color only, with 4:2:0 sampling.
// 110: Profile 3. Supports 10-bit and 12-bit color only, with 4:2:2/4:4:4
// sampling and alpha.
// 110: Profile 3. Supports 10-bit and 12-bit color only, with 4:2:2/4:4:4/4:4:0
// subsampling.
// 111: Undefined profile.
typedef enum BITSTREAM_PROFILE {
PROFILE_0,

View File

@ -68,9 +68,6 @@ typedef struct VP9Common {
DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]);
#if CONFIG_ALPHA
DECLARE_ALIGNED(16, int16_t, a_dequant[QINDEX_RANGE][8]);
#endif
COLOR_SPACE color_space;
@ -134,10 +131,6 @@ typedef struct VP9Common {
int y_dc_delta_q;
int uv_dc_delta_q;
int uv_ac_delta_q;
#if CONFIG_ALPHA
int a_dc_delta_q;
int a_ac_delta_q;
#endif
/* We allocate a MODE_INFO struct for each macroblock, together with
an extra row on top and column on the left to simplify prediction. */

View File

@ -263,19 +263,13 @@ void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
+ 0.0065 + 0.5);
int i;
const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
src->alpha_buffer};
const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
src->alpha_stride};
const int src_widths[4] = {src->y_width, src->uv_width, src->uv_width,
src->alpha_width};
const int src_heights[4] = {src->y_height, src->uv_height, src->uv_height,
src->alpha_height};
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer,
dst->alpha_buffer};
const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride,
dst->alpha_stride};
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
for (i = 0; i < MAX_MB_PLANE; ++i)
vp9_post_proc_down_and_across(srcs[i], dsts[i],
@ -289,19 +283,13 @@ void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst,
+ 0.0065 + 0.5);
int i;
const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
src->alpha_buffer};
const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
src->alpha_stride};
const int src_widths[4] = {src->y_width, src->uv_width, src->uv_width,
src->alpha_width};
const int src_heights[4] = {src->y_height, src->uv_height, src->uv_height,
src->alpha_height};
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
const int src_widths[3] = {src->y_width, src->uv_width, src->uv_width};
const int src_heights[3] = {src->y_height, src->uv_height, src->uv_height};
uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer,
dst->alpha_buffer};
const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride,
dst->alpha_stride};
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
for (i = 0; i < MAX_MB_PLANE; ++i) {
const int src_stride = src_strides[i];

View File

@ -1134,14 +1134,18 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) {
cm->subsampling_x = vp9_rb_read_bit(rb);
cm->subsampling_y = vp9_rb_read_bit(rb);
vp9_rb_read_bit(rb); // has extra plane
if (vp9_rb_read_bit(rb))
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"Reserved bit set");
} else {
cm->subsampling_y = cm->subsampling_x = 1;
}
} else {
if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) {
cm->subsampling_y = cm->subsampling_x = 0;
vp9_rb_read_bit(rb); // has extra plane
if (vp9_rb_read_bit(rb))
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"Reserved bit set");
} else {
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"4:4:4 color not supported in profile 0");

View File

@ -1068,11 +1068,11 @@ static void write_uncompressed_header(VP9_COMP *cpi,
if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) {
vp9_wb_write_bit(wb, cm->subsampling_x);
vp9_wb_write_bit(wb, cm->subsampling_y);
vp9_wb_write_bit(wb, 0); // has extra plane
vp9_wb_write_bit(wb, 0); // unused
}
} else {
assert(cm->profile == PROFILE_1 || cm->profile == PROFILE_3);
vp9_wb_write_bit(wb, 0); // has extra plane
vp9_wb_write_bit(wb, 0); // unused
}
write_frame_size(cm, wb);

View File

@ -640,10 +640,8 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
void vp9_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src,
int mi_row, int mi_col) {
uint8_t *const buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
src->alpha_buffer};
const int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
src->alpha_stride};
uint8_t *const buffers[3] = {src->y_buffer, src->u_buffer, src->v_buffer };
const int strides[3] = {src->y_stride, src->uv_stride, src->uv_stride };
int i;
// Set current frame pointer.

View File

@ -1418,17 +1418,6 @@ void vp9_write_yuv_rec_frame(VP9_COMMON *cm) {
src += s->uv_stride;
} while (--h);
#if CONFIG_ALPHA
if (s->alpha_buffer) {
src = s->alpha_buffer;
h = s->alpha_height;
do {
fwrite(src, s->alpha_width, 1, yuv_rec_file);
src += s->alpha_stride;
} while (--h);
}
#endif
fflush(yuv_rec_file);
}
#endif
@ -1437,22 +1426,18 @@ static void scale_and_extend_frame_nonnormative(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst) {
// TODO(dkovalev): replace YV12_BUFFER_CONFIG with vpx_image_t
int i;
const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
src->alpha_buffer};
const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
src->alpha_stride};
const int src_widths[4] = {src->y_crop_width, src->uv_crop_width,
src->uv_crop_width, src->y_crop_width};
const int src_heights[4] = {src->y_crop_height, src->uv_crop_height,
src->uv_crop_height, src->y_crop_height};
uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer,
dst->alpha_buffer};
const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride,
dst->alpha_stride};
const int dst_widths[4] = {dst->y_crop_width, dst->uv_crop_width,
dst->uv_crop_width, dst->y_crop_width};
const int dst_heights[4] = {dst->y_crop_height, dst->uv_crop_height,
dst->uv_crop_height, dst->y_crop_height};
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
const int src_widths[3] = {src->y_crop_width, src->uv_crop_width,
src->uv_crop_width };
const int src_heights[3] = {src->y_crop_height, src->uv_crop_height,
src->uv_crop_height};
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
const int dst_widths[3] = {dst->y_crop_width, dst->uv_crop_width,
dst->uv_crop_width};
const int dst_heights[3] = {dst->y_crop_height, dst->uv_crop_height,
dst->uv_crop_height};
for (i = 0; i < MAX_MB_PLANE; ++i)
vp9_resize_plane(srcs[i], src_heights[i], src_widths[i], src_strides[i],
@ -1467,14 +1452,10 @@ static void scale_and_extend_frame(const YV12_BUFFER_CONFIG *src,
const int src_h = src->y_crop_height;
const int dst_w = dst->y_crop_width;
const int dst_h = dst->y_crop_height;
const uint8_t *const srcs[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
src->alpha_buffer};
const int src_strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
src->alpha_stride};
uint8_t *const dsts[4] = {dst->y_buffer, dst->u_buffer, dst->v_buffer,
dst->alpha_buffer};
const int dst_strides[4] = {dst->y_stride, dst->uv_stride, dst->uv_stride,
dst->alpha_stride};
const uint8_t *const srcs[3] = {src->y_buffer, src->u_buffer, src->v_buffer};
const int src_strides[3] = {src->y_stride, src->uv_stride, src->uv_stride};
uint8_t *const dsts[3] = {dst->y_buffer, dst->u_buffer, dst->v_buffer};
const int dst_strides[3] = {dst->y_stride, dst->uv_stride, dst->uv_stride};
const InterpKernel *const kernel = vp9_get_interp_kernel(EIGHTTAP);
int x, y, i;

View File

@ -509,9 +509,8 @@ static INLINE int frame_is_boosted(const VP9_COMP *cpi) {
}
static INLINE int get_token_alloc(int mb_rows, int mb_cols) {
// TODO(JBB): make this work for alpha channel and double check we can't
// exceed this token count if we have a 32x32 transform crossing a boundary
// at a multiple of 16.
// TODO(JBB): double check we can't exceed this token count if we have a
// 32x32 transform crossing a boundary at a multiple of 16.
// mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full
// resolution. We assume up to 1 token per pixel, and then allow
// a head room of 4.

View File

@ -75,18 +75,6 @@ void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src,
const int eb_uv = eb_y >> uv_height_subsampling;
const int er_uv = er_y >> uv_width_subsampling;
#if CONFIG_ALPHA
const int et_a = dst->border >> (dst->alpha_height != dst->y_height);
const int el_a = dst->border >> (dst->alpha_width != dst->y_width);
const int eb_a = et_a + dst->alpha_height - src->alpha_height;
const int er_a = el_a + dst->alpha_width - src->alpha_width;
copy_and_extend_plane(src->alpha_buffer, src->alpha_stride,
dst->alpha_buffer, dst->alpha_stride,
src->alpha_width, src->alpha_height,
et_a, el_a, eb_a, er_a);
#endif
copy_and_extend_plane(src->y_buffer, src->y_stride,
dst->y_buffer, dst->y_stride,
src->y_width, src->y_height,

View File

@ -315,16 +315,6 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
quants->uv_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
quants->uv_round[q][i] = (qrounding_factor * quant) >> 7;
cm->uv_dequant[q][i] = quant;
#if CONFIG_ALPHA
// alpha
quant = i == 0 ? vp9_dc_quant(q, cm->a_dc_delta_q)
: vp9_ac_quant(q, cm->a_ac_delta_q);
invert_quant(&quants->a_quant[q][i], &quants->a_quant_shift[q][i], quant);
quants->a_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant, 7);
quants->a_round[q][i] = (qrounding_factor * quant) >> 7;
cm->a_dequant[q][i] = quant;
#endif
}
for (i = 2; i < 8; i++) {
@ -343,14 +333,6 @@ void vp9_init_quantizer(VP9_COMP *cpi) {
quants->uv_zbin[q][i] = quants->uv_zbin[q][1];
quants->uv_round[q][i] = quants->uv_round[q][1];
cm->uv_dequant[q][i] = cm->uv_dequant[q][1];
#if CONFIG_ALPHA
quants->a_quant[q][i] = quants->a_quant[q][1];
quants->a_quant_shift[q][i] = quants->a_quant_shift[q][1];
quants->a_zbin[q][i] = quants->a_zbin[q][1];
quants->a_round[q][i] = quants->a_round[q][1];
cm->a_dequant[q][i] = cm->a_dequant[q][1];
#endif
}
}
}
@ -387,15 +369,6 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) {
xd->plane[i].dequant = cm->uv_dequant[qindex];
}
#if CONFIG_ALPHA
x->plane[3].quant = quants->a_quant[qindex];
x->plane[3].quant_shift = quants->a_quant_shift[qindex];
x->plane[3].zbin = quants->a_zbin[qindex];
x->plane[3].round = quants->a_round[qindex];
x->plane[3].zbin_extra = (int16_t)((cm->a_dequant[qindex][1] * zbin) >> 7);
xd->plane[3].dequant = cm->a_dequant[qindex];
#endif
x->skip_block = vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP);
x->q_index = qindex;

View File

@ -35,13 +35,6 @@ typedef struct {
DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
#if CONFIG_ALPHA
DECLARE_ALIGNED(16, int16_t, a_quant[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, a_quant_shift[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, a_zbin[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, a_round[QINDEX_RANGE][8]);
#endif
} QUANTS;
void vp9_quantize_dc(const int16_t *coeff_ptr, int skip_block,

View File

@ -432,10 +432,6 @@ void vp9_setup_pred_block(const MACROBLOCKD *xd,
dst[1].buf = src->u_buffer;
dst[2].buf = src->v_buffer;
dst[1].stride = dst[2].stride = src->uv_stride;
#if CONFIG_ALPHA
dst[3].buf = src->alpha_buffer;
dst[3].stride = src->alpha_stride;
#endif
for (i = 0; i < MAX_MB_PLANE; ++i) {
setup_pred_plane(dst + i, dst[i].buf, dst[i].stride, mi_row, mi_col,

View File

@ -155,11 +155,11 @@ static vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data,
rb.bit_offset += 1; // [16,235] (including xvycc) vs [0,255] range
if (profile == PROFILE_1 || profile == PROFILE_3) {
rb.bit_offset += 2; // subsampling x/y
rb.bit_offset += 1; // has extra plane
rb.bit_offset += 1; // unused
}
} else {
if (profile == PROFILE_1 || profile == PROFILE_3) {
rb.bit_offset += 1; // has extra plane
rb.bit_offset += 1; // unused
} else {
// RGB is only available in version 1
return VPX_CODEC_UNSUP_BITSTREAM;

View File

@ -41,11 +41,11 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12,
img->planes[VPX_PLANE_Y] = yv12->y_buffer;
img->planes[VPX_PLANE_U] = yv12->u_buffer;
img->planes[VPX_PLANE_V] = yv12->v_buffer;
img->planes[VPX_PLANE_ALPHA] = yv12->alpha_buffer;
img->planes[VPX_PLANE_ALPHA] = NULL;
img->stride[VPX_PLANE_Y] = yv12->y_stride;
img->stride[VPX_PLANE_U] = yv12->uv_stride;
img->stride[VPX_PLANE_V] = yv12->uv_stride;
img->stride[VPX_PLANE_ALPHA] = yv12->alpha_stride;
img->stride[VPX_PLANE_ALPHA] = yv12->y_stride;
img->bps = bps;
img->user_priv = user_priv;
img->img_data = yv12->buffer_alloc;
@ -58,7 +58,6 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
yv12->y_buffer = img->planes[VPX_PLANE_Y];
yv12->u_buffer = img->planes[VPX_PLANE_U];
yv12->v_buffer = img->planes[VPX_PLANE_V];
yv12->alpha_buffer = img->planes[VPX_PLANE_ALPHA];
yv12->y_crop_width = img->d_w;
yv12->y_crop_height = img->d_h;
@ -70,21 +69,10 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2
: yv12->y_height;
yv12->alpha_width = yv12->alpha_buffer ? img->d_w : 0;
yv12->alpha_height = yv12->alpha_buffer ? img->d_h : 0;
yv12->y_stride = img->stride[VPX_PLANE_Y];
yv12->uv_stride = img->stride[VPX_PLANE_U];
yv12->alpha_stride = yv12->alpha_buffer ? img->stride[VPX_PLANE_ALPHA] : 0;
yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
#if CONFIG_ALPHA
// For development purposes, force alpha to hold the same data as Y for now.
yv12->alpha_buffer = yv12->y_buffer;
yv12->alpha_width = yv12->y_width;
yv12->alpha_height = yv12->y_height;
yv12->alpha_stride = yv12->y_stride;
#endif
return VPX_CODEC_OK;
}