Compare commits

..

2 Commits

Author SHA1 Message Date
Dmitry Kovalev
422da555b0 BITSTREAM - RESTORING BILINEAR INTERPOLATION FILTER SUPPORT
Adding appropriate test vector vp90-2-06-bilinear.webm.

(cherry picked from commit 68a3e4a888)

Change-Id: I10feb6ad2fcb1c2e14e51f550d1a8869aeaf6488
2013-10-03 14:09:32 -07:00
Adrian Grange
29611db9f8 Modified resize unit test to output test vector
Modified the resize unit test so that it optionally
writes the encoded bitstream to file. The macro
WRITE_COMPRESSED_STREAM should be set to 1 to enable
output of the test bitstream; it is set to 0 by default.

(cherry picked from commit 88c8ff2508)

Change-Id: I72f58f9ff8559aacd1b67422c36b9745f4662fee
2013-10-03 14:09:28 -07:00
19 changed files with 242 additions and 335 deletions

View File

@@ -395,7 +395,7 @@ libvpx_test_srcs.txt:
@echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | sort -u > $@
CLEAN-OBJS += libvpx_test_srcs.txt
$(LIBVPX_TEST_DATA): $(SRC_PATH_BARE)/test/test-data.sha1
$(LIBVPX_TEST_DATA):
@echo " [DOWNLOAD] $@"
$(qexec)trap 'rm -f $@' INT TERM &&\
curl -L -o $@ $(call libvpx_test_data_url,$(@F))

View File

@@ -97,91 +97,21 @@
%endif
%endmacro
; PIC macros are copied from vpx_ports/x86_abi_support.asm. The "define PIC"
; from original code is added in for 64bit.
%ifidn __OUTPUT_FORMAT__,elf32
%define ABI_IS_32BIT 1
%elifidn __OUTPUT_FORMAT__,macho32
%define ABI_IS_32BIT 1
%elifidn __OUTPUT_FORMAT__,win32
%define ABI_IS_32BIT 1
%elifidn __OUTPUT_FORMAT__,aout
%define ABI_IS_32BIT 1
%else
%define ABI_IS_32BIT 0
%endif
%if ABI_IS_32BIT
%if CONFIG_PIC=1
%ifidn __OUTPUT_FORMAT__,elf32
%define GET_GOT_SAVE_ARG 1
%define WRT_PLT wrt ..plt
%macro GET_GOT 1
extern _GLOBAL_OFFSET_TABLE_
push %1
call %%get_got
%%sub_offset:
jmp %%exitGG
%%get_got:
mov %1, [esp]
add %1, _GLOBAL_OFFSET_TABLE_ + $$ - %%sub_offset wrt ..gotpc
ret
%%exitGG:
%undef GLOBAL
%define GLOBAL(x) x + %1 wrt ..gotoff
%undef RESTORE_GOT
%define RESTORE_GOT pop %1
%endmacro
%elifidn __OUTPUT_FORMAT__,macho32
%define GET_GOT_SAVE_ARG 1
%macro GET_GOT 1
push %1
call %%get_got
%%get_got:
pop %1
%undef GLOBAL
%define GLOBAL(x) x + %1 - %%get_got
%undef RESTORE_GOT
%define RESTORE_GOT pop %1
%endmacro
%endif
%endif
%if ARCH_X86_64 == 0
%if WIN64
%define PIC
%elifidn __OUTPUT_FORMAT__,macho64
%define PIC
%elif ARCH_X86_64 == 0
; x86_32 doesn't require PIC.
; Some distros prefer shared objects to be PIC, but nothing breaks if
; the code contains a few textrels, so we'll skip that complexity.
%undef PIC
%endif
%else
%macro GET_GOT 1
%endmacro
%define GLOBAL(x) rel x
%define WRT_PLT wrt ..plt
%if WIN64
%elif CONFIG_PIC
%define PIC
%elifidn __OUTPUT_FORMAT__,macho64
%define PIC
%elif CONFIG_PIC
%define PIC
%endif
%endif
%ifnmacro GET_GOT
%macro GET_GOT 1
%endmacro
%define GLOBAL(x) x
%endif
%ifndef RESTORE_GOT
%define RESTORE_GOT
%endif
%ifndef WRT_PLT
%define WRT_PLT
%endif
%ifdef PIC
default rel
%endif
; Done with PIC macros
; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
%ifndef __NASM_VER__
@@ -598,10 +528,6 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
global %1:function hidden
%elifidn __OUTPUT_FORMAT__,elf64
global %1:function hidden
%elifidn __OUTPUT_FORMAT__,macho32
global %1:private_extern
%elifidn __OUTPUT_FORMAT__,macho64
global %1:private_extern
%else
global %1
%endif

View File

@@ -512,15 +512,15 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi)
else
{
mbmi->mode = NEARMV;
vp8_clamp_mv2(&near_mvs[CNT_NEAR], &pbi->mb);
mbmi->mv.as_int = near_mvs[CNT_NEAR].as_int;
vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
}
}
else
{
mbmi->mode = NEARESTMV;
vp8_clamp_mv2(&near_mvs[CNT_NEAREST], &pbi->mb);
mbmi->mv.as_int = near_mvs[CNT_NEAREST].as_int;
vp8_clamp_mv2(&mbmi->mv, &pbi->mb);
}
}
else

View File

