Commit 2a52f291 authored by Rupert Swarbrick's avatar Rupert Swarbrick

Make inspector work with superres

With superres enabled, mi_rows/mi_cols might not be constant across
frames (the scaling factor might change). This patch fills in Nathan
Egge's todo comment to do something useful if the current
mi_rows/mi_cols size isn't what the calling code expected.

Change-Id: I7edf8c6efc25ff182fc5b6a7eff7d56e2d9e86dc
parent b95cf12e
......@@ -18,13 +18,19 @@
#include "av1/common/cfl.h"
#endif
void ifd_init(insp_frame_data *fd, int frame_width, int frame_height) {
fd->mi_cols = ALIGN_POWER_OF_TWO(frame_width, 3) >> MI_SIZE_LOG2;
fd->mi_rows = ALIGN_POWER_OF_TWO(frame_height, 3) >> MI_SIZE_LOG2;
static void ifd_init_mi_rc(insp_frame_data *fd, int mi_cols, int mi_rows) {
fd->mi_cols = mi_cols;
fd->mi_rows = mi_rows;
fd->mi_grid = (insp_mi_data *)aom_malloc(sizeof(insp_mi_data) * fd->mi_rows *
fd->mi_cols);
}
void ifd_init(insp_frame_data *fd, int frame_width, int frame_height) {
int mi_cols = ALIGN_POWER_OF_TWO(frame_width, 3) >> MI_SIZE_LOG2;
int mi_rows = ALIGN_POWER_OF_TWO(frame_height, 3) >> MI_SIZE_LOG2;
ifd_init_mi_rc(fd, mi_cols, mi_rows);
}
void ifd_clear(insp_frame_data *fd) {
aom_free(fd->mi_grid);
fd->mi_grid = NULL;
......@@ -35,9 +41,9 @@ void ifd_clear(insp_frame_data *fd) {
int ifd_inspect(insp_frame_data *fd, void *decoder) {
struct AV1Decoder *pbi = (struct AV1Decoder *)decoder;
AV1_COMMON *const cm = &pbi->common;
// TODO(negge): Should this function just call ifd_clear() and ifd_init()?
if (fd->mi_rows != cm->mi_rows || fd->mi_cols != cm->mi_cols) {
return 0;
ifd_clear(fd);
ifd_init_mi_rc(fd, cm->mi_rows, cm->mi_cols);
}
fd->show_frame = cm->show_frame;
fd->frame_type = cm->frame_type;
......
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