Commit 5e911428 authored by Frederic Barbier's avatar Frederic Barbier Committed by Sebastien Alaiwan

Make segmentation compatible with scaling

Fallback on intra block when the segmentation doesn't allow to reference
a frame in scaling use case (e.g: after use of a segmentation map with
another dimension).

Change-Id: I4aa037f07ec3d18c96752e0d49f5afa4e8674d49
parent 880ab1ca
......@@ -1604,7 +1604,16 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
static int read_is_inter_block(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int segment_id, aom_reader *r) {
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
return get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME;
const int frame = get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME);
RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME];
return frame != INTRA_FRAME && av1_is_valid_scale(&ref_buf->sf);
}
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)
#if CONFIG_SEGMENT_GLOBALMV
|| segfeature_active(&cm->seg, segment_id, SEG_LVL_GLOBALMV)
#endif
) {
if (!av1_is_valid_scale(&cm->frame_refs[0].sf)) return 0;
}
const int ctx = av1_get_intra_inter_context(xd);
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
......
......@@ -281,6 +281,14 @@ static int write_skip_mode(const AV1_COMMON *cm, const MACROBLOCKD *xd,
static void write_is_inter(const AV1_COMMON *cm, const MACROBLOCKD *xd,
int segment_id, aom_writer *w, const int is_inter) {
if (!segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)
#if CONFIG_SEGMENT_GLOBALMV
|| segfeature_active(&cm->seg, segment_id, SEG_LVL_GLOBALMV)
#endif
)
if (!av1_is_valid_scale(&cm->frame_refs[0].sf))
return; // LAST_FRAME not valid for reference
const int ctx = av1_get_intra_inter_context(xd);
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
aom_write_symbol(w, is_inter, ec_ctx->intra_inter_cdf[ctx], 2);
......
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