@@ -1026,7 +1026,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
const unsigned char *clear = data;
if (pbi->decrypt_cb)
{
int n = (int)(data_end - data);
int n = data_end - data;
if (n > 10) n = 10;
pbi->decrypt_cb(pbi->decrypt_state, data, clear_buffer, n);
clear = clear_buffer;

View File

@@ -35,7 +35,7 @@ static void convolve_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
for (y = 0; y < h; ++y) {
/* Initial phase offset */
int x_q4 = (int)(filter_x0 - filter_x_base) / taps;
int x_q4 = (filter_x0 - filter_x_base) / taps;
for (x = 0; x < w; ++x) {
/* Per-pixel src offset */
@@ -76,7 +76,7 @@ static void convolve_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
for (y = 0; y < h; ++y) {
/* Initial phase offset */
int x_q4 = (int)(filter_x0 - filter_x_base) / taps;
int x_q4 = (filter_x0 - filter_x_base) / taps;
for (x = 0; x < w; ++x) {
/* Per-pixel src offset */
@@ -118,7 +118,7 @@ static void convolve_vert_c(const uint8_t *src, ptrdiff_t src_stride,
for (x = 0; x < w; ++x) {
/* Initial phase offset */
int y_q4 = (int)(filter_y0 - filter_y_base) / taps;
int y_q4 = (filter_y0 - filter_y_base) / taps;
for (y = 0; y < h; ++y) {
/* Per-pixel src offset */
@@ -160,7 +160,7 @@ static void convolve_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
for (x = 0; x < w; ++x) {
/* Initial phase offset */
int y_q4 = (int)(filter_y0 - filter_y_base) / taps;
int y_q4 = (filter_y0 - filter_y_base) / taps;
for (y = 0; y < h; ++y) {
/* Per-pixel src offset */

View File

@@ -73,10 +73,6 @@ extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
#define MV_MAX ((1 << MV_MAX_BITS) - 1)
#define MV_VALS ((MV_MAX << 1) + 1)
#define MV_IN_USE_BITS 14
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
#define MV_LOW (-(1 << MV_IN_USE_BITS))
extern const vp9_tree_index vp9_mv_class0_tree[2 * CLASS0_SIZE - 2];
extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];

View File

@@ -119,9 +119,10 @@ static void clamp_mv_ref(MV *mv, const MACROBLOCKD *xd) {
// This function returns either the appropriate sub block or block's mv
// on whether the block_size < 8x8 and we have check_sub_blocks set.
static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate, int which_mv,
static INLINE int_mv get_sub_block_mv(const MODE_INFO *candidate,
int check_sub_blocks, int which_mv,
int search_col, int block_idx) {
return block_idx >= 0 && candidate->mbmi.sb_type < BLOCK_8X8
return check_sub_blocks && candidate->mbmi.sb_type < BLOCK_8X8
? candidate->bmi[idx_n_column_to_subblock[block_idx][search_col == 0]]
.as_mv[which_mv]
: candidate->mbmi.mv[which_mv];
@@ -202,6 +203,7 @@ void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
for (i = 0; i < 2; ++i) {
const MV *const mv_ref = &mv_ref_search[i];
if (is_inside(cm, mi_col, mi_row, mv_ref)) {
const int check_sub_blocks = block_idx >= 0;
const MODE_INFO *const candidate_mi = xd->mi_8x8[mv_ref->col + mv_ref->row
* xd->mode_info_stride];
const MB_MODE_INFO *const candidate = &candidate_mi->mbmi;
@@ -210,13 +212,13 @@ void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
// Check if the candidate comes from the same reference frame.
if (candidate->ref_frame[0] == ref_frame) {
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0,
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, check_sub_blocks, 0,
mv_ref->col, block_idx));
different_ref_found = candidate->ref_frame[1] != ref_frame;
} else {
if (candidate->ref_frame[1] == ref_frame)
// Add second motion vector if it has the same ref_frame.
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 1,
ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, check_sub_blocks, 1,
mv_ref->col, block_idx));
different_ref_found = 1;
}

View File

@@ -19,14 +19,12 @@ pw_32: times 8 dw 32
SECTION .text
INIT_MMX sse
cglobal dc_predictor_4x4, 4, 5, 2, dst, stride, above, left, goffset
GET_GOT goffsetq
cglobal dc_predictor_4x4, 4, 4, 2, dst, stride, above, left
pxor m1, m1
movd m0, [aboveq]
punpckldq m0, [leftq]
psadbw m0, m1
paddw m0, [GLOBAL(pw_4)]
paddw m0, [pw_4]
psraw m0, 3
pshufw m0, m0, 0x0
packuswb m0, m0
@@ -35,14 +33,10 @@ cglobal dc_predictor_4x4, 4, 5, 2, dst, stride, above, left, goffset
lea dstq, [dstq+strideq*2]
movd [dstq ], m0
movd [dstq+strideq], m0
RESTORE_GOT
RET
INIT_MMX sse
cglobal dc_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset
GET_GOT goffsetq
cglobal dc_predictor_8x8, 4, 4, 3, dst, stride, above, left
pxor m1, m1
movq m0, [aboveq]
movq m2, [leftq]
@@ -51,7 +45,7 @@ cglobal dc_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset
psadbw m0, m1
psadbw m2, m1
paddw m0, m2
paddw m0, [GLOBAL(pw_8)]
paddw m0, [pw_8]
psraw m0, 4
pshufw m0, m0, 0x0
packuswb m0, m0
@@ -64,14 +58,10 @@ cglobal dc_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset
movq [dstq+strideq ], m0
movq [dstq+strideq*2], m0
movq [dstq+stride3q ], m0
RESTORE_GOT
RET
INIT_XMM sse2
cglobal dc_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset
GET_GOT goffsetq
cglobal dc_predictor_16x16, 4, 4, 3, dst, stride, above, left
pxor m1, m1
mova m0, [aboveq]
mova m2, [leftq]
@@ -83,7 +73,7 @@ cglobal dc_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset
paddw m0, m2
movhlps m2, m0
paddw m0, m2
paddw m0, [GLOBAL(pw_16)]
paddw m0, [pw_16]
psraw m0, 5
pshuflw m0, m0, 0x0
punpcklqdq m0, m0
@@ -96,14 +86,10 @@ cglobal dc_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset
lea dstq, [dstq+strideq*4]
dec lines4d
jnz .loop
RESTORE_GOT
REP_RET
INIT_XMM sse2
cglobal dc_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset
GET_GOT goffsetq
cglobal dc_predictor_32x32, 4, 4, 5, dst, stride, above, left
pxor m1, m1
mova m0, [aboveq]
mova m2, [aboveq+16]
@@ -121,7 +107,7 @@ cglobal dc_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset
paddw m0, m4
movhlps m2, m0
paddw m0, m2
paddw m0, [GLOBAL(pw_32)]
paddw m0, [pw_32]
psraw m0, 6
pshuflw m0, m0, 0x0
punpcklqdq m0, m0
@@ -138,8 +124,6 @@ cglobal dc_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset
lea dstq, [dstq+strideq*4]
dec lines4d
jnz .loop
RESTORE_GOT
REP_RET
INIT_MMX sse

View File

@@ -112,16 +112,14 @@ cglobal h_predictor_32x32, 2, 4, 3, dst, stride, line, left
REP_RET
INIT_MMX ssse3
cglobal d45_predictor_4x4, 3, 4, 4, dst, stride, above, goffset
GET_GOT goffsetq
cglobal d45_predictor_4x4, 3, 3, 4, dst, stride, above
movq m0, [aboveq]
pshufb m2, m0, [GLOBAL(sh_b23456777)]
pshufb m1, m0, [GLOBAL(sh_b01234577)]
pshufb m0, [GLOBAL(sh_b12345677)]
pshufb m2, m0, [sh_b23456777]
pshufb m1, m0, [sh_b01234577]
pshufb m0, [sh_b12345677]
pavgb m3, m2, m1
pxor m2, m1
pand m2, [GLOBAL(pb_1)]
pand m2, [pb_1]
psubb m3, m2
pavgb m0, m3
@@ -134,23 +132,19 @@ cglobal d45_predictor_4x4, 3, 4, 4, dst, stride, above, goffset
movd [dstq ], m0
psrlq m0, 8
movd [dstq+strideq], m0
RESTORE_GOT
RET
INIT_MMX ssse3
cglobal d45_predictor_8x8, 3, 4, 4, dst, stride, above, goffset
GET_GOT goffsetq
cglobal d45_predictor_8x8, 3, 3, 4, dst, stride, above
movq m0, [aboveq]
mova m1, [GLOBAL(sh_b12345677)]
DEFINE_ARGS dst, stride, stride3
mova m1, [sh_b12345677]
DEFINE_ARGS dst, stride, stride3, line
lea stride3q, [strideq*3]
pshufb m2, m0, [GLOBAL(sh_b23456777)]
pshufb m2, m0, [sh_b23456777]
pavgb m3, m2, m0
pxor m2, m0
pshufb m0, m1
pand m2, [GLOBAL(pb_1)]
pand m2, [pb_1]
psubb m3, m2
pavgb m0, m3
@@ -173,24 +167,20 @@ cglobal d45_predictor_8x8, 3, 4, 4, dst, stride, above, goffset
movq [dstq+strideq*2], m0
pshufb m0, m1
movq [dstq+stride3q ], m0
RESTORE_GOT
RET
INIT_XMM ssse3
cglobal d45_predictor_16x16, 3, 6, 4, dst, stride, above, dst8, line, goffset
GET_GOT goffsetq
cglobal d45_predictor_16x16, 3, 5, 4, dst, stride, above, dst8, line
mova m0, [aboveq]
DEFINE_ARGS dst, stride, stride3, dst8, line
lea stride3q, [strideq*3]
lea dst8q, [dstq+strideq*8]
mova m1, [GLOBAL(sh_b123456789abcdeff)]
pshufb m2, m0, [GLOBAL(sh_b23456789abcdefff)]
mova m1, [sh_b123456789abcdeff]
pshufb m2, m0, [sh_b23456789abcdefff]
pavgb m3, m2, m0
pxor m2, m0
pshufb m0, m1
pand m2, [GLOBAL(pb_1)]
pand m2, [pb_1]
psubb m3, m2
pavgb m0, m3
@@ -224,33 +214,29 @@ cglobal d45_predictor_16x16, 3, 6, 4, dst, stride, above, dst8, line, goffset
movhps [dstq+strideq +8], m0
movhps [dstq+strideq*2+8], m0
movhps [dstq+stride3q +8], m0
RESTORE_GOT
RET
INIT_XMM ssse3
cglobal d45_predictor_32x32, 3, 6, 7, dst, stride, above, dst16, line, goffset
GET_GOT goffsetq
cglobal d45_predictor_32x32, 3, 5, 7, dst, stride, above, dst16, line
mova m0, [aboveq]
mova m4, [aboveq+16]
DEFINE_ARGS dst, stride, stride3, dst16, line
lea stride3q, [strideq*3]
lea dst16q, [dstq +strideq*8]
lea dst16q, [dst16q+strideq*8]
mova m1, [GLOBAL(sh_b123456789abcdeff)]
pshufb m2, m4, [GLOBAL(sh_b23456789abcdefff)]
mova m1, [sh_b123456789abcdeff]
pshufb m2, m4, [sh_b23456789abcdefff]
pavgb m3, m2, m4
pxor m2, m4
palignr m5, m4, m0, 1
palignr m6, m4, m0, 2
pshufb m4, m1
pand m2, [GLOBAL(pb_1)]
pand m2, [pb_1]
psubb m3, m2
pavgb m4, m3
pavgb m3, m0, m6
pxor m0, m6
pand m0, [GLOBAL(pb_1)]
pand m0, [pb_1]
psubb m3, m0
pavgb m5, m3
@@ -302,6 +288,4 @@ cglobal d45_predictor_32x32, 3, 6, 7, dst, stride, above, dst16, line, goffset
mova [dstq +strideq +16], m4
mova [dstq +strideq*2+16], m4
mova [dstq +stride3q +16], m4
RESTORE_GOT
RET

View File

@@ -30,26 +30,10 @@ static MB_PREDICTION_MODE read_intra_mode(vp9_reader *r, const vp9_prob *p) {
return (MB_PREDICTION_MODE)treed_read(r, vp9_intra_mode_tree, p);
}
static MB_PREDICTION_MODE read_intra_mode_y(VP9_COMMON *cm, vp9_reader *r,
int size_group) {
const MB_PREDICTION_MODE y_mode = read_intra_mode(r,
cm->fc.y_mode_prob[size_group]);
++cm->counts.y_mode[size_group][y_mode];
return y_mode;
}
static MB_PREDICTION_MODE read_intra_mode_uv(VP9_COMMON *cm, vp9_reader *r,
MB_PREDICTION_MODE y_mode) {
const MB_PREDICTION_MODE uv_mode = read_intra_mode(r,
cm->fc.uv_mode_prob[y_mode]);
++cm->counts.uv_mode[y_mode][uv_mode];
return uv_mode;
}
static MB_PREDICTION_MODE read_inter_mode(VP9_COMMON *cm, vp9_reader *r,
uint8_t context) {
const MB_PREDICTION_MODE mode = treed_read(r, vp9_inter_mode_tree,
cm->fc.inter_mode_probs[context]);
MB_PREDICTION_MODE mode = treed_read(r, vp9_inter_mode_tree,
cm->fc.inter_mode_probs[context]);
++cm->counts.inter_mode[context][inter_mode_offset(mode)];
return mode;
}
@@ -364,15 +348,16 @@ static void read_switchable_interp_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
int i, j;
for (j = 0; j < SWITCHABLE_FILTERS + 1; ++j)
for (i = 0; i < SWITCHABLE_FILTERS - 1; ++i)
vp9_diff_update_prob(r, MODE_UPDATE_PROB,
&fc->switchable_interp_prob[j][i]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &fc->switchable_interp_prob[j][i]);
}
static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
int i, j;
for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
for (j = 0; j < INTER_MODES - 1; ++j)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &fc->inter_mode_probs[i][j]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
}
static INLINE COMPPREDMODE_TYPE read_comp_pred_mode(vp9_reader *r) {
@@ -403,7 +388,9 @@ static void read_intra_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mbmi->ref_frame[1] = NONE;
if (bsize >= BLOCK_8X8) {
mbmi->mode = read_intra_mode_y(cm, r, size_group_lookup[bsize]);
const int size_group = size_group_lookup[bsize];
mbmi->mode = read_intra_mode(r, cm->fc.y_mode_prob[size_group]);
cm->counts.y_mode[size_group][mbmi->mode]++;
} else {
// Only 4x4, 4x8, 8x4 blocks
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; // 1 or 2
@@ -413,8 +400,10 @@ static void read_intra_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) {
const int ib = idy * 2 + idx;
const int b_mode = read_intra_mode_y(cm, r, 0);
const int b_mode = read_intra_mode(r, cm->fc.y_mode_prob[0]);
mi->bmi[ib].as_mode = b_mode;
cm->counts.y_mode[0][b_mode]++;
if (num_4x4_h == 2)
mi->bmi[ib + 2].as_mode = b_mode;
if (num_4x4_w == 2)
@@ -424,47 +413,8 @@ static void read_intra_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mbmi->mode = mi->bmi[3].as_mode;
}
mbmi->uv_mode = read_intra_mode_uv(cm, r, mbmi->mode);
}
static INLINE int assign_mv(VP9_COMMON *cm, MB_PREDICTION_MODE mode,
int_mv mv[2], int_mv best_mv[2],
int_mv nearest_mv[2], int_mv near_mv[2],
int is_compound, int allow_hp, vp9_reader *r) {
int i;
int ret = 1;
switch (mode) {
case NEWMV:
read_mv(r, &mv[0].as_mv, &best_mv[0].as_mv,
&cm->fc.nmvc, &cm->counts.mv, allow_hp);
if (is_compound)
read_mv(r, &mv[1].as_mv, &best_mv[1].as_mv,
&cm->fc.nmvc, &cm->counts.mv, allow_hp);
for (i = 0; i < 1 + is_compound; ++i) {
ret = ret && mv[i].as_mv.row < MV_UPP && mv[i].as_mv.row > MV_LOW;
ret = ret && mv[i].as_mv.col < MV_UPP && mv[i].as_mv.col > MV_LOW;
}
break;
case NEARESTMV:
mv[0].as_int = nearest_mv[0].as_int;
if (is_compound)
mv[1].as_int = nearest_mv[1].as_int;
break;
case NEARMV:
mv[0].as_int = near_mv[0].as_int;
if (is_compound)
mv[1].as_int = near_mv[1].as_int;
break;
case ZEROMV:
mv[0].as_int = 0;
if (is_compound)
mv[1].as_int = 0;
break;
default:
return 0;
}
return ret;
mbmi->uv_mode = read_intra_mode(r, cm->fc.uv_mode_prob[mbmi->mode]);
cm->counts.uv_mode[mbmi->mode][mbmi->uv_mode]++;
}
static int read_is_inter_block(VP9D_COMP *pbi, int segment_id, vp9_reader *r) {
@@ -486,11 +436,15 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
int mi_row, int mi_col, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
nmv_context *const nmvc = &cm->fc.nmvc;
MB_MODE_INFO *const mbmi = &mi->mbmi;
int_mv *const mv0 = &mbmi->mv[0];
int_mv *const mv1 = &mbmi->mv[1];
const BLOCK_SIZE bsize = mbmi->sb_type;
const int allow_hp = xd->allow_high_precision_mv;
int_mv nearest[2], nearmv[2], best[2];
int_mv nearest, nearby, best_mv;
int_mv nearest_second, nearby_second, best_mv_second;
uint8_t inter_mode_ctx;
MV_REFERENCE_FRAME ref0;
int is_compound;
@@ -507,11 +461,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
if (vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
mbmi->mode = ZEROMV;
if (bsize < BLOCK_8X8) {
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"Invalid usage of segement feature on small blocks");
return;
}
assert(bsize >= BLOCK_8X8);
} else {
if (bsize >= BLOCK_8X8)
mbmi->mode = read_inter_mode(cm, r, inter_mode_ctx);
@@ -519,8 +469,8 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
// nearest, nearby
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref0], &nearest[0], &nearmv[0]);
best[0].as_int = nearest[0].as_int;
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref0], &nearest, &nearby);
best_mv.as_int = mbmi->ref_mvs[ref0][0].as_int;
}
if (is_compound) {
@@ -529,8 +479,9 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
ref1, mbmi->ref_mvs[ref1], mi_row, mi_col);
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1], &nearest[1], &nearmv[1]);
best[1].as_int = nearest[1].as_int;
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1],
&nearest_second, &nearby_second);
best_mv_second.as_int = mbmi->ref_mvs[ref1][0].as_int;
}
}
@@ -542,50 +493,92 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; // 1 or 2
const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; // 1 or 2
int idx, idy;
int b_mode;
for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) {
int_mv block[2];
int_mv blockmv, secondmv;
const int j = idy * 2 + idx;
b_mode = read_inter_mode(cm, r, inter_mode_ctx);
const int b_mode = read_inter_mode(cm, r, inter_mode_ctx);
if (b_mode == NEARESTMV || b_mode == NEARMV) {
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest[0],
&nearmv[0], j, 0,
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest, &nearby, j, 0,
mi_row, mi_col);
if (is_compound)
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest[1],
&nearmv[1], j, 1,
mi_row, mi_col);
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest_second,
&nearby_second, j, 1,
mi_row, mi_col);
}
if (!assign_mv(cm, b_mode, block, best, nearest, nearmv,
is_compound, allow_hp, r)) {
xd->corrupted |= 1;
break;
};
switch (b_mode) {
case NEWMV:
read_mv(r, &blockmv.as_mv, &best_mv.as_mv, nmvc,
&cm->counts.mv, allow_hp);
mi->bmi[j].as_mv[0].as_int = block[0].as_int;
if (is_compound)
read_mv(r, &secondmv.as_mv, &best_mv_second.as_mv, nmvc,
&cm->counts.mv, allow_hp);
break;
case NEARESTMV:
blockmv.as_int = nearest.as_int;
if (is_compound)
secondmv.as_int = nearest_second.as_int;
break;
case NEARMV:
blockmv.as_int = nearby.as_int;
if (is_compound)
secondmv.as_int = nearby_second.as_int;
break;
case ZEROMV:
blockmv.as_int = 0;
if (is_compound)
secondmv.as_int = 0;
break;
default:
assert(!"Invalid inter mode value");
}
mi->bmi[j].as_mv[0].as_int = blockmv.as_int;
if (is_compound)
mi->bmi[j].as_mv[1].as_int = block[1].as_int;
mi->bmi[j].as_mv[1].as_int = secondmv.as_int;
if (num_4x4_h == 2)
mi->bmi[j + 2] = mi->bmi[j];
if (num_4x4_w == 2)
mi->bmi[j + 1] = mi->bmi[j];
mi->mbmi.mode = b_mode;
}
}
mi->mbmi.mode = b_mode;
mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int;
mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int;
mv0->as_int = mi->bmi[3].as_mv[0].as_int;
mv1->as_int = mi->bmi[3].as_mv[1].as_int;
} else {
xd->corrupted |= !assign_mv(cm, mbmi->mode, mbmi->mv,
best, nearest, nearmv,
is_compound, allow_hp, r);
switch (mbmi->mode) {
case NEARMV:
mv0->as_int = nearby.as_int;
if (is_compound)
mv1->as_int = nearby_second.as_int;
break;
case NEARESTMV:
mv0->as_int = nearest.as_int;
if (is_compound)
mv1->as_int = nearest_second.as_int;
break;
case ZEROMV:
mv0->as_int = 0;
if (is_compound)
mv1->as_int = 0;
break;
case NEWMV:
read_mv(r, &mv0->as_mv, &best_mv.as_mv, nmvc, &cm->counts.mv, allow_hp);
if (is_compound)
read_mv(r, &mv1->as_mv, &best_mv_second.as_mv, nmvc, &cm->counts.mv,
allow_hp);
break;
default:
assert(!"Invalid inter mode value");
}
}
}
@@ -617,17 +610,21 @@ static void read_comp_pred(VP9_COMMON *cm, vp9_reader *r) {
if (cm->comp_pred_mode == HYBRID_PREDICTION)
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.comp_inter_prob[i]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]);
if (cm->comp_pred_mode != COMP_PREDICTION_ONLY)
for (i = 0; i < REF_CONTEXTS; i++) {
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.single_ref_prob[i][0]);
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.single_ref_prob[i][1]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][0]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]);
}
if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY)
for (i = 0; i < REF_CONTEXTS; i++)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.comp_ref_prob[i]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]);
}
void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
@@ -637,7 +634,8 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
// TODO(jkoleszar): does this clear more than MBSKIP_CONTEXTS? Maybe remove.
// vpx_memset(cm->fc.mbskip_probs, 0, sizeof(cm->fc.mbskip_probs));
for (k = 0; k < MBSKIP_CONTEXTS; ++k)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.mbskip_probs[k]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.mbskip_probs[k]);
if (cm->frame_type != KEY_FRAME && !cm->intra_only) {
nmv_context *const nmvc = &pbi->common.fc.nmvc;
@@ -650,18 +648,20 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
read_switchable_interp_probs(&cm->fc, r);
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.intra_inter_prob[i]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.intra_inter_prob[i]);
read_comp_pred(cm, r);
for (j = 0; j < BLOCK_SIZE_GROUPS; j++)
for (i = 0; i < INTRA_MODES - 1; ++i)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &cm->fc.y_mode_prob[j][i]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.y_mode_prob[j][i]);
for (j = 0; j < NUM_PARTITION_CONTEXTS; ++j)
for (i = 0; i < PARTITION_TYPES - 1; ++i)
vp9_diff_update_prob(r, MODE_UPDATE_PROB,
&cm->fc.partition_prob[INTER_FRAME][j][i]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &cm->fc.partition_prob[INTER_FRAME][j][i]);
read_mv_probs(r, nmvc, xd->allow_high_precision_mv);
}

