Commit c484abe7 authored by Angie Chiang's avatar Angie Chiang

Set mbmi_ext's tcoeff to size MAX_SB_SQUARE

This a simple implementation.
We will use a more precise buffer size for tcoeff once the
experiment functions correctly.

Change-Id: Ib561974f21ee1b8d72ce407882ea2be3cf0b069f
parent babf3e78
...@@ -68,7 +68,8 @@ typedef struct { ...@@ -68,7 +68,8 @@ typedef struct {
int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int16_t mode_context[MODE_CTX_REF_FRAMES]; int16_t mode_context[MODE_CTX_REF_FRAMES];
#if CONFIG_LV_MAP #if CONFIG_LV_MAP
tran_low_t *tcoeff[MAX_MB_PLANE]; // TODO(angiebird): Reduce the buffer size according to sb_type
tran_low_t tcoeff[MAX_MB_PLANE][MAX_SB_SQUARE];
uint16_t eobs[MAX_MB_PLANE][MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; uint16_t eobs[MAX_MB_PLANE][MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
uint8_t txb_skip_ctx[MAX_MB_PLANE] uint8_t txb_skip_ctx[MAX_MB_PLANE]
[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; [MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
......
...@@ -931,9 +931,6 @@ static void update_frame_size(AV1_COMP *cpi) { ...@@ -931,9 +931,6 @@ static void update_frame_size(AV1_COMP *cpi) {
NULL); NULL);
memset(cpi->mbmi_ext_base, 0, memset(cpi->mbmi_ext_base, 0,
cm->mi_rows * cm->mi_cols * sizeof(*cpi->mbmi_ext_base)); cm->mi_rows * cm->mi_cols * sizeof(*cpi->mbmi_ext_base));
#if CONFIG_LV_MAP
av1_reset_txb_buf(cpi);
#endif
set_tile_info(cpi); set_tile_info(cpi);
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "av1/encoder/tokenize.h" #include "av1/encoder/tokenize.h"
void av1_alloc_txb_buf(AV1_COMP *cpi) { void av1_alloc_txb_buf(AV1_COMP *cpi) {
#if 0
AV1_COMMON *cm = &cpi->common; AV1_COMMON *cm = &cpi->common;
int mi_block_size = 1 << MI_SIZE_LOG2; int mi_block_size = 1 << MI_SIZE_LOG2;
// TODO(angiebird): Make sure cm->subsampling_x/y is set correctly, and then // TODO(angiebird): Make sure cm->subsampling_x/y is set correctly, and then
...@@ -29,42 +30,20 @@ void av1_alloc_txb_buf(AV1_COMP *cpi) { ...@@ -29,42 +30,20 @@ void av1_alloc_txb_buf(AV1_COMP *cpi) {
cm, cpi->tcoeff_buf[i], cm, cpi->tcoeff_buf[i],
aom_malloc(sizeof(*cpi->tcoeff_buf[i]) * pixel_stride * pixel_height)); aom_malloc(sizeof(*cpi->tcoeff_buf[i]) * pixel_stride * pixel_height));
} }
} #else
(void)cpi;
void av1_reset_txb_buf(AV1_COMP *cpi) { #endif
AV1_COMMON *cm = &cpi->common;
int mi_block_size = 1 << MI_SIZE_LOG2;
int plane;
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
// TODO(angiebird): Set the subsampling_x/y to cm->subsampling_x/y
int subsampling_x = 0;
int subsampling_y = 0;
int pixel_stride = (mi_block_size * cm->mi_cols) >> subsampling_x;
int pixel_height = (mi_block_size * cm->mi_rows) >> subsampling_y;
// TODO(angiebird): Check if we really need this initialization
memset(cpi->tcoeff_buf[plane], 0,
pixel_stride * pixel_height * sizeof(*cpi->tcoeff_buf[plane]));
int mi_row, mi_col;
for (mi_row = 0; mi_row < cm->mi_rows; ++mi_row) {
for (mi_col = 0; mi_col < cm->mi_cols; ++mi_col) {
MB_MODE_INFO_EXT *mbmi_ext =
cpi->mbmi_ext_base + mi_row * cm->mi_cols + mi_col;
int pixel_row = (mi_block_size * mi_row) >> subsampling_y;
int pixel_col = (mi_block_size * mi_col) >> subsampling_x;
mbmi_ext->tcoeff[plane] =
cpi->tcoeff_buf[plane] + pixel_row * pixel_stride + pixel_col;
}
}
}
} }
void av1_free_txb_buf(AV1_COMP *cpi) { void av1_free_txb_buf(AV1_COMP *cpi) {
#if 0
int i; int i;
for (i = 0; i < MAX_MB_PLANE; ++i) { for (i = 0; i < MAX_MB_PLANE; ++i) {
aom_free(cpi->tcoeff_buf[i]); aom_free(cpi->tcoeff_buf[i]);
} }
#else
(void)cpi;
#endif
} }
static void write_golomb(aom_writer *w, int level) { static void write_golomb(aom_writer *w, int level) {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
extern "C" { extern "C" {
#endif #endif
void av1_alloc_txb_buf(AV1_COMP *cpi); void av1_alloc_txb_buf(AV1_COMP *cpi);
void av1_reset_txb_buf(AV1_COMP *cpi);
void av1_free_txb_buf(AV1_COMP *cpi); void av1_free_txb_buf(AV1_COMP *cpi);
void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_writer *w, int block, int plane, aom_writer *w, int block, int plane,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment