Commit ffbb0f91 authored by Jingning Han's avatar Jingning Han

Enable motion field estimation in DRL

Enable the use of motion field estimation in the dynamic motion
vector referencing system. With default experiments on, it improves
the compression performance:

lowres 1.2%
midres 1.5%

Change-Id: Ifc5b15a7239b5c3212ea50f326ab99d372034658
parent c723b348
......@@ -85,6 +85,10 @@ void av1_free_ref_frame_buffers(BufferPool *pool) {
}
aom_free(pool->frame_bufs[i].mvs);
pool->frame_bufs[i].mvs = NULL;
#if CONFIG_MFMV
aom_free(pool->frame_bufs[i].tpl_mvs);
pool->frame_bufs[i].tpl_mvs = NULL;
#endif
aom_free_frame_buffer(&pool->frame_bufs[i].buf);
#if CONFIG_HASH_ME
av1_hash_table_destroy(&pool->frame_bufs[i].hash_table);
......
......@@ -20,6 +20,8 @@
extern "C" {
#endif
#define INVALID_MV 0x80008000
typedef struct mv {
int16_t row;
int16_t col;
......
This diff is collapsed.
......@@ -381,6 +381,7 @@ static INLINE uint8_t av1_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
#if CONFIG_MFMV
void av1_setup_frame_buf_refs(AV1_COMMON *cm);
void av1_setup_motion_field(AV1_COMMON *cm);
#endif
typedef void (*find_mv_refs_sync)(void *const data, int mi_row);
......
......@@ -111,6 +111,14 @@ typedef enum {
REFRESH_FRAME_CONTEXT_BACKWARD,
} REFRESH_FRAME_CONTEXT_MODE;
#if CONFIG_MFMV
#define MFMV_STACK_SIZE INTER_REFS_PER_FRAME
typedef struct {
int_mv mfmv[INTER_REFS_PER_FRAME][MFMV_STACK_SIZE];
} TPL_MV_REF;
#endif
typedef struct {
int_mv mv[2];
int_mv pred_mv[2];
......@@ -125,14 +133,13 @@ typedef struct {
int lst_frame_offset;
int alt_frame_offset;
int gld_frame_offset;
#if CONFIG_EXT_REFS
int lst2_frame_offset;
int lst3_frame_offset;
int bwd_frame_offset;
#endif
TPL_MV_REF *tpl_mvs;
#endif
MV_REF *mvs;
int mi_rows;
int mi_cols;
......@@ -587,6 +594,14 @@ static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {
CHECK_MEM_ERROR(
cm, buf->mvs,
(MV_REF *)aom_calloc(cm->mi_rows * cm->mi_cols, sizeof(*buf->mvs)));
#if CONFIG_MFMV
aom_free(buf->tpl_mvs);
CHECK_MEM_ERROR(
cm, buf->tpl_mvs,
(TPL_MV_REF *)aom_calloc((cm->mi_rows + MAX_MIB_SIZE) * cm->mi_stride,
sizeof(*buf->tpl_mvs)));
#endif
}
}
......
......@@ -5287,6 +5287,7 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
#if CONFIG_MFMV
av1_setup_frame_buf_refs(cm);
av1_setup_motion_field(cm);
#endif
av1_setup_block_planes(xd, cm->subsampling_x, cm->subsampling_y);
......
......@@ -5314,6 +5314,7 @@ static void encode_frame_internal(AV1_COMP *cpi) {
cm->frame_offset = cm->current_video_frame;
}
av1_setup_frame_buf_refs(cm);
av1_setup_motion_field(cm);
#endif
{
......
......@@ -43,8 +43,6 @@ extern "C" {
#define MV_COST_WEIGHT 108
#define MV_COST_WEIGHT_SUB 120
#define INVALID_MV 0x80008000
#define RD_THRESH_MAX_FACT 64
#define RD_THRESH_INC 1
......
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