View File

@@ -63,15 +63,18 @@ static void read_tx_probs(struct tx_probs *tx_probs, vp9_reader *r) {
for (i = 0; i < TX_SIZE_CONTEXTS; ++i)
for (j = 0; j < TX_SIZES - 3; ++j)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &tx_probs->p8x8[i][j]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &tx_probs->p8x8[i][j]);
for (i = 0; i < TX_SIZE_CONTEXTS; ++i)
for (j = 0; j < TX_SIZES - 2; ++j)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &tx_probs->p16x16[i][j]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &tx_probs->p16x16[i][j]);
for (i = 0; i < TX_SIZE_CONTEXTS; ++i)
for (j = 0; j < TX_SIZES - 1; ++j)
vp9_diff_update_prob(r, MODE_UPDATE_PROB, &tx_probs->p32x32[i][j]);
if (vp9_read(r, MODE_UPDATE_PROB))
vp9_diff_update_prob(r, &tx_probs->p32x32[i][j]);
}
static void setup_plane_dequants(VP9_COMMON *cm, MACROBLOCKD *xd, int q_index) {
@@ -361,8 +364,8 @@ static void read_coef_probs_common(vp9_coeff_probs_model *coef_probs,
for (l = 0; l < PREV_COEF_CONTEXTS; l++)
if (k > 0 || l < 3)
for (m = 0; m < UNCONSTRAINED_NODES; m++)
vp9_diff_update_prob(r, VP9_COEF_UPDATE_PROB,
&coef_probs[i][j][k][l][m]);
if (vp9_read(r, VP9_COEF_UPDATE_PROB))
vp9_diff_update_prob(r, &coef_probs[i][j][k][l][m]);
}
static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode,
@@ -792,7 +795,6 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
struct vp9_read_bit_buffer *rb) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
size_t sz;
int i;
cm->last_frame_type = cm->frame_type;
@@ -898,13 +900,8 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
setup_segmentation(&cm->seg, rb);
setup_tile_info(cm, rb);
sz = vp9_rb_read_literal(rb, 16);
if (sz == 0)
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Invalid header size");
return sz;
return vp9_rb_read_literal(rb, 16);
}
static int read_compressed_header(VP9D_COMP *pbi, const uint8_t *data,
@@ -954,9 +951,9 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
YV12_BUFFER_CONFIG *new_fb = &cm->yv12_fb[cm->new_fb_idx];
if (!first_partition_size) {
// showing a frame directly
*p_data_end = data + 1;
return 0;
// showing a frame directly
*p_data_end = data + 1;
return 0;
}
data += vp9_rb_bytes_read(&rb);
xd->corrupted = 0;

View File

@@ -48,6 +48,8 @@ static int merge_index(int v, int n, int modulus) {
static int inv_remap_prob(int v, int m) {
static int inv_map_table[MAX_PROB - 1] = {
// generated by:
// inv_map_table[j] = merge_index(j, MAX_PROB - 1, MODULUS_PARAM);
6, 19, 32, 45, 58, 71, 84, 97, 110, 123, 136, 149, 162, 175, 188,
201, 214, 227, 240, 253, 0, 1, 2, 3, 4, 5, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26,
@@ -64,11 +66,10 @@ static int inv_remap_prob(int v, int m) {
190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 202, 203, 204, 205,
206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221,
222, 223, 224, 225, 226, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
238, 239, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252
238, 239, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
};
// The clamp is not necessary for conforming VP9 stream, it is added to
// prevent out of bound access for bad input data
v = clamp(v, 0, 253);
// v = merge_index(v, MAX_PROBS - 1, MODULUS_PARAM);
v = inv_map_table[v];
m--;
if ((m << 1) <= MAX_PROB) {
@@ -99,9 +100,7 @@ static int decode_term_subexp(vp9_reader *r, int k, int num_syms) {
return word;
}
void vp9_diff_update_prob(vp9_reader *r, int update_prob, vp9_prob* p) {
if (vp9_read(r, update_prob)) {
const int delp = decode_term_subexp(r, SUBEXP_PARAM, 255);
*p = (vp9_prob)inv_remap_prob(delp, *p);
}
void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p) {
int delp = decode_term_subexp(r, SUBEXP_PARAM, 255);
*p = (vp9_prob)inv_remap_prob(delp, *p);
}

View File

@@ -14,6 +14,6 @@
#include "vp9/decoder/vp9_dboolhuff.h"
void vp9_diff_update_prob(vp9_reader *r, int update_prob, vp9_prob* p);
void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p);
#endif // VP9_DECODER_VP9_DSUBEXP_H_

View File

@@ -936,7 +936,7 @@ static void copy_partitioning(VP9_COMP *cpi, MODE_INFO **mi_8x8,
for (block_col = 0; block_col < 8; ++block_col) {
MODE_INFO * prev_mi = prev_mi_8x8[block_row * mis + block_col];
BLOCK_SIZE sb_type = prev_mi ? prev_mi->mbmi.sb_type : 0;
ptrdiff_t offset;
int offset;
if (prev_mi) {
offset = prev_mi - cm->prev_mi;
@@ -1044,9 +1044,9 @@ static void fill_variance(var *v, int64_t s2, int64_t s, int c) {
v->sum_error = s;
v->count = c;
if (c > 0)
v->variance = (int)(256
v->variance = 256
* (v->sum_square_error - v->sum_error * v->sum_error / v->count)
/ v->count);
/ v->count;
else
v->variance = 0;
}

View File

@@ -565,16 +565,16 @@ static void set_rd_speed_thresholds(VP9_COMP *cpi, int mode) {
sf->thresh_mult[THR_NEARESTG] = 0;
sf->thresh_mult[THR_NEARESTA] = 0;
sf->thresh_mult[THR_NEWMV] += 1000;
sf->thresh_mult[THR_COMP_NEARESTLA] += 1000;
sf->thresh_mult[THR_NEARMV] += 1000;
sf->thresh_mult[THR_COMP_NEARESTGA] += 1000;
sf->thresh_mult[THR_DC] += 1000;
sf->thresh_mult[THR_NEWMV] += 1000;
sf->thresh_mult[THR_NEWA] += 1000;
sf->thresh_mult[THR_NEWG] += 1000;
sf->thresh_mult[THR_NEARMV] += 1000;
sf->thresh_mult[THR_NEWA] += 1000;
sf->thresh_mult[THR_NEARA] += 1000;
sf->thresh_mult[THR_COMP_NEARESTLA] += 1000;
sf->thresh_mult[THR_COMP_NEARESTGA] += 1000;
sf->thresh_mult[THR_TM] += 1000;
@@ -606,6 +606,28 @@ static void set_rd_speed_thresholds(VP9_COMP *cpi, int mode) {
sf->thresh_mult[THR_D207_PRED] += 2500;
sf->thresh_mult[THR_D63_PRED] += 2500;
if (cpi->sf.skip_lots_of_modes) {
for (i = 0; i < MAX_MODES; ++i)
sf->thresh_mult[i] = INT_MAX;
sf->thresh_mult[THR_DC] = 2000;
sf->thresh_mult[THR_TM] = 2000;
sf->thresh_mult[THR_NEWMV] = 4000;
sf->thresh_mult[THR_NEWG] = 4000;
sf->thresh_mult[THR_NEWA] = 4000;
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_NEARESTG] = 0;
sf->thresh_mult[THR_NEARESTA] = 0;
sf->thresh_mult[THR_NEARMV] = 2000;
sf->thresh_mult[THR_NEARG] = 2000;
sf->thresh_mult[THR_NEARA] = 2000;
sf->thresh_mult[THR_COMP_NEARESTLA] = 2000;
sf->thresh_mult[THR_SPLITMV] = 2500;
sf->thresh_mult[THR_SPLITG] = 2500;
sf->thresh_mult[THR_SPLITA] = 2500;
sf->recode_loop = 0;
}
/* disable frame modes if flags not set */
if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) {
sf->thresh_mult[THR_NEWMV ] = INT_MAX;
@@ -692,6 +714,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->adaptive_motion_search = 0;
sf->use_avoid_tested_higherror = 0;
sf->reference_masking = 0;
sf->skip_lots_of_modes = 0;
sf->partition_by_variance = 0;
sf->use_one_partition_size_always = 0;
sf->less_rectangular_check = 0;
@@ -773,7 +796,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->intra_y_mode_mask = INTRA_DC_TM_H_V;
sf->intra_uv_mode_mask = INTRA_DC_TM_H_V;
sf->use_fast_coef_updates = 1;
sf->mode_skip_start = 11;
sf->mode_skip_start = 9;
}
if (speed == 2) {
sf->less_rectangular_check = 1;
@@ -812,7 +835,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->disable_split_var_thresh = 32;
sf->disable_filter_search_var_thresh = 32;
sf->use_fast_coef_updates = 2;
sf->mode_skip_start = 6;
sf->mode_skip_start = 9;
}
if (speed == 3) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
@@ -840,7 +863,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->intra_y_mode_mask = INTRA_DC_ONLY;
sf->intra_uv_mode_mask = INTRA_DC_ONLY;
sf->use_fast_coef_updates = 2;
sf->mode_skip_start = 6;
sf->mode_skip_start = 9;
}
if (speed == 4) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
@@ -872,7 +895,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->intra_y_mode_mask = INTRA_DC_ONLY;
sf->intra_uv_mode_mask = INTRA_DC_ONLY;
sf->use_fast_coef_updates = 2;
sf->mode_skip_start = 6;
sf->mode_skip_start = 9;
}
break;

View File

@@ -267,6 +267,7 @@ typedef struct {
TX_SIZE_SEARCH_METHOD tx_size_search_method;
int use_lp32x32fdct;
int use_avoid_tested_higherror;
int skip_lots_of_modes;
int partition_by_variance;
int use_one_partition_size_always;
int less_rectangular_check;

View File

@@ -369,8 +369,8 @@ static void model_rd_from_var_lapndz(int var, int n, int qstep,
double s2 = (double) var / n;
double x = qstep / sqrt(s2);
model_rd_norm(x, &R, &D);
*rate = (int)((n << 8) * R + 0.5);
*dist = (int)(var * D + 0.5);
*rate = ((n << 8) * R + 0.5);
*dist = (var * D + 0.5);
}
vp9_clear_system_state();
}
@@ -397,7 +397,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
pd->dequant[1] >> 3, &rate, &dist);
rate_sum += rate;
dist_sum += (int)dist;
dist_sum += dist;
}
*out_rate_sum = rate_sum;
@@ -868,8 +868,8 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
}
}
for (n = TX_4X4; n <= max_txfm_size; n++) {
rd[n][0] = (int64_t)(scale_rd[n] * rd[n][0]);
rd[n][1] = (int64_t)(scale_rd[n] * rd[n][1]);
rd[n][0] = (scale_rd[n] * rd[n][0]);
rd[n][1] = (scale_rd[n] * rd[n][1]);
}
if (max_txfm_size == TX_32X32 &&
@@ -1446,7 +1446,6 @@ static int labels2mode(MACROBLOCK *x, int i,
int idx, idy;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mbmi->sb_type];
const int has_second_rf = has_second_ref(mbmi);
/* We have to be careful retrieving previously-encoded motion vectors.
Ones from this macroblock have to be pulled from the BLOCKD array
@@ -1460,7 +1459,7 @@ static int labels2mode(MACROBLOCK *x, int i,
this_mv->as_int = seg_mvs[mbmi->ref_frame[0]].as_int;
thismvcost = vp9_mv_bit_cost(this_mv, best_ref_mv, mvjcost, mvcost,
102);
if (has_second_rf) {
if (mbmi->ref_frame[1] > 0) {
this_second_mv->as_int = seg_mvs[mbmi->ref_frame[1]].as_int;
thismvcost += vp9_mv_bit_cost(this_second_mv, second_best_ref_mv,
mvjcost, mvcost, 102);
@@ -1468,19 +1467,19 @@ static int labels2mode(MACROBLOCK *x, int i,
break;
case NEARESTMV:
this_mv->as_int = frame_mv[NEARESTMV][mbmi->ref_frame[0]].as_int;
if (has_second_rf)
if (mbmi->ref_frame[1] > 0)
this_second_mv->as_int =
frame_mv[NEARESTMV][mbmi->ref_frame[1]].as_int;
break;
case NEARMV:
this_mv->as_int = frame_mv[NEARMV][mbmi->ref_frame[0]].as_int;
if (has_second_rf)
if (mbmi->ref_frame[1] > 0)
this_second_mv->as_int =
frame_mv[NEARMV][mbmi->ref_frame[1]].as_int;
break;
case ZEROMV:
this_mv->as_int = 0;
if (has_second_rf)
if (mbmi->ref_frame[1] > 0)
this_second_mv->as_int = 0;
break;
default:
@@ -1491,7 +1490,7 @@ static int labels2mode(MACROBLOCK *x, int i,
mbmi->mode_context[mbmi->ref_frame[0]]);
mic->bmi[i].as_mv[0].as_int = this_mv->as_int;
if (has_second_rf)
if (mbmi->ref_frame[1] > 0)
mic->bmi[i].as_mv[1].as_int = this_second_mv->as_int;
x->partition_info->bmi[i].mode = m;
@@ -1624,7 +1623,7 @@ static INLINE void mi_buf_shift(MACROBLOCK *x, int i) {
assert(((intptr_t)pd->pre[0].buf & 0x7) == 0);
pd->pre[0].buf = raster_block_offset_uint8(BLOCK_8X8, i, pd->pre[0].buf,
pd->pre[0].stride);
if (has_second_ref(mbmi))
if (mbmi->ref_frame[1])
pd->pre[1].buf = raster_block_offset_uint8(BLOCK_8X8, i, pd->pre[1].buf,
pd->pre[1].stride);
}
@@ -1634,7 +1633,7 @@ static INLINE void mi_buf_restore(MACROBLOCK *x, struct buf_2d orig_src,
MB_MODE_INFO *mbmi = &x->e_mbd.mi_8x8[0]->mbmi;
x->plane[0].src = orig_src;
x->e_mbd.plane[0].pre[0] = orig_pre[0];
if (has_second_ref(mbmi))
if (mbmi->ref_frame[1])
x->e_mbd.plane[0].pre[1] = orig_pre[1];
}
@@ -1659,7 +1658,6 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
BEST_SEG_INFO *bsi = bsi_buf + filter_idx;
int mode_idx;
int subpelmv = 1, have_ref = 0;
const int has_second_rf = has_second_ref(mbmi);
vpx_memcpy(t_above, x->e_mbd.plane[0].above_context, sizeof(t_above));
vpx_memcpy(t_left, x->e_mbd.plane[0].left_context, sizeof(t_left));
@@ -1689,7 +1687,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
&frame_mv[NEARESTMV][mbmi->ref_frame[0]],
&frame_mv[NEARMV][mbmi->ref_frame[0]],
i, 0, mi_row, mi_col);
if (has_second_rf)
if (mbmi->ref_frame[1] > 0)
vp9_append_sub8x8_mvs_for_idx(&cpi->common, &x->e_mbd,
&frame_mv[NEARESTMV][mbmi->ref_frame[1]],
&frame_mv[NEARMV][mbmi->ref_frame[1]],
@@ -1707,7 +1705,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
if ((this_mode == NEARMV || this_mode == NEARESTMV ||
this_mode == ZEROMV) &&
frame_mv[this_mode][mbmi->ref_frame[0]].as_int == 0 &&
(!has_second_rf ||
(mbmi->ref_frame[1] <= 0 ||
frame_mv[this_mode][mbmi->ref_frame[1]].as_int == 0)) {
int rfc = mbmi->mode_context[mbmi->ref_frame[0]];
int c1 = cost_mv_ref(cpi, NEARMV, rfc);
@@ -1722,7 +1720,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
continue;
} else {
assert(this_mode == ZEROMV);
if (!has_second_rf) {
if (mbmi->ref_frame[1] <= 0) {
if ((c3 >= c2 &&
frame_mv[NEARESTMV][mbmi->ref_frame[0]].as_int == 0) ||
(c3 >= c1 &&
@@ -1747,7 +1745,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
sizeof(bsi->rdstat[i][mode_idx].tl));
// motion search for newmv (single predictor case only)
if (!has_second_rf && this_mode == NEWMV &&
if (mbmi->ref_frame[1] <= 0 && this_mode == NEWMV &&
seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV) {
int step_param = 0;
int further_steps;
@@ -1858,7 +1856,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
mi_buf_restore(x, orig_src, orig_pre);
}
if (has_second_rf && this_mode == NEWMV &&
if (mbmi->ref_frame[1] > 0 && this_mode == NEWMV &&
mbmi->interp_filter == EIGHTTAP) {
if (seg_mvs[i][mbmi->ref_frame[1]].as_int == INVALID_MV ||
seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV)
@@ -1893,7 +1891,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
if (num_4x4_blocks_high > 1)
bsi->rdstat[i + 2][mode_idx].mvs[0].as_int =
mode_mv[this_mode].as_int;
if (has_second_rf) {
if (mbmi->ref_frame[1] > 0) {
bsi->rdstat[i][mode_idx].mvs[1].as_int =
second_mode_mv[this_mode].as_int;
if (num_4x4_blocks_wide > 1)
@@ -1907,7 +1905,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
// Trap vectors that reach beyond the UMV borders
if (mv_check_bounds(x, &mode_mv[this_mode]))
continue;
if (has_second_rf &&
if (mbmi->ref_frame[1] > 0 &&
mv_check_bounds(x, &second_mode_mv[this_mode]))
continue;
@@ -1917,7 +1915,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
(mode_mv[this_mode].as_mv.col & 0x0f);
have_ref = mode_mv[this_mode].as_int ==
ref_bsi->rdstat[i][mode_idx].mvs[0].as_int;
if (has_second_rf) {
if (mbmi->ref_frame[1] > 0) {
subpelmv |= (second_mode_mv[this_mode].as_mv.row & 0x0f) ||
(second_mode_mv[this_mode].as_mv.col & 0x0f);
have_ref &= second_mode_mv[this_mode].as_int ==
@@ -1928,7 +1926,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
ref_bsi = bsi_buf + 1;
have_ref = mode_mv[this_mode].as_int ==
ref_bsi->rdstat[i][mode_idx].mvs[0].as_int;
if (has_second_rf) {
if (mbmi->ref_frame[1] > 0) {
have_ref &= second_mode_mv[this_mode].as_int ==
ref_bsi->rdstat[i][mode_idx].mvs[1].as_int;
}
@@ -2061,7 +2059,7 @@ static int64_t rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x,
for (i = 0; i < 4; i++) {
mode_idx = inter_mode_offset(bsi->modes[i]);
mi->bmi[i].as_mv[0].as_int = bsi->rdstat[i][mode_idx].mvs[0].as_int;
if (has_second_ref(mbmi))
if (mbmi->ref_frame[1] > 0)
mi->bmi[i].as_mv[1].as_int = bsi->rdstat[i][mode_idx].mvs[1].as_int;
xd->plane[0].eobs[i] = bsi->rdstat[i][mode_idx].eobs;
x->partition_info->bmi[i].mode = bsi->modes[i];
@@ -2906,7 +2904,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
unsigned int thresh_ac;
// The encode_breakout input
unsigned int encode_breakout = x->encode_breakout << 4;
unsigned int max_thresh = 36000;
int max_thresh = 36000;
// Use extreme low threshold for static frames to limit skipping.
if (cpi->enable_encode_breakout == 2)
@@ -3253,7 +3251,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
assert(!"Invalid Reference frame");
}
}
if (cpi->mode_skip_mask & ((int64_t)1 << mode_index))
if (cpi->mode_skip_mask & (1 << mode_index))
continue;
}
@@ -3450,7 +3448,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// Disable intra modes other than DC_PRED for blocks with low variance
// Threshold for intra skipping based on source variance
// TODO(debargha): Specialize the threshold for super block sizes
static const unsigned int skip_intra_var_thresh[BLOCK_SIZES] = {
static const int skip_intra_var_thresh[BLOCK_SIZES] = {
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
};
if ((cpi->sf.mode_search_skip_flags & FLAG_SKIP_INTRA_LOWVAR) &&

View File

@@ -589,8 +589,7 @@ static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
static int write_superframe_index(vpx_codec_alg_priv_t *ctx) {
uint8_t marker = 0xc0;
unsigned int mask;
int mag, index_sz;
int mag, mask, index_sz;
assert(ctx->pending_frame_count);
assert(ctx->pending_frame_count <= 8);

View File

@@ -655,10 +655,8 @@ static vpx_codec_err_t get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
if (corrupted) {
VP9D_COMP *pbi = (VP9D_COMP *)ctx->pbi;
if (pbi)
*corrupted = pbi->common.frame_to_show->corrupted;
else
return VPX_CODEC_ERROR;
*corrupted = pbi->common.frame_to_show->corrupted;
return VPX_CODEC_OK;
} else
return VPX_CODEC_INVALID_PARAM;