Merge MISC_FIXES
Remove MISC_FIXES flags except for the changes on MV precision, which has a 0.1% performance drop. On derflr, the impact is -0.012%. Change-Id: I0a74e5a212dd0cb827192a318c92a714c9681e45
This commit is contained in:
Родитель
5f9e089b1d
Коммит
66f2f65ef7
|
@ -104,9 +104,7 @@ typedef struct {
|
|||
TX_SIZE inter_tx_size[64];
|
||||
#endif
|
||||
int8_t skip;
|
||||
#if CONFIG_MISC_FIXES
|
||||
int8_t has_no_coeffs;
|
||||
#endif
|
||||
int8_t segment_id;
|
||||
int8_t seg_id_predicted; // valid only when temporal_update is enabled
|
||||
|
||||
|
|
|
@ -127,21 +127,6 @@ const vpx_prob vp10_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] =
|
|||
}
|
||||
};
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
const vpx_prob vp10_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = {
|
||||
{ 144, 11, 54, 157, 195, 130, 46, 58, 108 }, // y = dc
|
||||
{ 118, 15, 123, 148, 131, 101, 44, 93, 131 }, // y = v
|
||||
{ 113, 12, 23, 188, 226, 142, 26, 32, 125 }, // y = h
|
||||
{ 120, 11, 50, 123, 163, 135, 64, 77, 103 }, // y = d45
|
||||
{ 113, 9, 36, 155, 111, 157, 32, 44, 161 }, // y = d135
|
||||
{ 116, 9, 55, 176, 76, 96, 37, 61, 149 }, // y = d117
|
||||
{ 115, 9, 28, 141, 161, 167, 21, 25, 193 }, // y = d153
|
||||
{ 120, 12, 32, 145, 195, 142, 32, 38, 86 }, // y = d207
|
||||
{ 116, 12, 64, 120, 140, 125, 49, 115, 121 }, // y = d63
|
||||
{ 102, 19, 66, 162, 182, 122, 35, 59, 128 } // y = tm
|
||||
};
|
||||
#endif
|
||||
|
||||
static const vpx_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_MODES - 1] = {
|
||||
{ 65, 32, 18, 144, 162, 194, 41, 51, 98 }, // block_size < 8x8
|
||||
{ 132, 68, 18, 165, 217, 196, 45, 40, 78 }, // block_size < 16x16
|
||||
|
@ -162,32 +147,6 @@ static const vpx_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
|
|||
{ 101, 21, 107, 181, 192, 103, 19, 67, 125 } // y = tm
|
||||
};
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
const vpx_prob vp10_kf_partition_probs[PARTITION_CONTEXTS]
|
||||
[PARTITION_TYPES - 1] = {
|
||||
// 8x8 -> 4x4
|
||||
{ 158, 97, 94 }, // a/l both not split
|
||||
{ 93, 24, 99 }, // a split, l not split
|
||||
{ 85, 119, 44 }, // l split, a not split
|
||||
{ 62, 59, 67 }, // a/l both split
|
||||
// 16x16 -> 8x8
|
||||
{ 149, 53, 53 }, // a/l both not split
|
||||
{ 94, 20, 48 }, // a split, l not split
|
||||
{ 83, 53, 24 }, // l split, a not split
|
||||
{ 52, 18, 18 }, // a/l both split
|
||||
// 32x32 -> 16x16
|
||||
{ 150, 40, 39 }, // a/l both not split
|
||||
{ 78, 12, 26 }, // a split, l not split
|
||||
{ 67, 33, 11 }, // l split, a not split
|
||||
{ 24, 7, 5 }, // a/l both split
|
||||
// 64x64 -> 32x32
|
||||
{ 174, 35, 49 }, // a/l both not split
|
||||
{ 68, 11, 27 }, // a split, l not split
|
||||
{ 57, 15, 9 }, // l split, a not split
|
||||
{ 12, 3, 3 }, // a/l both split
|
||||
};
|
||||
#endif
|
||||
|
||||
static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
|
||||
[PARTITION_TYPES - 1] = {
|
||||
// 8x8 -> 4x4
|
||||
|
@ -1085,13 +1044,12 @@ default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES]
|
|||
}
|
||||
};
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MISC_FIXES
|
||||
|
||||
// FIXME(someone) need real defaults here
|
||||
static const struct segmentation_probs default_seg_probs = {
|
||||
{ 128, 128, 128, 128, 128, 128, 128 },
|
||||
{ 128, 128, 128 },
|
||||
};
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
static const vpx_prob default_ext_intra_probs[2] = {230, 230};
|
||||
|
@ -1116,10 +1074,8 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
|
|||
vp10_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob);
|
||||
vp10_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob);
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MISC_FIXES
|
||||
vp10_copy(fc->seg.tree_probs, default_seg_probs.tree_probs);
|
||||
vp10_copy(fc->seg.pred_probs, default_seg_probs.pred_probs);
|
||||
#endif
|
||||
#if CONFIG_EXT_INTRA
|
||||
vp10_copy(fc->ext_intra_probs, default_ext_intra_probs);
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
@ -1168,16 +1124,6 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
|
|||
vpx_tree_merge_probs(vp10_intra_mode_tree, pre_fc->y_mode_prob[i],
|
||||
counts->y_mode[i], fc->y_mode_prob[i]);
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
for (i = 0; i < INTRA_MODES; ++i)
|
||||
vpx_tree_merge_probs(vp10_intra_mode_tree, pre_fc->uv_mode_prob[i],
|
||||
counts->uv_mode[i], fc->uv_mode_prob[i]);
|
||||
|
||||
for (i = 0; i < PARTITION_CONTEXTS; i++)
|
||||
vpx_tree_merge_probs(vp10_partition_tree, pre_fc->partition_prob[i],
|
||||
counts->partition[i], fc->partition_prob[i]);
|
||||
#endif
|
||||
|
||||
if (cm->interp_filter == SWITCHABLE) {
|
||||
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
|
||||
vpx_tree_merge_probs(vp10_switchable_interp_tree,
|
||||
|
@ -1252,7 +1198,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
|
|||
}
|
||||
}
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MISC_FIXES
|
||||
|
||||
if (cm->seg.temporal_update) {
|
||||
for (i = 0; i < PREDICTION_PROBS; i++)
|
||||
fc->seg.pred_probs[i] = mode_mv_merge_probs(pre_fc->seg.pred_probs[i],
|
||||
|
@ -1272,7 +1218,7 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
|
|||
for (i = 0; i < PARTITION_CONTEXTS; i++)
|
||||
vpx_tree_merge_probs(vp10_partition_tree, pre_fc->partition_prob[i],
|
||||
counts->partition[i], fc->partition_prob[i]);
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
for (i = 0; i < PLANE_TYPES; ++i) {
|
||||
fc->ext_intra_probs[i] = mode_mv_merge_probs(
|
||||
|
|
|
@ -77,9 +77,7 @@ typedef struct frame_contexts {
|
|||
vpx_prob intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[TX_TYPES - 1];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MISC_FIXES
|
||||
struct segmentation_probs seg;
|
||||
#endif
|
||||
#if CONFIG_EXT_INTRA
|
||||
vpx_prob ext_intra_probs[PLANE_TYPES];
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
@ -111,9 +109,7 @@ typedef struct FRAME_COUNTS {
|
|||
unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||
[TX_TYPES];
|
||||
#endif // CONFIG_EXT_TX
|
||||
#if CONFIG_MISC_FIXES
|
||||
struct seg_counts seg;
|
||||
#endif
|
||||
#if CONFIG_EXT_INTRA
|
||||
unsigned int ext_intra[PLANE_TYPES][2];
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
@ -121,11 +117,6 @@ typedef struct FRAME_COUNTS {
|
|||
|
||||
extern const vpx_prob vp10_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
|
||||
[INTRA_MODES - 1];
|
||||
#if !CONFIG_MISC_FIXES
|
||||
extern const vpx_prob vp10_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
|
||||
extern const vpx_prob vp10_kf_partition_probs[PARTITION_CONTEXTS]
|
||||
[PARTITION_TYPES - 1];
|
||||
#endif
|
||||
extern const vpx_prob
|
||||
vp10_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES][PALETTE_Y_MODE_CONTEXTS];
|
||||
extern const vpx_prob
|
||||
|
|
|
@ -719,11 +719,7 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
|
|||
uint64_t *const int_4x4_y = &lfm->int_4x4_y;
|
||||
uint16_t *const left_uv = &lfm->left_uv[tx_size_uv];
|
||||
uint16_t *const above_uv = &lfm->above_uv[tx_size_uv];
|
||||
#if CONFIG_MISC_FIXES
|
||||
uint16_t *const int_4x4_uv = &lfm->left_int_4x4_uv;
|
||||
#else
|
||||
uint16_t *const int_4x4_uv = &lfm->int_4x4_uv;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
// If filter level is 0 we don't loop filter.
|
||||
|
@ -758,13 +754,8 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
|
|||
|
||||
// If the block has no coefficients and is not intra we skip applying
|
||||
// the loop filter on block edges.
|
||||
#if CONFIG_MISC_FIXES
|
||||
if ((mbmi->skip || mbmi->has_no_coeffs) && is_inter_block(mbmi))
|
||||
return;
|
||||
#else
|
||||
if (mbmi->skip && is_inter_block(mbmi))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Here we are adding a mask for the transform size. The transform
|
||||
// size mask is set to be correct for a 64x64 prediction block size. We
|
||||
|
@ -821,13 +812,8 @@ static void build_y_mask(const loop_filter_info_n *const lfi_n,
|
|||
*above_y |= above_prediction_mask[block_size] << shift_y;
|
||||
*left_y |= left_prediction_mask[block_size] << shift_y;
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
if ((mbmi->skip || mbmi->has_no_coeffs) && is_inter_block(mbmi))
|
||||
return;
|
||||
#else
|
||||
if (mbmi->skip && is_inter_block(mbmi))
|
||||
return;
|
||||
#endif
|
||||
|
||||
*above_y |= (size_mask[block_size] &
|
||||
above_64x64_txform_mask[tx_size_y]) << shift_y;
|
||||
|
@ -1019,11 +1005,7 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||
lfm->above_uv[i] &= mask_uv;
|
||||
}
|
||||
lfm->int_4x4_y &= mask_y;
|
||||
#if CONFIG_MISC_FIXES
|
||||
lfm->above_int_4x4_uv = lfm->left_int_4x4_uv & mask_uv;
|
||||
#else
|
||||
lfm->int_4x4_uv &= mask_uv;
|
||||
#endif
|
||||
|
||||
// We don't apply a wide loop filter on the last uv block row. If set
|
||||
// apply the shorter one instead.
|
||||
|
@ -1057,11 +1039,7 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||
lfm->above_uv[i] &= mask_uv;
|
||||
}
|
||||
lfm->int_4x4_y &= mask_y;
|
||||
#if CONFIG_MISC_FIXES
|
||||
lfm->left_int_4x4_uv &= mask_uv_int;
|
||||
#else
|
||||
lfm->int_4x4_uv &= mask_uv_int;
|
||||
#endif
|
||||
|
||||
// We don't apply a wide loop filter on the last uv column. If set
|
||||
// apply the shorter one instead.
|
||||
|
@ -1091,11 +1069,7 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||
assert(!(lfm->left_uv[TX_16X16]&lfm->left_uv[TX_8X8]));
|
||||
assert(!(lfm->left_uv[TX_16X16] & lfm->left_uv[TX_4X4]));
|
||||
assert(!(lfm->left_uv[TX_8X8] & lfm->left_uv[TX_4X4]));
|
||||
#if CONFIG_MISC_FIXES
|
||||
assert(!(lfm->left_int_4x4_uv & lfm->left_uv[TX_16X16]));
|
||||
#else
|
||||
assert(!(lfm->int_4x4_uv & lfm->left_uv[TX_16X16]));
|
||||
#endif
|
||||
assert(!(lfm->above_y[TX_16X16] & lfm->above_y[TX_8X8]));
|
||||
assert(!(lfm->above_y[TX_16X16] & lfm->above_y[TX_4X4]));
|
||||
assert(!(lfm->above_y[TX_8X8] & lfm->above_y[TX_4X4]));
|
||||
|
@ -1103,11 +1077,7 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||
assert(!(lfm->above_uv[TX_16X16] & lfm->above_uv[TX_8X8]));
|
||||
assert(!(lfm->above_uv[TX_16X16] & lfm->above_uv[TX_4X4]));
|
||||
assert(!(lfm->above_uv[TX_8X8] & lfm->above_uv[TX_4X4]));
|
||||
#if CONFIG_MISC_FIXES
|
||||
assert(!(lfm->above_int_4x4_uv & lfm->above_uv[TX_16X16]));
|
||||
#else
|
||||
assert(!(lfm->int_4x4_uv & lfm->above_uv[TX_16X16]));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void filter_selectively_vert(uint8_t *s, int pitch,
|
||||
|
@ -1510,11 +1480,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
|
|||
uint16_t mask_16x16 = lfm->left_uv[TX_16X16];
|
||||
uint16_t mask_8x8 = lfm->left_uv[TX_8X8];
|
||||
uint16_t mask_4x4 = lfm->left_uv[TX_4X4];
|
||||
#if CONFIG_MISC_FIXES
|
||||
uint16_t mask_4x4_int = lfm->left_int_4x4_uv;
|
||||
#else
|
||||
uint16_t mask_4x4_int = lfm->int_4x4_uv;
|
||||
#endif
|
||||
|
||||
assert(plane->subsampling_x == 1 && plane->subsampling_y == 1);
|
||||
|
||||
|
@ -1566,11 +1532,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
|
|||
mask_16x16 = lfm->above_uv[TX_16X16];
|
||||
mask_8x8 = lfm->above_uv[TX_8X8];
|
||||
mask_4x4 = lfm->above_uv[TX_4X4];
|
||||
#if CONFIG_MISC_FIXES
|
||||
mask_4x4_int = lfm->above_int_4x4_uv;
|
||||
#else
|
||||
mask_4x4_int = lfm->int_4x4_uv;
|
||||
#endif
|
||||
|
||||
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
|
||||
const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
|
||||
|
|
|
@ -80,12 +80,8 @@ typedef struct {
|
|||
uint64_t int_4x4_y;
|
||||
uint16_t left_uv[TX_SIZES];
|
||||
uint16_t above_uv[TX_SIZES];
|
||||
#if CONFIG_MISC_FIXES
|
||||
uint16_t left_int_4x4_uv;
|
||||
uint16_t above_int_4x4_uv;
|
||||
#else
|
||||
uint16_t int_4x4_uv;
|
||||
#endif
|
||||
uint8_t lfl_y[64];
|
||||
uint8_t lfl_uv[16];
|
||||
} LOOP_FILTER_MASK;
|
||||
|
|
|
@ -30,11 +30,6 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
|
|||
const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type] << 3;
|
||||
const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type] << 3;
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
// Blank the reference vector list
|
||||
memset(mv_ref_list, 0, sizeof(*mv_ref_list) * MAX_MV_REF_CANDIDATES);
|
||||
#endif
|
||||
|
||||
// The nearest 2 blocks are treated differently
|
||||
// if the size < 8x8 we get the mv from the bmi substructure,
|
||||
// and we also need to keep a mode count.
|
||||
|
@ -133,9 +128,6 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
|
|||
}
|
||||
|
||||
if (prev_frame_mvs->ref_frame[1] > INTRA_FRAME &&
|
||||
#if !CONFIG_MISC_FIXES
|
||||
prev_frame_mvs->mv[1].as_int != prev_frame_mvs->mv[0].as_int &&
|
||||
#endif
|
||||
prev_frame_mvs->ref_frame[1] != ref_frame) {
|
||||
int_mv mv = prev_frame_mvs->mv[1];
|
||||
if (ref_sign_bias[prev_frame_mvs->ref_frame[1]] !=
|
||||
|
@ -148,17 +140,9 @@ static void find_mv_refs_idx(const VP10_COMMON *cm, const MACROBLOCKD *xd,
|
|||
}
|
||||
|
||||
Done:
|
||||
|
||||
mode_context[ref_frame] = counter_to_context[context_counter];
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
for (i = refmv_count; i < MAX_MV_REF_CANDIDATES; ++i)
|
||||
mv_ref_list[i].as_int = 0;
|
||||
#else
|
||||
// Clamp vectors
|
||||
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i)
|
||||
clamp_mv_ref(&mv_ref_list[i].as_mv, bw, bh, xd);
|
||||
#endif
|
||||
}
|
||||
|
||||
void vp10_find_mv_refs(const VP10_COMMON *cm, const MACROBLOCKD *xd,
|
||||
|
|
|
@ -119,26 +119,13 @@ static const int idx_n_column_to_subblock[4][2] = {
|
|||
};
|
||||
|
||||
// clamp_mv_ref
|
||||
#if CONFIG_MISC_FIXES
|
||||
#define MV_BORDER (8 << 3) // Allow 8 pels in 1/8th pel units
|
||||
#else
|
||||
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
|
||||
#endif
|
||||
|
||||
static INLINE void clamp_mv_ref(MV *mv, int bw, int bh, const MACROBLOCKD *xd) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
clamp_mv(mv, xd->mb_to_left_edge - bw * 8 - MV_BORDER,
|
||||
xd->mb_to_right_edge + bw * 8 + MV_BORDER,
|
||||
xd->mb_to_top_edge - bh * 8 - MV_BORDER,
|
||||
xd->mb_to_bottom_edge + bh * 8 + MV_BORDER);
|
||||
#else
|
||||
(void) bw;
|
||||
(void) bh;
|
||||
clamp_mv(mv, xd->mb_to_left_edge - MV_BORDER,
|
||||
xd->mb_to_right_edge + MV_BORDER,
|
||||
xd->mb_to_top_edge - MV_BORDER,
|
||||
xd->mb_to_bottom_edge + MV_BORDER);
|
||||
#endif
|
||||
}
|
||||
|
||||
// This function returns either the appropriate sub block or block's mv
|
||||
|
@ -164,11 +151,7 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
|
|||
return mv;
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
#define CLIP_IN_ADD(mv, bw, bh, xd) clamp_mv_ref(mv, bw, bh, xd)
|
||||
#else
|
||||
#define CLIP_IN_ADD(mv, bw, bh, xd) do {} while (0)
|
||||
#endif
|
||||
|
||||
// This macro is used to add a motion vector mv_ref list if it isn't
|
||||
// already in the list. If it's the second motion vector it will also
|
||||
|
@ -194,8 +177,6 @@ static INLINE int_mv scale_mv(const MB_MODE_INFO *mbmi, int ref,
|
|||
ADD_MV_REF_LIST(scale_mv((mbmi), 0, ref_frame, ref_sign_bias), \
|
||||
refmv_count, mv_ref_list, bw, bh, xd, Done); \
|
||||
if (has_second_ref(mbmi) && \
|
||||
(CONFIG_MISC_FIXES || \
|
||||
(mbmi)->mv[1].as_int != (mbmi)->mv[0].as_int) && \
|
||||
(mbmi)->ref_frame[1] != ref_frame) \
|
||||
ADD_MV_REF_LIST(scale_mv((mbmi), 1, ref_frame, ref_sign_bias), \
|
||||
refmv_count, mv_ref_list, bw, bh, xd, Done); \
|
||||
|
|
|
@ -255,9 +255,6 @@ typedef struct VP10Common {
|
|||
|
||||
struct loopfilter lf;
|
||||
struct segmentation seg;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
struct segmentation_probs segp;
|
||||
#endif
|
||||
|
||||
int frame_parallel_decode; // frame-based threading.
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "vp10/common/reconintra.h"
|
||||
#include "vp10/common/onyxc_int.h"
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
enum {
|
||||
NEED_LEFT = 1 << 1,
|
||||
NEED_ABOVE = 1 << 2,
|
||||
|
@ -44,28 +43,7 @@ static const uint8_t extend_modes[INTRA_MODES] = {
|
|||
NEED_ABOVE | NEED_ABOVERIGHT, // D63
|
||||
NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // TM
|
||||
};
|
||||
#else
|
||||
enum {
|
||||
NEED_LEFT = 1 << 1,
|
||||
NEED_ABOVE = 1 << 2,
|
||||
NEED_ABOVERIGHT = 1 << 3,
|
||||
};
|
||||
|
||||
static const uint8_t extend_modes[INTRA_MODES] = {
|
||||
NEED_ABOVE | NEED_LEFT, // DC
|
||||
NEED_ABOVE, // V
|
||||
NEED_LEFT, // H
|
||||
NEED_ABOVERIGHT, // D45
|
||||
NEED_LEFT | NEED_ABOVE, // D135
|
||||
NEED_LEFT | NEED_ABOVE, // D117
|
||||
NEED_LEFT | NEED_ABOVE, // D153
|
||||
NEED_LEFT, // D207
|
||||
NEED_ABOVERIGHT, // D63
|
||||
NEED_LEFT | NEED_ABOVE, // TM
|
||||
};
|
||||
#endif
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static const uint8_t orders_64x64[1] = { 0 };
|
||||
static const uint8_t orders_64x32[2] = { 0, 1 };
|
||||
static const uint8_t orders_32x64[2] = { 0, 1 };
|
||||
|
@ -190,7 +168,6 @@ static int vp10_has_bottom(BLOCK_SIZE bsize, int mi_row, int mi_col,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef void (*intra_pred_fn)(uint8_t *dst, ptrdiff_t stride,
|
||||
const uint8_t *above, const uint8_t *left);
|
||||
|
@ -218,15 +195,9 @@ static void vp10_init_intra_predictors_internal(void) {
|
|||
|
||||
INIT_ALL_SIZES(pred[V_PRED], v);
|
||||
INIT_ALL_SIZES(pred[H_PRED], h);
|
||||
#if CONFIG_MISC_FIXES
|
||||
INIT_ALL_SIZES(pred[D207_PRED], d207e);
|
||||
INIT_ALL_SIZES(pred[D45_PRED], d45e);
|
||||
INIT_ALL_SIZES(pred[D63_PRED], d63e);
|
||||
#else
|
||||
INIT_ALL_SIZES(pred[D207_PRED], d207);
|
||||
INIT_ALL_SIZES(pred[D45_PRED], d45);
|
||||
INIT_ALL_SIZES(pred[D63_PRED], d63);
|
||||
#endif
|
||||
INIT_ALL_SIZES(pred[D117_PRED], d117);
|
||||
INIT_ALL_SIZES(pred[D135_PRED], d135);
|
||||
INIT_ALL_SIZES(pred[D153_PRED], d153);
|
||||
|
@ -240,15 +211,9 @@ static void vp10_init_intra_predictors_internal(void) {
|
|||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INIT_ALL_SIZES(pred_high[V_PRED], highbd_v);
|
||||
INIT_ALL_SIZES(pred_high[H_PRED], highbd_h);
|
||||
#if CONFIG_MISC_FIXES
|
||||
INIT_ALL_SIZES(pred_high[D207_PRED], highbd_d207e);
|
||||
INIT_ALL_SIZES(pred_high[D45_PRED], highbd_d45e);
|
||||
INIT_ALL_SIZES(pred_high[D63_PRED], highbd_d63);
|
||||
#else
|
||||
INIT_ALL_SIZES(pred_high[D207_PRED], highbd_d207);
|
||||
INIT_ALL_SIZES(pred_high[D45_PRED], highbd_d45);
|
||||
INIT_ALL_SIZES(pred_high[D63_PRED], highbd_d63);
|
||||
#endif
|
||||
INIT_ALL_SIZES(pred_high[D117_PRED], highbd_d117);
|
||||
INIT_ALL_SIZES(pred_high[D135_PRED], highbd_d135);
|
||||
INIT_ALL_SIZES(pred_high[D153_PRED], highbd_d153);
|
||||
|
@ -263,19 +228,16 @@ static void vp10_init_intra_predictors_internal(void) {
|
|||
#undef intra_pred_allsizes
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static INLINE void memset16(uint16_t *dst, int val, int n) {
|
||||
while (n--)
|
||||
*dst++ = val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
#define PI 3.14159265
|
||||
#define FILTER_INTRA_PREC_BITS 10
|
||||
#define FILTER_INTRA_ROUND_VAL 511
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static const uint8_t ext_intra_extend_modes[FILTER_INTRA_MODES] = {
|
||||
NEED_LEFT | NEED_ABOVE, // FILTER_DC
|
||||
NEED_LEFT | NEED_ABOVE, // FILTER_V
|
||||
|
@ -288,20 +250,6 @@ static const uint8_t ext_intra_extend_modes[FILTER_INTRA_MODES] = {
|
|||
NEED_LEFT | NEED_ABOVE, // FILTER_D63
|
||||
NEED_LEFT | NEED_ABOVE, // FILTER_TM
|
||||
};
|
||||
#else
|
||||
static const uint8_t ext_intra_extend_modes[FILTER_INTRA_MODES] = {
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_DC
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_V
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_H
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_D45
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_D135
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_D117
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_D153
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_D207
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_D63
|
||||
NEED_LEFT | NEED_ABOVERIGHT, // FILTER_TM
|
||||
};
|
||||
#endif // CONFIG_MISC_FIXES
|
||||
|
||||
// Directional prediction, zone 1: 0 < angle < 90
|
||||
static void dr_prediction_z1(uint8_t *dst, ptrdiff_t stride, int bs,
|
||||
|
@ -881,16 +829,9 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
int dst_stride,
|
||||
PREDICTION_MODE mode,
|
||||
TX_SIZE tx_size,
|
||||
#if CONFIG_MISC_FIXES
|
||||
int n_top_px, int n_topright_px,
|
||||
int n_left_px, int n_bottomleft_px,
|
||||
#else
|
||||
int up_available,
|
||||
int left_available,
|
||||
int right_available,
|
||||
#endif
|
||||
int x, int y,
|
||||
int plane, int bd) {
|
||||
int plane) {
|
||||
int i;
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
|
||||
|
@ -901,15 +842,8 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
const int bs = 4 << tx_size;
|
||||
int need_left = extend_modes[mode] & NEED_LEFT;
|
||||
int need_above = extend_modes[mode] & NEED_ABOVE;
|
||||
int need_aboveright = extend_modes[mode] & NEED_ABOVERIGHT;
|
||||
#if CONFIG_MISC_FIXES
|
||||
const uint16_t *above_ref = ref - ref_stride;
|
||||
#else
|
||||
int frame_width, frame_height;
|
||||
int x0, y0;
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#endif
|
||||
int base = 128 << (bd - 8);
|
||||
int base = 128 << (xd->bd - 8);
|
||||
// 127 127 127 .. 127 127 127 127 127 127
|
||||
// 129 A B .. Y Z
|
||||
// 129 C D .. W X
|
||||
|
@ -927,23 +861,12 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
|
||||
p_angle = mode_to_angle_map[mode] +
|
||||
xd->mi[0]->mbmi.angle_delta[plane != 0] * ANGLE_STEP;
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (p_angle <= 90)
|
||||
need_above = 1, need_left = 0;
|
||||
else if (p_angle < 180)
|
||||
need_above = 1, need_left = 1;
|
||||
else
|
||||
need_above = 0, need_left = 1;
|
||||
#else
|
||||
if (p_angle < 90)
|
||||
need_above = 0, need_aboveright = 1, need_left = 0;
|
||||
else if (p_angle == 90)
|
||||
need_above = 1, need_aboveright = 0, need_left = 0;
|
||||
else if (p_angle < 180)
|
||||
need_above = 1, need_aboveright = 0, need_left = 1;
|
||||
else
|
||||
need_above = 0, need_aboveright = 0, need_left = 1;
|
||||
#endif // CONFIG_MISC_FIXES
|
||||
}
|
||||
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
|
||||
|
@ -951,18 +874,10 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
ext_intra_mode_info->ext_intra_mode[plane != 0];
|
||||
need_left = ext_intra_extend_modes[ext_intra_mode] & NEED_LEFT;
|
||||
need_above = ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVE;
|
||||
need_aboveright =
|
||||
ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVERIGHT;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) plane;
|
||||
(void) need_left;
|
||||
(void) need_above;
|
||||
(void) need_aboveright;
|
||||
|
||||
// NEED_LEFT
|
||||
if (need_left) {
|
||||
|
@ -1025,7 +940,6 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
}
|
||||
}
|
||||
|
||||
(void)need_aboveright;
|
||||
#if CONFIG_EXT_INTRA
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0] ||
|
||||
(extend_modes[mode] & NEED_ABOVELEFT) ||
|
||||
|
@ -1040,153 +954,27 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
(n_left_px > 0 ? above_ref[-1] : base + 1) : base - 1;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#else
|
||||
// Get current frame pointer, width and height.
|
||||
if (plane == 0) {
|
||||
frame_width = xd->cur_buf->y_width;
|
||||
frame_height = xd->cur_buf->y_height;
|
||||
} else {
|
||||
frame_width = xd->cur_buf->uv_width;
|
||||
frame_height = xd->cur_buf->uv_height;
|
||||
}
|
||||
|
||||
// Get block position in current frame.
|
||||
x0 = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)) + x;
|
||||
y0 = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)) + y;
|
||||
|
||||
// NEED_LEFT
|
||||
if (need_left) {
|
||||
if (left_available) {
|
||||
if (xd->mb_to_bottom_edge < 0) {
|
||||
/* slower path if the block needs border extension */
|
||||
if (y0 + bs <= frame_height) {
|
||||
for (i = 0; i < bs; ++i)
|
||||
left_col[i] = ref[i * ref_stride - 1];
|
||||
} else {
|
||||
const int extend_bottom = frame_height - y0;
|
||||
for (i = 0; i < extend_bottom; ++i)
|
||||
left_col[i] = ref[i * ref_stride - 1];
|
||||
for (; i < bs; ++i)
|
||||
left_col[i] = ref[(extend_bottom - 1) * ref_stride - 1];
|
||||
}
|
||||
} else {
|
||||
/* faster path if the block does not need extension */
|
||||
for (i = 0; i < bs; ++i)
|
||||
left_col[i] = ref[i * ref_stride - 1];
|
||||
}
|
||||
} else {
|
||||
// TODO(Peter): this value should probably change for high bitdepth
|
||||
vpx_memset16(left_col, base + 1, bs);
|
||||
}
|
||||
}
|
||||
|
||||
// NEED_ABOVE
|
||||
if (need_above) {
|
||||
if (up_available) {
|
||||
const uint16_t *above_ref = ref - ref_stride;
|
||||
if (xd->mb_to_right_edge < 0) {
|
||||
/* slower path if the block needs border extension */
|
||||
if (x0 + bs <= frame_width) {
|
||||
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
|
||||
} else if (x0 <= frame_width) {
|
||||
const int r = frame_width - x0;
|
||||
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
|
||||
vpx_memset16(above_row + r, above_row[r - 1], x0 + bs - frame_width);
|
||||
}
|
||||
} else {
|
||||
/* faster path if the block does not need extension */
|
||||
if (bs == 4 && right_available && left_available) {
|
||||
const_above_row = above_ref;
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
|
||||
}
|
||||
}
|
||||
above_row[-1] = left_available ? above_ref[-1] : (base + 1);
|
||||
} else {
|
||||
vpx_memset16(above_row, base - 1, bs);
|
||||
above_row[-1] = base - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// NEED_ABOVERIGHT
|
||||
if (need_aboveright) {
|
||||
if (up_available) {
|
||||
const uint16_t *above_ref = ref - ref_stride;
|
||||
if (xd->mb_to_right_edge < 0) {
|
||||
/* slower path if the block needs border extension */
|
||||
if (x0 + 2 * bs <= frame_width) {
|
||||
if (right_available && bs == 4) {
|
||||
memcpy(above_row, above_ref, 2 * bs * sizeof(above_row[0]));
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
|
||||
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
|
||||
}
|
||||
} else if (x0 + bs <= frame_width) {
|
||||
const int r = frame_width - x0;
|
||||
if (right_available && bs == 4) {
|
||||
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
|
||||
vpx_memset16(above_row + r, above_row[r - 1],
|
||||
x0 + 2 * bs - frame_width);
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
|
||||
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
|
||||
}
|
||||
} else if (x0 <= frame_width) {
|
||||
const int r = frame_width - x0;
|
||||
memcpy(above_row, above_ref, r * sizeof(above_row[0]));
|
||||
vpx_memset16(above_row + r, above_row[r - 1],
|
||||
x0 + 2 * bs - frame_width);
|
||||
}
|
||||
// TODO(Peter) this value should probably change for high bitdepth
|
||||
above_row[-1] = left_available ? above_ref[-1] : (base + 1);
|
||||
} else {
|
||||
/* faster path if the block does not need extension */
|
||||
if (bs == 4 && right_available && left_available) {
|
||||
const_above_row = above_ref;
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs * sizeof(above_row[0]));
|
||||
if (bs == 4 && right_available)
|
||||
memcpy(above_row + bs, above_ref + bs, bs * sizeof(above_row[0]));
|
||||
else
|
||||
vpx_memset16(above_row + bs, above_row[bs - 1], bs);
|
||||
// TODO(Peter): this value should probably change for high bitdepth
|
||||
above_row[-1] = left_available ? above_ref[-1] : (base + 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vpx_memset16(above_row, base - 1, bs * 2);
|
||||
// TODO(Peter): this value should probably change for high bitdepth
|
||||
above_row[-1] = base - 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
|
||||
highbd_filter_intra_predictors[ext_intra_mode](dst, dst_stride, bs,
|
||||
const_above_row, left_col, bd);
|
||||
const_above_row, left_col, xd->bd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode != DC_PRED && mode != TM_PRED &&
|
||||
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
|
||||
highbd_dr_predictor(dst, dst_stride, bs, const_above_row, left_col,
|
||||
p_angle, bd);
|
||||
p_angle, xd->bd);
|
||||
return;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
// predict
|
||||
if (mode == DC_PRED) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
dc_pred_high[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride,
|
||||
const_above_row,
|
||||
left_col, xd->bd);
|
||||
#else
|
||||
dc_pred_high[left_available][up_available][tx_size](dst, dst_stride,
|
||||
const_above_row,
|
||||
left_col, xd->bd);
|
||||
#endif
|
||||
} else {
|
||||
pred_high[mode][tx_size](dst, dst_stride, const_above_row, left_col,
|
||||
xd->bd);
|
||||
|
@ -1197,31 +985,18 @@ static void build_intra_predictors_high(const MACROBLOCKD *xd,
|
|||
static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
||||
int ref_stride, uint8_t *dst, int dst_stride,
|
||||
PREDICTION_MODE mode, TX_SIZE tx_size,
|
||||
#if CONFIG_MISC_FIXES
|
||||
int n_top_px, int n_topright_px,
|
||||
int n_left_px, int n_bottomleft_px,
|
||||
#else
|
||||
int up_available, int left_available,
|
||||
int right_available,
|
||||
#endif
|
||||
int x, int y, int plane) {
|
||||
int plane) {
|
||||
int i;
|
||||
#if CONFIG_MISC_FIXES
|
||||
DECLARE_ALIGNED(16, uint8_t, left_col[64]);
|
||||
const uint8_t *above_ref = ref - ref_stride;
|
||||
#else
|
||||
DECLARE_ALIGNED(16, uint8_t, left_col[32]);
|
||||
int frame_width, frame_height;
|
||||
int x0, y0;
|
||||
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||
#endif
|
||||
DECLARE_ALIGNED(16, uint8_t, above_data[64 + 16]);
|
||||
uint8_t *above_row = above_data + 16;
|
||||
const uint8_t *const_above_row = above_row;
|
||||
const int bs = 4 << tx_size;
|
||||
int need_left = extend_modes[mode] & NEED_LEFT;
|
||||
int need_above = extend_modes[mode] & NEED_ABOVE;
|
||||
int need_aboveright = extend_modes[mode] & NEED_ABOVERIGHT;
|
||||
#if CONFIG_EXT_INTRA
|
||||
const EXT_INTRA_MODE_INFO *ext_intra_mode_info =
|
||||
&xd->mi[0]->mbmi.ext_intra_mode_info;
|
||||
|
@ -1233,24 +1008,12 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
xd->mi[0]->mbmi.sb_type >= BLOCK_8X8) {
|
||||
p_angle = mode_to_angle_map[mode] +
|
||||
xd->mi[0]->mbmi.angle_delta[plane != 0] * ANGLE_STEP;
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (p_angle <= 90)
|
||||
need_above = 1, need_left = 0;
|
||||
else if (p_angle < 180)
|
||||
need_above = 1, need_left = 1;
|
||||
else
|
||||
need_above = 0, need_left = 1;
|
||||
#else
|
||||
if (p_angle < 90)
|
||||
need_above = 0, need_aboveright = 1, need_left = 0;
|
||||
else if (p_angle == 90)
|
||||
need_above = 1, need_aboveright = 0, need_left = 0;
|
||||
else if (p_angle < 180)
|
||||
need_above = 1, need_aboveright = 0, need_left = 1;
|
||||
else
|
||||
need_above = 0, need_aboveright = 0, need_left = 1;
|
||||
#endif // CONFIG_MISC_FIXES
|
||||
}
|
||||
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
|
||||
|
@ -1258,8 +1021,6 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
ext_intra_mode_info->ext_intra_mode[plane != 0];
|
||||
need_left = ext_intra_extend_modes[ext_intra_mode] & NEED_LEFT;
|
||||
need_above = ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVE;
|
||||
need_aboveright =
|
||||
ext_intra_extend_modes[ext_intra_mode] & NEED_ABOVERIGHT;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
|
||||
|
@ -1270,33 +1031,15 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
// 129 G H .. S T T T T T
|
||||
// ..
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
(void) xd;
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) plane;
|
||||
assert(n_top_px >= 0);
|
||||
assert(n_topright_px >= 0);
|
||||
assert(n_left_px >= 0);
|
||||
assert(n_bottomleft_px >= 0);
|
||||
#else
|
||||
// Get current frame pointer, width and height.
|
||||
if (plane == 0) {
|
||||
frame_width = xd->cur_buf->y_width;
|
||||
frame_height = xd->cur_buf->y_height;
|
||||
} else {
|
||||
frame_width = xd->cur_buf->uv_width;
|
||||
frame_height = xd->cur_buf->uv_height;
|
||||
}
|
||||
|
||||
// Get block position in current frame.
|
||||
x0 = (-xd->mb_to_left_edge >> (3 + pd->subsampling_x)) + x;
|
||||
y0 = (-xd->mb_to_top_edge >> (3 + pd->subsampling_y)) + y;
|
||||
#endif
|
||||
|
||||
// NEED_LEFT
|
||||
if (need_left) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
#if CONFIG_EXT_INTRA
|
||||
int need_bottom;
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
|
||||
|
@ -1324,34 +1067,10 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
} else {
|
||||
memset(left_col, 129, bs << need_bottom);
|
||||
}
|
||||
#else
|
||||
if (left_available) {
|
||||
if (xd->mb_to_bottom_edge < 0) {
|
||||
/* slower path if the block needs border extension */
|
||||
if (y0 + bs <= frame_height) {
|
||||
for (i = 0; i < bs; ++i)
|
||||
left_col[i] = ref[i * ref_stride - 1];
|
||||
} else {
|
||||
const int extend_bottom = frame_height - y0;
|
||||
for (i = 0; i < extend_bottom; ++i)
|
||||
left_col[i] = ref[i * ref_stride - 1];
|
||||
for (; i < bs; ++i)
|
||||
left_col[i] = ref[(extend_bottom - 1) * ref_stride - 1];
|
||||
}
|
||||
} else {
|
||||
/* faster path if the block does not need extension */
|
||||
for (i = 0; i < bs; ++i)
|
||||
left_col[i] = ref[i * ref_stride - 1];
|
||||
}
|
||||
} else {
|
||||
memset(left_col, 129, bs);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// NEED_ABOVE
|
||||
if (need_above) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
#if CONFIG_EXT_INTRA
|
||||
int need_right;
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
|
||||
|
@ -1378,36 +1097,8 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
} else {
|
||||
memset(above_row, 127, bs << need_right);
|
||||
}
|
||||
#else
|
||||
if (up_available) {
|
||||
const uint8_t *above_ref = ref - ref_stride;
|
||||
if (xd->mb_to_right_edge < 0) {
|
||||
/* slower path if the block needs border extension */
|
||||
if (x0 + bs <= frame_width) {
|
||||
memcpy(above_row, above_ref, bs);
|
||||
} else if (x0 <= frame_width) {
|
||||
const int r = frame_width - x0;
|
||||
memcpy(above_row, above_ref, r);
|
||||
memset(above_row + r, above_row[r - 1], x0 + bs - frame_width);
|
||||
}
|
||||
} else {
|
||||
/* faster path if the block does not need extension */
|
||||
if (bs == 4 && right_available && left_available) {
|
||||
const_above_row = above_ref;
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs);
|
||||
}
|
||||
}
|
||||
above_row[-1] = left_available ? above_ref[-1] : 129;
|
||||
} else {
|
||||
memset(above_row, 127, bs);
|
||||
above_row[-1] = 127;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
(void)need_aboveright;
|
||||
#if CONFIG_EXT_INTRA
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0] ||
|
||||
(extend_modes[mode] & NEED_ABOVELEFT) ||
|
||||
|
@ -1420,53 +1111,6 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
above_row[-1] = n_top_px > 0 ? (n_left_px > 0 ? above_ref[-1] : 129) : 127;
|
||||
}
|
||||
#endif // CONFIG_EXT_INTRA
|
||||
#else
|
||||
// NEED_ABOVERIGHT
|
||||
if (need_aboveright) {
|
||||
if (up_available) {
|
||||
const uint8_t *above_ref = ref - ref_stride;
|
||||
if (xd->mb_to_right_edge < 0) {
|
||||
/* slower path if the block needs border extension */
|
||||
if (x0 + 2 * bs <= frame_width) {
|
||||
if (right_available && bs == 4) {
|
||||
memcpy(above_row, above_ref, 2 * bs);
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs);
|
||||
memset(above_row + bs, above_row[bs - 1], bs);
|
||||
}
|
||||
} else if (x0 + bs <= frame_width) {
|
||||
const int r = frame_width - x0;
|
||||
if (right_available && bs == 4) {
|
||||
memcpy(above_row, above_ref, r);
|
||||
memset(above_row + r, above_row[r - 1], x0 + 2 * bs - frame_width);
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs);
|
||||
memset(above_row + bs, above_row[bs - 1], bs);
|
||||
}
|
||||
} else if (x0 <= frame_width) {
|
||||
const int r = frame_width - x0;
|
||||
memcpy(above_row, above_ref, r);
|
||||
memset(above_row + r, above_row[r - 1], x0 + 2 * bs - frame_width);
|
||||
}
|
||||
} else {
|
||||
/* faster path if the block does not need extension */
|
||||
if (bs == 4 && right_available && left_available) {
|
||||
const_above_row = above_ref;
|
||||
} else {
|
||||
memcpy(above_row, above_ref, bs);
|
||||
if (bs == 4 && right_available)
|
||||
memcpy(above_row + bs, above_ref + bs, bs);
|
||||
else
|
||||
memset(above_row + bs, above_row[bs - 1], bs);
|
||||
}
|
||||
}
|
||||
above_row[-1] = left_available ? above_ref[-1] : 129;
|
||||
} else {
|
||||
memset(above_row, 127, bs * 2);
|
||||
above_row[-1] = 127;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
if (ext_intra_mode_info->use_ext_intra_mode[plane != 0]) {
|
||||
|
@ -1484,13 +1128,8 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
|
|||
|
||||
// predict
|
||||
if (mode == DC_PRED) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
dc_pred[n_left_px > 0][n_top_px > 0][tx_size](dst, dst_stride,
|
||||
const_above_row, left_col);
|
||||
#else
|
||||
dc_pred[left_available][up_available][tx_size](dst, dst_stride,
|
||||
const_above_row, left_col);
|
||||
#endif
|
||||
} else {
|
||||
pred[mode][tx_size](dst, dst_stride, const_above_row, left_col);
|
||||
}
|
||||
|
@ -1506,7 +1145,6 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
|||
const int have_left = aoff || xd->left_available;
|
||||
const int x = aoff * 4;
|
||||
const int y = loff * 4;
|
||||
#if CONFIG_MISC_FIXES
|
||||
const int bw = VPXMAX(2, 1 << bwl_in);
|
||||
const int bh = VPXMAX(2, 1 << bhl_in);
|
||||
const int mi_row = -xd->mb_to_top_edge >> 6;
|
||||
|
@ -1530,10 +1168,6 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
|||
int xr = (xd->mb_to_right_edge >> (3 + pd->subsampling_x)) + (wpx - x - txpx);
|
||||
int yd =
|
||||
(xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) + (hpx - y - txpx);
|
||||
#else
|
||||
const int bw = (1 << bwl_in);
|
||||
const int have_right = (aoff + txw) < bw;
|
||||
#endif // CONFIG_MISC_FIXES
|
||||
|
||||
if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) {
|
||||
const int bs = 4 * (1 << tx_size);
|
||||
|
@ -1569,7 +1203,6 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
|||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
build_intra_predictors_high(xd, ref, ref_stride, dst, dst_stride, mode,
|
||||
|
@ -1578,7 +1211,7 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
|||
have_top && have_right ? VPXMIN(txpx, xr) : 0,
|
||||
have_left ? VPXMIN(txpx, yd + txpx) : 0,
|
||||
have_bottom && have_left ? VPXMIN(txpx, yd) : 0,
|
||||
x, y, plane, xd->bd);
|
||||
plane);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1588,20 +1221,7 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
|
|||
have_top && have_right ? VPXMIN(txpx, xr) : 0,
|
||||
have_left ? VPXMIN(txpx, yd + txpx) : 0,
|
||||
have_bottom && have_left ? VPXMIN(txpx, yd) : 0,
|
||||
x, y, plane);
|
||||
#else // CONFIG_MISC_FIXES
|
||||
(void) bhl_in;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
|
||||
build_intra_predictors_high(xd, ref, ref_stride, dst, dst_stride, mode,
|
||||
tx_size, have_top, have_left, have_right,
|
||||
x, y, plane, xd->bd);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size,
|
||||
have_top, have_left, have_right, x, y, plane);
|
||||
#endif // CONFIG_MISC_FIXES
|
||||
plane);
|
||||
}
|
||||
|
||||
void vp10_init_intra_predictors(void) {
|
||||
|
|
|
@ -462,7 +462,6 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
|
|||
}
|
||||
#endif // CONFIG_EXT_TX
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
for (i = 0; i < PREDICTION_PROBS; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
cm->counts.seg.pred[i][j] += counts->seg.pred[i][j];
|
||||
|
@ -471,7 +470,6 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
|
|||
cm->counts.seg.tree_total[i] += counts->seg.tree_total[i];
|
||||
cm->counts.seg.tree_mispred[i] += counts->seg.tree_mispred[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXT_INTRA
|
||||
for (i = 0; i < PLANE_TYPES; ++i)
|
||||
|
|
|
@ -78,36 +78,14 @@ static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
|
|||
return len != 0 && len <= (size_t)(end - start);
|
||||
}
|
||||
|
||||
|
||||
static int read_inv_signed_literal(struct vpx_read_bit_buffer *rb,
|
||||
int bits) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
const int nbits = sizeof(unsigned) * 8 - bits - 1;
|
||||
const unsigned value = vpx_rb_read_literal(rb, bits + 1) << nbits;
|
||||
return ((int) value) >> nbits;
|
||||
#else
|
||||
return vpx_rb_read_signed_literal(rb, bits);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int decode_unsigned_max(struct vpx_read_bit_buffer *rb, int max) {
|
||||
const int data = vpx_rb_read_literal(rb, get_unsigned_bits(max));
|
||||
return data > max ? max : data;
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static TX_MODE read_tx_mode(struct vpx_read_bit_buffer *rb) {
|
||||
return vpx_rb_read_bit(rb) ? TX_MODE_SELECT : vpx_rb_read_literal(rb, 2);
|
||||
}
|
||||
#else
|
||||
static TX_MODE read_tx_mode(vpx_reader *r) {
|
||||
TX_MODE tx_mode = vpx_read_literal(r, 2);
|
||||
if (tx_mode == ALLOW_32X32)
|
||||
tx_mode += vpx_read_bit(r);
|
||||
return tx_mode;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void read_tx_mode_probs(struct tx_probs *tx_probs, vpx_reader *r) {
|
||||
int i, j;
|
||||
|
@ -139,7 +117,6 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
|
|||
vp10_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
|
||||
struct vpx_read_bit_buffer *rb) {
|
||||
if (is_compound_reference_allowed(cm)) {
|
||||
|
@ -150,18 +127,6 @@ static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
|
|||
return SINGLE_REFERENCE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
static REFERENCE_MODE read_frame_reference_mode(const VP10_COMMON *cm,
|
||||
vpx_reader *r) {
|
||||
if (is_compound_reference_allowed(cm)) {
|
||||
return vpx_read_bit(r) ? (vpx_read_bit(r) ? REFERENCE_MODE_SELECT
|
||||
: COMPOUND_REFERENCE)
|
||||
: SINGLE_REFERENCE;
|
||||
} else {
|
||||
return SINGLE_REFERENCE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void read_frame_reference_mode_probs(VP10_COMMON *cm, vpx_reader *r) {
|
||||
FRAME_CONTEXT *const fc = cm->fc;
|
||||
|
@ -185,12 +150,7 @@ static void read_frame_reference_mode_probs(VP10_COMMON *cm, vpx_reader *r) {
|
|||
static void update_mv_probs(vpx_prob *p, int n, vpx_reader *r) {
|
||||
int i;
|
||||
for (i = 0; i < n; ++i)
|
||||
#if CONFIG_MISC_FIXES
|
||||
vp10_diff_update_prob(r, &p[i]);
|
||||
#else
|
||||
if (vpx_read(r, MV_UPDATE_PROB))
|
||||
p[i] = (vpx_read_literal(r, 7) << 1) | 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void read_mv_probs(nmv_context *ctx, int allow_hp, vpx_reader *r) {
|
||||
|
@ -997,11 +957,7 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
|
|||
}
|
||||
|
||||
if (!less8x8 && eobtotal == 0)
|
||||
#if CONFIG_MISC_FIXES
|
||||
mbmi->has_no_coeffs = 1; // skip loopfilter
|
||||
#else
|
||||
mbmi->skip = 1; // skip loopfilter
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1159,9 +1115,6 @@ static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode,
|
|||
static void setup_segmentation(VP10_COMMON *const cm,
|
||||
struct vpx_read_bit_buffer *rb) {
|
||||
struct segmentation *const seg = &cm->seg;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
struct segmentation_probs *const segp = &cm->segp;
|
||||
#endif
|
||||
int i, j;
|
||||
|
||||
seg->update_map = 0;
|
||||
|
@ -1178,26 +1131,11 @@ static void setup_segmentation(VP10_COMMON *const cm,
|
|||
seg->update_map = vpx_rb_read_bit(rb);
|
||||
}
|
||||
if (seg->update_map) {
|
||||
#if !CONFIG_MISC_FIXES
|
||||
for (i = 0; i < SEG_TREE_PROBS; i++)
|
||||
segp->tree_probs[i] = vpx_rb_read_bit(rb) ? vpx_rb_read_literal(rb, 8)
|
||||
: MAX_PROB;
|
||||
#endif
|
||||
if (frame_is_intra_only(cm) || cm->error_resilient_mode) {
|
||||
seg->temporal_update = 0;
|
||||
} else {
|
||||
seg->temporal_update = vpx_rb_read_bit(rb);
|
||||
}
|
||||
#if !CONFIG_MISC_FIXES
|
||||
if (seg->temporal_update) {
|
||||
for (i = 0; i < PREDICTION_PROBS; i++)
|
||||
segp->pred_probs[i] = vpx_rb_read_bit(rb) ? vpx_rb_read_literal(rb, 8)
|
||||
: MAX_PROB;
|
||||
} else {
|
||||
for (i = 0; i < PREDICTION_PROBS; i++)
|
||||
segp->pred_probs[i] = MAX_PROB;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Segmentation data update
|
||||
|
@ -1251,7 +1189,7 @@ static void setup_loopfilter(struct loopfilter *lf,
|
|||
|
||||
static INLINE int read_delta_q(struct vpx_read_bit_buffer *rb) {
|
||||
return vpx_rb_read_bit(rb) ?
|
||||
vpx_rb_read_inv_signed_literal(rb, CONFIG_MISC_FIXES ? 6 : 4) : 0;
|
||||
vpx_rb_read_inv_signed_literal(rb, 6) : 0;
|
||||
}
|
||||
|
||||
static void setup_quantization(VP10_COMMON *const cm, MACROBLOCKD *const xd,
|
||||
|
@ -1264,15 +1202,9 @@ static void setup_quantization(VP10_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
cm->uv_ac_delta_q = read_delta_q(rb);
|
||||
cm->dequant_bit_depth = cm->bit_depth;
|
||||
for (i = 0; i < (cm->seg.enabled ? MAX_SEGMENTS : 1); ++i) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
const int qindex = vp10_get_qindex(&cm->seg, i, cm->base_qindex);
|
||||
#endif
|
||||
xd->lossless[i] = cm->y_dc_delta_q == 0 &&
|
||||
#if CONFIG_MISC_FIXES
|
||||
qindex == 0 &&
|
||||
#else
|
||||
cm->base_qindex == 0 &&
|
||||
#endif
|
||||
cm->uv_dc_delta_q == 0 &&
|
||||
cm->uv_ac_delta_q == 0;
|
||||
}
|
||||
|
@ -1414,10 +1346,8 @@ static void setup_frame_size_with_refs(VP10_COMMON *cm,
|
|||
YV12_BUFFER_CONFIG *const buf = cm->frame_refs[i].buf;
|
||||
width = buf->y_crop_width;
|
||||
height = buf->y_crop_height;
|
||||
#if CONFIG_MISC_FIXES
|
||||
cm->render_width = buf->render_width;
|
||||
cm->render_height = buf->render_height;
|
||||
#endif
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -1425,9 +1355,7 @@ static void setup_frame_size_with_refs(VP10_COMMON *cm,
|
|||
|
||||
if (!found) {
|
||||
vp10_read_frame_size(rb, &width, &height);
|
||||
#if CONFIG_MISC_FIXES
|
||||
setup_render_size(cm, rb);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (width <= 0 || height <= 0)
|
||||
|
@ -1459,9 +1387,6 @@ static void setup_frame_size_with_refs(VP10_COMMON *cm,
|
|||
}
|
||||
|
||||
resize_context_buffers(cm, width, height);
|
||||
#if !CONFIG_MISC_FIXES
|
||||
setup_render_size(cm, rb);
|
||||
#endif
|
||||
|
||||
lock_buffer_pool(pool);
|
||||
if (vpx_realloc_frame_buffer(
|
||||
|
@ -1508,14 +1433,10 @@ static void setup_tile_info(VP10_COMMON *cm, struct vpx_read_bit_buffer *rb) {
|
|||
if (cm->log2_tile_rows)
|
||||
cm->log2_tile_rows += vpx_rb_read_bit(rb);
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
// tile size magnitude
|
||||
if (cm->log2_tile_rows > 0 || cm->log2_tile_cols > 0) {
|
||||
cm->tile_sz_mag = vpx_rb_read_literal(rb, 2);
|
||||
}
|
||||
#else
|
||||
cm->tile_sz_mag = 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef struct TileBuffer {
|
||||
|
@ -1559,9 +1480,9 @@ static void get_tile_buffer(const uint8_t *const data_end,
|
|||
if (decrypt_cb) {
|
||||
uint8_t be_data[4];
|
||||
decrypt_cb(decrypt_state, *data, be_data, tile_sz_mag + 1);
|
||||
size = mem_get_varsize(be_data, tile_sz_mag) + CONFIG_MISC_FIXES;
|
||||
size = mem_get_varsize(be_data, tile_sz_mag) + 1;
|
||||
} else {
|
||||
size = mem_get_varsize(*data, tile_sz_mag) + CONFIG_MISC_FIXES;
|
||||
size = mem_get_varsize(*data, tile_sz_mag) + 1;
|
||||
}
|
||||
*data += tile_sz_mag + 1;
|
||||
|
||||
|
@ -2011,9 +1932,7 @@ static void read_bitdepth_colorspace_sampling(
|
|||
static size_t read_uncompressed_header(VP10Decoder *pbi,
|
||||
struct vpx_read_bit_buffer *rb) {
|
||||
VP10_COMMON *const cm = &pbi->common;
|
||||
#if CONFIG_MISC_FIXES
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
#endif
|
||||
BufferPool *const pool = cm->buffer_pool;
|
||||
RefCntBuffer *const frame_bufs = pool->frame_bufs;
|
||||
int i, mask, ref_index = 0;
|
||||
|
@ -2092,7 +2011,6 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
|
|||
if (cm->error_resilient_mode) {
|
||||
cm->reset_frame_context = RESET_FRAME_CONTEXT_ALL;
|
||||
} else {
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (cm->intra_only) {
|
||||
cm->reset_frame_context =
|
||||
vpx_rb_read_bit(rb) ? RESET_FRAME_CONTEXT_ALL
|
||||
|
@ -2106,40 +2024,14 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
|
|||
vpx_rb_read_bit(rb) ? RESET_FRAME_CONTEXT_ALL
|
||||
: RESET_FRAME_CONTEXT_CURRENT;
|
||||
}
|
||||
#else
|
||||
static const RESET_FRAME_CONTEXT_MODE reset_frame_context_conv_tbl[4] = {
|
||||
RESET_FRAME_CONTEXT_NONE, RESET_FRAME_CONTEXT_NONE,
|
||||
RESET_FRAME_CONTEXT_CURRENT, RESET_FRAME_CONTEXT_ALL
|
||||
};
|
||||
|
||||
cm->reset_frame_context =
|
||||
reset_frame_context_conv_tbl[vpx_rb_read_literal(rb, 2)];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cm->intra_only) {
|
||||
if (!vp10_read_sync_code(rb))
|
||||
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
|
||||
"Invalid frame sync code");
|
||||
#if CONFIG_MISC_FIXES
|
||||
|
||||
read_bitdepth_colorspace_sampling(cm, rb);
|
||||
#else
|
||||
if (cm->profile > PROFILE_0) {
|
||||
read_bitdepth_colorspace_sampling(cm, rb);
|
||||
} else {
|
||||
// NOTE: The intra-only frame header does not include the specification
|
||||
// of either the color format or color sub-sampling in profile 0. VP9
|
||||
// specifies that the default color format should be YUV 4:2:0 in this
|
||||
// case (normative).
|
||||
cm->color_space = VPX_CS_BT_601;
|
||||
cm->color_range = 0;
|
||||
cm->subsampling_y = cm->subsampling_x = 1;
|
||||
cm->bit_depth = VPX_BITS_8;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
cm->use_highbitdepth = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
pbi->refresh_frame_flags = vpx_rb_read_literal(rb, REF_FRAMES);
|
||||
setup_frame_size(cm, rb);
|
||||
|
@ -2202,10 +2094,6 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
|
|||
cm->refresh_frame_context =
|
||||
vpx_rb_read_bit(rb) ? REFRESH_FRAME_CONTEXT_FORWARD
|
||||
: REFRESH_FRAME_CONTEXT_BACKWARD;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
} else {
|
||||
vpx_rb_read_bit(rb); // parallel decoding mode flag
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_OFF;
|
||||
|
@ -2246,11 +2134,9 @@ static size_t read_uncompressed_header(VP10Decoder *pbi,
|
|||
setup_quantization(cm, &pbi->mb, rb);
|
||||
setup_segmentation(cm, rb);
|
||||
setup_segmentation_dequant(cm);
|
||||
#if CONFIG_MISC_FIXES
|
||||
cm->tx_mode = (!cm->seg.enabled && xd->lossless[0]) ? ONLY_4X4
|
||||
: read_tx_mode(rb);
|
||||
cm->reference_mode = read_frame_reference_mode(cm, rb);
|
||||
#endif
|
||||
|
||||
setup_tile_info(cm, rb);
|
||||
sz = vpx_rb_read_literal(rb, 16);
|
||||
|
@ -2292,9 +2178,6 @@ static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
|
|||
static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
||||
size_t partition_size) {
|
||||
VP10_COMMON *const cm = &pbi->common;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
MACROBLOCKD *const xd = &pbi->mb;
|
||||
#endif
|
||||
FRAME_CONTEXT *const fc = cm->fc;
|
||||
vpx_reader r;
|
||||
int k, i, j;
|
||||
|
@ -2304,9 +2187,6 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
|||
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
|
||||
"Failed to allocate bool decoder 0");
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
cm->tx_mode = xd->lossless[0] ? ONLY_4X4 : read_tx_mode(&r);
|
||||
#endif
|
||||
if (cm->tx_mode == TX_MODE_SELECT)
|
||||
read_tx_mode_probs(&fc->tx_probs, &r);
|
||||
read_coef_probs(fc, cm->tx_mode, &r);
|
||||
|
@ -2319,7 +2199,6 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
|||
for (k = 0; k < SKIP_CONTEXTS; ++k)
|
||||
vp10_diff_update_prob(&r, &fc->skip_probs[k]);
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (cm->seg.enabled) {
|
||||
if (cm->seg.temporal_update) {
|
||||
for (k = 0; k < PREDICTION_PROBS; k++)
|
||||
|
@ -2336,16 +2215,13 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
|||
for (j = 0; j < PARTITION_CONTEXTS; ++j)
|
||||
for (i = 0; i < PARTITION_TYPES - 1; ++i)
|
||||
vp10_diff_update_prob(&r, &fc->partition_prob[j][i]);
|
||||
#endif
|
||||
|
||||
if (frame_is_intra_only(cm)) {
|
||||
vp10_copy(cm->kf_y_prob, vp10_kf_y_mode_prob);
|
||||
#if CONFIG_MISC_FIXES
|
||||
for (k = 0; k < INTRA_MODES; k++)
|
||||
for (j = 0; j < INTRA_MODES; j++)
|
||||
for (i = 0; i < INTRA_MODES - 1; ++i)
|
||||
vp10_diff_update_prob(&r, &cm->kf_y_prob[k][j][i]);
|
||||
#endif
|
||||
} else {
|
||||
nmv_context *const nmvc = &fc->nmvc;
|
||||
|
||||
|
@ -2357,9 +2233,6 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
|||
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
|
||||
vp10_diff_update_prob(&r, &fc->intra_inter_prob[i]);
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
cm->reference_mode = read_frame_reference_mode(cm, &r);
|
||||
#endif
|
||||
if (cm->reference_mode != SINGLE_REFERENCE)
|
||||
setup_compound_reference_mode(cm);
|
||||
read_frame_reference_mode_probs(cm, &r);
|
||||
|
@ -2368,12 +2241,6 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
|
|||
for (i = 0; i < INTRA_MODES - 1; ++i)
|
||||
vp10_diff_update_prob(&r, &fc->y_mode_prob[j][i]);
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
for (j = 0; j < PARTITION_CONTEXTS; ++j)
|
||||
for (i = 0; i < PARTITION_TYPES - 1; ++i)
|
||||
vp10_diff_update_prob(&r, &fc->partition_prob[j][i]);
|
||||
#endif
|
||||
|
||||
read_mv_probs(nmvc, cm->allow_high_precision_mv, &r);
|
||||
#if CONFIG_EXT_TX
|
||||
read_ext_tx_probs(fc, &r);
|
||||
|
@ -2565,14 +2432,9 @@ void vp10_decode_frame(VP10Decoder *pbi,
|
|||
if (!xd->corrupted) {
|
||||
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
|
||||
vp10_adapt_coef_probs(cm);
|
||||
#if CONFIG_MISC_FIXES
|
||||
vp10_adapt_intra_frame_probs(cm);
|
||||
#endif
|
||||
|
||||
if (!frame_is_intra_only(cm)) {
|
||||
#if !CONFIG_MISC_FIXES
|
||||
vp10_adapt_intra_frame_probs(cm);
|
||||
#endif
|
||||
vp10_adapt_inter_frame_probs(cm);
|
||||
vp10_adapt_mv_probs(cm, cm->allow_high_precision_mv);
|
||||
}
|
||||
|
|
|
@ -196,28 +196,18 @@ static int read_intra_segment_id(VP10_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
int mi_offset, int x_mis, int y_mis,
|
||||
vpx_reader *r) {
|
||||
struct segmentation *const seg = &cm->seg;
|
||||
#if CONFIG_MISC_FIXES
|
||||
FRAME_COUNTS *counts = xd->counts;
|
||||
struct segmentation_probs *const segp = &cm->fc->seg;
|
||||
#else
|
||||
struct segmentation_probs *const segp = &cm->segp;
|
||||
#endif
|
||||
int segment_id;
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
(void) xd;
|
||||
#endif
|
||||
|
||||
if (!seg->enabled)
|
||||
return 0; // Default for disabled segmentation
|
||||
|
||||
assert(seg->update_map && !seg->temporal_update);
|
||||
|
||||
segment_id = read_segment_id(r, segp);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (counts)
|
||||
++counts->seg.tree_total[segment_id];
|
||||
#endif
|
||||
set_segment_id(cm, mi_offset, x_mis, y_mis, segment_id);
|
||||
return segment_id;
|
||||
}
|
||||
|
@ -237,12 +227,8 @@ static void copy_segment_id(const VP10_COMMON *cm,
|
|||
static int read_inter_segment_id(VP10_COMMON *const cm, MACROBLOCKD *const xd,
|
||||
int mi_row, int mi_col, vpx_reader *r) {
|
||||
struct segmentation *const seg = &cm->seg;
|
||||
#if CONFIG_MISC_FIXES
|
||||
FRAME_COUNTS *counts = xd->counts;
|
||||
struct segmentation_probs *const segp = &cm->fc->seg;
|
||||
#else
|
||||
struct segmentation_probs *const segp = &cm->segp;
|
||||
#endif
|
||||
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
|
||||
int predicted_segment_id, segment_id;
|
||||
const int mi_offset = mi_row * cm->mi_cols + mi_col;
|
||||
|
@ -270,25 +256,19 @@ static int read_inter_segment_id(VP10_COMMON *const cm, MACROBLOCKD *const xd,
|
|||
const int ctx = vp10_get_pred_context_seg_id(xd);
|
||||
const vpx_prob pred_prob = segp->pred_probs[ctx];
|
||||
mbmi->seg_id_predicted = vpx_read(r, pred_prob);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (counts)
|
||||
++counts->seg.pred[ctx][mbmi->seg_id_predicted];
|
||||
#endif
|
||||
if (mbmi->seg_id_predicted) {
|
||||
segment_id = predicted_segment_id;
|
||||
} else {
|
||||
segment_id = read_segment_id(r, segp);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (counts)
|
||||
++counts->seg.tree_mispred[segment_id];
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
segment_id = read_segment_id(r, segp);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (counts)
|
||||
++counts->seg.tree_total[segment_id];
|
||||
#endif
|
||||
}
|
||||
set_segment_id(cm, mi_offset, x_mis, y_mis, segment_id);
|
||||
return segment_id;
|
||||
|
|
|
@ -459,9 +459,7 @@ vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
|
|||
// an invalid bitstream and need to return an error.
|
||||
|
||||
uint8_t marker;
|
||||
#if CONFIG_MISC_FIXES
|
||||
size_t frame_sz_sum = 0;
|
||||
#endif
|
||||
|
||||
assert(data_sz);
|
||||
marker = read_marker(decrypt_cb, decrypt_state, data + data_sz - 1);
|
||||
|
@ -470,7 +468,7 @@ vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
|
|||
if ((marker & 0xe0) == 0xc0) {
|
||||
const uint32_t frames = (marker & 0x7) + 1;
|
||||
const uint32_t mag = ((marker >> 3) & 0x3) + 1;
|
||||
const size_t index_sz = 2 + mag * (frames - CONFIG_MISC_FIXES);
|
||||
const size_t index_sz = 2 + mag * (frames - 1);
|
||||
|
||||
// This chunk is marked as having a superframe index but doesn't have
|
||||
// enough data for it, thus it's an invalid superframe index.
|
||||
|
@ -501,20 +499,16 @@ vpx_codec_err_t vp10_parse_superframe_index(const uint8_t *data,
|
|||
x = clear_buffer;
|
||||
}
|
||||
|
||||
for (i = 0; i < frames - CONFIG_MISC_FIXES; ++i) {
|
||||
for (i = 0; i < frames - 1; ++i) {
|
||||
uint32_t this_sz = 0;
|
||||
|
||||
for (j = 0; j < mag; ++j)
|
||||
this_sz |= (*x++) << (j * 8);
|
||||
this_sz += CONFIG_MISC_FIXES;
|
||||
this_sz += 1;
|
||||
sizes[i] = this_sz;
|
||||
#if CONFIG_MISC_FIXES
|
||||
frame_sz_sum += this_sz;
|
||||
#endif
|
||||
}
|
||||
#if CONFIG_MISC_FIXES
|
||||
sizes[i] = data_sz - index_sz - frame_sz_sum;
|
||||
#endif
|
||||
*count = frames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,11 +164,7 @@ static int decode_coefs(const MACROBLOCKD *xd,
|
|||
val = CAT5_MIN_VAL + read_coeff(cat5_prob, 5, r);
|
||||
break;
|
||||
case CATEGORY6_TOKEN: {
|
||||
#if CONFIG_MISC_FIXES
|
||||
const int skip_bits = TX_SIZES - 1 - tx_size;
|
||||
#else
|
||||
const int skip_bits = 0;
|
||||
#endif
|
||||
const uint8_t *cat6p = cat6_prob + skip_bits;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
switch (xd->bd) {
|
||||
|
|
|
@ -23,13 +23,13 @@ static int inv_recenter_nonneg(int v, int m) {
|
|||
|
||||
static int decode_uniform(vpx_reader *r) {
|
||||
const int l = 8;
|
||||
const int m = (1 << l) - 191 + CONFIG_MISC_FIXES;
|
||||
const int m = (1 << l) - 192;
|
||||
const int v = vpx_read_literal(r, l - 1);
|
||||
return v < m ? v : (v << 1) - m + vpx_read_bit(r);
|
||||
}
|
||||
|
||||
static int inv_remap_prob(int v, int m) {
|
||||
static uint8_t inv_map_table[MAX_PROB - CONFIG_MISC_FIXES] = {
|
||||
static uint8_t inv_map_table[MAX_PROB - 1] = {
|
||||
7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176, 189,
|
||||
202, 215, 228, 241, 254, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11,
|
||||
12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27,
|
||||
|
@ -47,9 +47,6 @@ static int inv_remap_prob(int v, int m) {
|
|||
207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 222,
|
||||
223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
|
||||
239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
|
||||
#if !CONFIG_MISC_FIXES
|
||||
253
|
||||
#endif
|
||||
};
|
||||
assert(v < (int)(sizeof(inv_map_table) / sizeof(inv_map_table[0])));
|
||||
v = inv_map_table[v];
|
||||
|
|
|
@ -106,18 +106,6 @@ static void write_inter_mode(vpx_writer *w, PREDICTION_MODE mode,
|
|||
&inter_mode_encodings[INTER_OFFSET(mode)]);
|
||||
}
|
||||
|
||||
|
||||
static void write_inv_signed_literal(struct vpx_write_bit_buffer *wb,
|
||||
int data, int bits) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
vpx_wb_write_literal(wb, data, bits + 1);
|
||||
#else
|
||||
vpx_wb_write_literal(wb, abs(data), bits);
|
||||
vpx_wb_write_bit(wb, data < 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void encode_unsigned_max(struct vpx_write_bit_buffer *wb,
|
||||
int data, int max) {
|
||||
vpx_wb_write_literal(wb, data, get_unsigned_bits(max));
|
||||
|
@ -333,9 +321,6 @@ static void pack_mb_tokens(vpx_writer *w,
|
|||
int count = 0;
|
||||
const int seg_eob = 16 << (tx << 1);
|
||||
#endif
|
||||
#if !CONFIG_MISC_FIXES
|
||||
(void) tx;
|
||||
#endif
|
||||
|
||||
while (p < stop && p->token != EOSB_TOKEN) {
|
||||
const int t = p->token;
|
||||
|
@ -383,12 +368,8 @@ static void pack_mb_tokens(vpx_writer *w,
|
|||
|
||||
if (b->base_val) {
|
||||
const int e = p->extra, l = b->len;
|
||||
#if CONFIG_MISC_FIXES
|
||||
int skip_bits =
|
||||
(b->base_val == CAT6_MIN_VAL) ? TX_SIZES - 1 - tx : 0;
|
||||
#else
|
||||
int skip_bits = 0;
|
||||
#endif
|
||||
|
||||
if (l) {
|
||||
const unsigned char *pb = b->prob;
|
||||
|
@ -571,11 +552,7 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
|
|||
const MACROBLOCK *x = &cpi->td.mb;
|
||||
const MACROBLOCKD *xd = &x->e_mbd;
|
||||
const struct segmentation *const seg = &cm->seg;
|
||||
#if CONFIG_MISC_FIXES
|
||||
const struct segmentation_probs *const segp = &cm->fc->seg;
|
||||
#else
|
||||
const struct segmentation_probs *const segp = &cm->segp;
|
||||
#endif
|
||||
const MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||
const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
|
||||
const PREDICTION_MODE mode = mbmi->mode;
|
||||
|
@ -760,11 +737,7 @@ static void write_palette_mode_info(const VP10_COMMON *cm,
|
|||
static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
|
||||
MODE_INFO **mi_8x8, vpx_writer *w) {
|
||||
const struct segmentation *const seg = &cm->seg;
|
||||
#if CONFIG_MISC_FIXES
|
||||
const struct segmentation_probs *const segp = &cm->fc->seg;
|
||||
#else
|
||||
const struct segmentation_probs *const segp = &cm->segp;
|
||||
#endif
|
||||
const MODE_INFO *const mi = mi_8x8[0];
|
||||
const MODE_INFO *const above_mi = xd->above_mi;
|
||||
const MODE_INFO *const left_mi = xd->left_mi;
|
||||
|
@ -1246,7 +1219,7 @@ static void encode_loopfilter(struct loopfilter *lf,
|
|||
static void write_delta_q(struct vpx_write_bit_buffer *wb, int delta_q) {
|
||||
if (delta_q != 0) {
|
||||
vpx_wb_write_bit(wb, 1);
|
||||
vpx_wb_write_inv_signed_literal(wb, delta_q, CONFIG_MISC_FIXES ? 6 : 4);
|
||||
vpx_wb_write_inv_signed_literal(wb, delta_q, 6);
|
||||
} else {
|
||||
vpx_wb_write_bit(wb, 0);
|
||||
}
|
||||
|
@ -1263,11 +1236,7 @@ static void encode_quantization(const VP10_COMMON *const cm,
|
|||
static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
|
||||
struct vpx_write_bit_buffer *wb) {
|
||||
int i, j;
|
||||
|
||||
const struct segmentation *seg = &cm->seg;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
const struct segmentation_probs *segp = &cm->segp;
|
||||
#endif
|
||||
|
||||
vpx_wb_write_bit(wb, seg->enabled);
|
||||
if (!seg->enabled)
|
||||
|
@ -1282,16 +1251,6 @@ static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
|
|||
if (seg->update_map) {
|
||||
// Select the coding strategy (temporal or spatial)
|
||||
vp10_choose_segmap_coding_method(cm, xd);
|
||||
#if !CONFIG_MISC_FIXES
|
||||
// Write out probabilities used to decode unpredicted macro-block segments
|
||||
for (i = 0; i < SEG_TREE_PROBS; i++) {
|
||||
const int prob = segp->tree_probs[i];
|
||||
const int update = prob != MAX_PROB;
|
||||
vpx_wb_write_bit(wb, update);
|
||||
if (update)
|
||||
vpx_wb_write_literal(wb, prob, 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Write out the chosen coding method.
|
||||
if (!frame_is_intra_only(cm) && !cm->error_resilient_mode) {
|
||||
|
@ -1299,18 +1258,6 @@ static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
|
|||
} else {
|
||||
assert(seg->temporal_update == 0);
|
||||
}
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
if (seg->temporal_update) {
|
||||
for (i = 0; i < PREDICTION_PROBS; i++) {
|
||||
const int prob = segp->pred_probs[i];
|
||||
const int update = prob != MAX_PROB;
|
||||
vpx_wb_write_bit(wb, update);
|
||||
if (update)
|
||||
vpx_wb_write_literal(wb, prob, 8);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Segmentation data
|
||||
|
@ -1338,7 +1285,6 @@ static void encode_segmentation(VP10_COMMON *cm, MACROBLOCKD *xd,
|
|||
}
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static void update_seg_probs(VP10_COMP *cpi, vpx_writer *w) {
|
||||
VP10_COMMON *cm = &cpi->common;
|
||||
|
||||
|
@ -1365,19 +1311,9 @@ static void write_txfm_mode(TX_MODE mode, struct vpx_write_bit_buffer *wb) {
|
|||
if (mode != TX_MODE_SELECT)
|
||||
vpx_wb_write_literal(wb, mode, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void update_txfm_probs(VP10_COMMON *cm, vpx_writer *w,
|
||||
FRAME_COUNTS *counts) {
|
||||
#if !CONFIG_MISC_FIXES
|
||||
// Mode
|
||||
vpx_write_literal(w, VPXMIN(cm->tx_mode, ALLOW_32X32), 2);
|
||||
if (cm->tx_mode >= ALLOW_32X32)
|
||||
vpx_write_bit(w, cm->tx_mode == TX_MODE_SELECT);
|
||||
|
||||
// Probabilities
|
||||
#endif
|
||||
|
||||
if (cm->tx_mode == TX_MODE_SELECT) {
|
||||
int i, j;
|
||||
unsigned int ct_8x8p[TX_SIZES - 3][2];
|
||||
|
@ -1522,7 +1458,7 @@ static size_t encode_tiles(VP10_COMP *cpi, uint8_t *data_ptr,
|
|||
|
||||
// size of this tile
|
||||
assert(residual_bc.pos > 0);
|
||||
tile_sz = residual_bc.pos - CONFIG_MISC_FIXES;
|
||||
tile_sz = residual_bc.pos - 1;
|
||||
mem_put_le32(data_ptr + total_size, tile_sz);
|
||||
max_tile = max_tile > tile_sz ? max_tile : tile_sz;
|
||||
total_size += 4;
|
||||
|
@ -1567,10 +1503,8 @@ static void write_frame_size_with_refs(VP10_COMP *cpi,
|
|||
if (cfg != NULL) {
|
||||
found = cm->width == cfg->y_crop_width &&
|
||||
cm->height == cfg->y_crop_height;
|
||||
#if CONFIG_MISC_FIXES
|
||||
found &= cm->render_width == cfg->render_width &&
|
||||
cm->render_height == cfg->render_height;
|
||||
#endif
|
||||
}
|
||||
vpx_wb_write_bit(wb, found);
|
||||
if (found) {
|
||||
|
@ -1581,15 +1515,8 @@ static void write_frame_size_with_refs(VP10_COMP *cpi,
|
|||
if (!found) {
|
||||
vpx_wb_write_literal(wb, cm->width - 1, 16);
|
||||
vpx_wb_write_literal(wb, cm->height - 1, 16);
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
write_render_size(cm, wb);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
write_render_size(cm, wb);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void write_sync_code(struct vpx_write_bit_buffer *wb) {
|
||||
|
@ -1667,7 +1594,6 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
|||
vpx_wb_write_bit(wb, cm->intra_only);
|
||||
|
||||
if (!cm->error_resilient_mode) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (cm->intra_only) {
|
||||
vpx_wb_write_bit(wb,
|
||||
cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL);
|
||||
|
@ -1678,25 +1604,11 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
|||
vpx_wb_write_bit(wb,
|
||||
cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL);
|
||||
}
|
||||
#else
|
||||
static const int reset_frame_context_conv_tbl[3] = { 0, 2, 3 };
|
||||
|
||||
vpx_wb_write_literal(wb,
|
||||
reset_frame_context_conv_tbl[cm->reset_frame_context], 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cm->intra_only) {
|
||||
write_sync_code(wb);
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
write_bitdepth_colorspace_sampling(cm, wb);
|
||||
#else
|
||||
// Note for profile 0, 420 8bpp is assumed.
|
||||
if (cm->profile > PROFILE_0) {
|
||||
write_bitdepth_colorspace_sampling(cm, wb);
|
||||
}
|
||||
#endif
|
||||
|
||||
vpx_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
|
||||
write_frame_size(cm, wb);
|
||||
|
@ -1722,11 +1634,9 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
|||
if (!cm->error_resilient_mode) {
|
||||
vpx_wb_write_bit(wb,
|
||||
cm->refresh_frame_context != REFRESH_FRAME_CONTEXT_OFF);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (cm->refresh_frame_context != REFRESH_FRAME_CONTEXT_OFF)
|
||||
#endif
|
||||
vpx_wb_write_bit(wb, cm->refresh_frame_context !=
|
||||
REFRESH_FRAME_CONTEXT_BACKWARD);
|
||||
REFRESH_FRAME_CONTEXT_BACKWARD);
|
||||
}
|
||||
|
||||
vpx_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
|
||||
|
@ -1734,7 +1644,6 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
|||
encode_loopfilter(&cm->lf, wb);
|
||||
encode_quantization(cm, wb);
|
||||
encode_segmentation(cm, xd, wb);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (!cm->seg.enabled && xd->lossless[0])
|
||||
cm->tx_mode = TX_4X4;
|
||||
else
|
||||
|
@ -1747,7 +1656,6 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
|||
if (!use_hybrid_pred)
|
||||
vpx_wb_write_bit(wb, use_compound_pred);
|
||||
}
|
||||
#endif
|
||||
|
||||
write_tile_info(cm, wb);
|
||||
}
|
||||
|
@ -1757,21 +1665,10 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||
FRAME_CONTEXT *const fc = cm->fc;
|
||||
FRAME_COUNTS *counts = cpi->td.counts;
|
||||
vpx_writer header_bc;
|
||||
int i;
|
||||
#if CONFIG_MISC_FIXES
|
||||
int j;
|
||||
#endif
|
||||
int i, j;
|
||||
|
||||
vpx_start_encode(&header_bc, data);
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
if (cpi->td.mb.e_mbd.lossless[0])
|
||||
cm->tx_mode = TX_4X4;
|
||||
else
|
||||
update_txfm_probs(cm, &header_bc, counts);
|
||||
#else
|
||||
update_txfm_probs(cm, &header_bc, counts);
|
||||
#endif
|
||||
update_coef_probs(cpi, &header_bc);
|
||||
|
||||
#if CONFIG_VAR_TX
|
||||
|
@ -1779,7 +1676,6 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||
#endif
|
||||
|
||||
update_skip_probs(cm, &header_bc, counts);
|
||||
#if CONFIG_MISC_FIXES
|
||||
update_seg_probs(cpi, &header_bc);
|
||||
|
||||
for (i = 0; i < INTRA_MODES; ++i)
|
||||
|
@ -1789,16 +1685,13 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||
for (i = 0; i < PARTITION_CONTEXTS; ++i)
|
||||
prob_diff_update(vp10_partition_tree, fc->partition_prob[i],
|
||||
counts->partition[i], PARTITION_TYPES, &header_bc);
|
||||
#endif
|
||||
|
||||
if (frame_is_intra_only(cm)) {
|
||||
vp10_copy(cm->kf_y_prob, vp10_kf_y_mode_prob);
|
||||
#if CONFIG_MISC_FIXES
|
||||
for (i = 0; i < INTRA_MODES; ++i)
|
||||
for (j = 0; j < INTRA_MODES; ++j)
|
||||
prob_diff_update(vp10_intra_mode_tree, cm->kf_y_prob[i][j],
|
||||
counts->kf_y_mode[i][j], INTRA_MODES, &header_bc);
|
||||
#endif
|
||||
} else {
|
||||
for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
|
||||
prob_diff_update(vp10_inter_mode_tree, cm->fc->inter_mode_probs[i],
|
||||
|
@ -1813,23 +1706,10 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||
|
||||
if (cpi->allow_comp_inter_inter) {
|
||||
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
|
||||
|
||||
vpx_write_bit(&header_bc, use_compound_pred);
|
||||
if (use_compound_pred) {
|
||||
vpx_write_bit(&header_bc, use_hybrid_pred);
|
||||
if (use_hybrid_pred)
|
||||
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
|
||||
vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
|
||||
counts->comp_inter[i]);
|
||||
}
|
||||
#else
|
||||
if (use_hybrid_pred)
|
||||
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
|
||||
vp10_cond_prob_diff_update(&header_bc, &fc->comp_inter_prob[i],
|
||||
counts->comp_inter[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cm->reference_mode != COMPOUND_REFERENCE) {
|
||||
|
@ -1850,12 +1730,6 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||
prob_diff_update(vp10_intra_mode_tree, cm->fc->y_mode_prob[i],
|
||||
counts->y_mode[i], INTRA_MODES, &header_bc);
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
for (i = 0; i < PARTITION_CONTEXTS; ++i)
|
||||
prob_diff_update(vp10_partition_tree, fc->partition_prob[i],
|
||||
counts->partition[i], PARTITION_TYPES, &header_bc);
|
||||
#endif
|
||||
|
||||
vp10_write_nmv_probs(cm, cm->allow_high_precision_mv, &header_bc,
|
||||
&counts->mv);
|
||||
#if CONFIG_EXT_TX
|
||||
|
@ -1869,7 +1743,6 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||
return header_bc.pos;
|
||||
}
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
static int remux_tiles(uint8_t *dest, const int sz,
|
||||
const int n_tiles, const int mag) {
|
||||
int rpos = 0, wpos = 0, n;
|
||||
|
@ -1909,7 +1782,6 @@ static int remux_tiles(uint8_t *dest, const int sz,
|
|||
|
||||
return wpos;
|
||||
}
|
||||
#endif
|
||||
|
||||
void vp10_pack_bitstream(VP10_COMP *const cpi, uint8_t *dest, size_t *size) {
|
||||
uint8_t *data = dest;
|
||||
|
@ -1917,14 +1789,9 @@ void vp10_pack_bitstream(VP10_COMP *const cpi, uint8_t *dest, size_t *size) {
|
|||
struct vpx_write_bit_buffer wb = {data, 0};
|
||||
struct vpx_write_bit_buffer saved_wb;
|
||||
unsigned int max_tile;
|
||||
#if CONFIG_MISC_FIXES
|
||||
VP10_COMMON *const cm = &cpi->common;
|
||||
const int n_log2_tiles = cm->log2_tile_rows + cm->log2_tile_cols;
|
||||
const int have_tiles = n_log2_tiles > 0;
|
||||
#else
|
||||
const int have_tiles = 0; // we have tiles, but we don't want to write a
|
||||
// tile size marker in the header
|
||||
#endif
|
||||
|
||||
write_uncompressed_header(cpi, &wb);
|
||||
saved_wb = wb;
|
||||
|
@ -1940,7 +1807,6 @@ void vp10_pack_bitstream(VP10_COMP *const cpi, uint8_t *dest, size_t *size) {
|
|||
data += first_part_size;
|
||||
|
||||
data_sz = encode_tiles(cpi, data, &max_tile);
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (max_tile > 0) {
|
||||
int mag;
|
||||
unsigned int mask;
|
||||
|
@ -1959,7 +1825,6 @@ void vp10_pack_bitstream(VP10_COMP *const cpi, uint8_t *dest, size_t *size) {
|
|||
} else {
|
||||
assert(n_log2_tiles == 0);
|
||||
}
|
||||
#endif
|
||||
data += data_sz;
|
||||
|
||||
// TODO(jbb): Figure out what to do if first_part_size > 16 bits.
|
||||
|
|
|
@ -2818,15 +2818,9 @@ static void encode_frame_internal(VP10_COMP *cpi) {
|
|||
vp10_zero(rdc->filter_diff);
|
||||
|
||||
for (i = 0; i < (cm->seg.enabled ? MAX_SEGMENTS : 1); ++i) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
const int qindex = vp10_get_qindex(&cm->seg, i, cm->base_qindex);
|
||||
#endif
|
||||
xd->lossless[i] = cm->y_dc_delta_q == 0 &&
|
||||
#if CONFIG_MISC_FIXES
|
||||
qindex == 0 &&
|
||||
#else
|
||||
cm->base_qindex == 0 &&
|
||||
#endif
|
||||
cm->uv_dc_delta_q == 0 &&
|
||||
cm->uv_ac_delta_q == 0;
|
||||
}
|
||||
|
|
|
@ -137,19 +137,8 @@ static void build_nmv_component_cost_table(int *mvcost,
|
|||
|
||||
static void update_mv(vpx_writer *w, const unsigned int ct[2], vpx_prob *cur_p,
|
||||
vpx_prob upd_p) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
(void) upd_p;
|
||||
vp10_cond_prob_diff_update(w, cur_p, ct);
|
||||
#else
|
||||
const vpx_prob new_p = get_binary_prob(ct[0], ct[1]) | 1;
|
||||
const int update = cost_branch256(ct, *cur_p) + vp10_cost_zero(upd_p) >
|
||||
cost_branch256(ct, new_p) + vp10_cost_one(upd_p) + 7 * 256;
|
||||
vpx_write(w, update, upd_p);
|
||||
if (update) {
|
||||
*cur_p = new_p;
|
||||
vpx_write_literal(w, new_p >> 1, 7);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void write_mv_update(const vpx_tree_index *tree,
|
||||
|
|
|
@ -419,10 +419,6 @@ static void save_coding_context(VP10_COMP *cpi) {
|
|||
memcpy(cc->nmvcosts_hp[1], cpi->nmvcosts_hp[1],
|
||||
MV_VALS * sizeof(*cpi->nmvcosts_hp[1]));
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
vp10_copy(cc->segment_pred_probs, cm->segp.pred_probs);
|
||||
#endif
|
||||
|
||||
memcpy(cpi->coding_context.last_frame_seg_map_copy,
|
||||
cm->last_frame_seg_map, (cm->mi_rows * cm->mi_cols));
|
||||
|
||||
|
@ -447,10 +443,6 @@ static void restore_coding_context(VP10_COMP *cpi) {
|
|||
memcpy(cpi->nmvcosts_hp[1], cc->nmvcosts_hp[1],
|
||||
MV_VALS * sizeof(*cc->nmvcosts_hp[1]));
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
vp10_copy(cm->segp.pred_probs, cc->segment_pred_probs);
|
||||
#endif
|
||||
|
||||
memcpy(cm->last_frame_seg_map,
|
||||
cpi->coding_context.last_frame_seg_map_copy,
|
||||
(cm->mi_rows * cm->mi_cols));
|
||||
|
@ -3677,12 +3669,7 @@ static void encode_frame_to_data_rate(VP10_COMP *cpi,
|
|||
|
||||
if (cm->refresh_frame_context == REFRESH_FRAME_CONTEXT_BACKWARD) {
|
||||
vp10_adapt_coef_probs(cm);
|
||||
#if CONFIG_MISC_FIXES
|
||||
vp10_adapt_intra_frame_probs(cm);
|
||||
#else
|
||||
if (!frame_is_intra_only(cm))
|
||||
vp10_adapt_intra_frame_probs(cm);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!frame_is_intra_only(cm)) {
|
||||
|
|
|
@ -55,10 +55,6 @@ typedef struct {
|
|||
int nmvcosts[2][MV_VALS];
|
||||
int nmvcosts_hp[2][MV_VALS];
|
||||
|
||||
#if !CONFIG_MISC_FIXES
|
||||
vpx_prob segment_pred_probs[PREDICTION_PROBS];
|
||||
#endif
|
||||
|
||||
unsigned char *last_frame_seg_map_copy;
|
||||
|
||||
// 0 = Intra, Last, GF, ARF
|
||||
|
|
|
@ -963,11 +963,10 @@ static void super_block_yrd(VP10_COMP *cpi, MACROBLOCK *x, int *rate,
|
|||
|
||||
assert(bs == xd->mi[0]->mbmi.sb_type);
|
||||
|
||||
if (CONFIG_MISC_FIXES && xd->lossless[xd->mi[0]->mbmi.segment_id]) {
|
||||
if (xd->lossless[xd->mi[0]->mbmi.segment_id]) {
|
||||
choose_smallest_tx_size(cpi, x, rate, distortion, skip, ret_sse,
|
||||
ref_best_rd, bs);
|
||||
} else if (cpi->sf.tx_size_search_method == USE_LARGESTALL ||
|
||||
xd->lossless[xd->mi[0]->mbmi.segment_id]) {
|
||||
} else if (cpi->sf.tx_size_search_method == USE_LARGESTALL) {
|
||||
choose_largest_tx_size(cpi, x, rate, distortion, skip, ret_sse, ref_best_rd,
|
||||
bs);
|
||||
} else {
|
||||
|
|
|
@ -58,9 +58,7 @@ static void calc_segtree_probs(unsigned *segcounts,
|
|||
segcounts[4] + segcounts[5], segcounts[6] + segcounts[7]
|
||||
};
|
||||
const unsigned ccc[2] = { cc[0] + cc[1], cc[2] + cc[3] };
|
||||
#if CONFIG_MISC_FIXES
|
||||
int i;
|
||||
#endif
|
||||
|
||||
segment_tree_probs[0] = get_binary_prob(ccc[0], ccc[1]);
|
||||
segment_tree_probs[1] = get_binary_prob(cc[0], cc[1]);
|
||||
|
@ -70,16 +68,12 @@ static void calc_segtree_probs(unsigned *segcounts,
|
|||
segment_tree_probs[5] = get_binary_prob(segcounts[4], segcounts[5]);
|
||||
segment_tree_probs[6] = get_binary_prob(segcounts[6], segcounts[7]);
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
for (i = 0; i < 7; i++) {
|
||||
const unsigned *ct = i == 0 ? ccc : i < 3 ? cc + (i & 2)
|
||||
: segcounts + (i - 3) * 2;
|
||||
vp10_prob_diff_update_savings_search(ct,
|
||||
cur_tree_probs[i], &segment_tree_probs[i], DIFF_UPDATE_PROB);
|
||||
}
|
||||
#else
|
||||
(void) cur_tree_probs;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Based on set of segment counts and probabilities calculate a cost estimate
|
||||
|
@ -214,39 +208,22 @@ static void count_segs_sb(const VP10_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
void vp10_choose_segmap_coding_method(VP10_COMMON *cm, MACROBLOCKD *xd) {
|
||||
struct segmentation *seg = &cm->seg;
|
||||
#if CONFIG_MISC_FIXES
|
||||
struct segmentation_probs *segp = &cm->fc->seg;
|
||||
#else
|
||||
struct segmentation_probs *segp = &cm->segp;
|
||||
#endif
|
||||
|
||||
int no_pred_cost;
|
||||
int t_pred_cost = INT_MAX;
|
||||
|
||||
int i, tile_col, mi_row, mi_col;
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
unsigned (*temporal_predictor_count)[2] = cm->counts.seg.pred;
|
||||
unsigned *no_pred_segcounts = cm->counts.seg.tree_total;
|
||||
unsigned *t_unpred_seg_counts = cm->counts.seg.tree_mispred;
|
||||
#else
|
||||
unsigned temporal_predictor_count[PREDICTION_PROBS][2] = { { 0 } };
|
||||
unsigned no_pred_segcounts[MAX_SEGMENTS] = { 0 };
|
||||
unsigned t_unpred_seg_counts[MAX_SEGMENTS] = { 0 };
|
||||
#endif
|
||||
|
||||
vpx_prob no_pred_tree[SEG_TREE_PROBS];
|
||||
vpx_prob t_pred_tree[SEG_TREE_PROBS];
|
||||
vpx_prob t_nopred_prob[PREDICTION_PROBS];
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
(void) xd;
|
||||
#else
|
||||
// Set default state for the segment tree probabilities and the
|
||||
// temporal coding probabilities
|
||||
memset(segp->tree_probs, 255, sizeof(segp->tree_probs));
|
||||
memset(segp->pred_probs, 255, sizeof(segp->pred_probs));
|
||||
#endif
|
||||
|
||||
// First of all generate stats regarding how well the last segment map
|
||||
// predicts this one
|
||||
|
@ -284,13 +261,9 @@ void vp10_choose_segmap_coding_method(VP10_COMMON *cm, MACROBLOCKD *xd) {
|
|||
const int count0 = temporal_predictor_count[i][0];
|
||||
const int count1 = temporal_predictor_count[i][1];
|
||||
|
||||
#if CONFIG_MISC_FIXES
|
||||
vp10_prob_diff_update_savings_search(temporal_predictor_count[i],
|
||||
segp->pred_probs[i],
|
||||
&t_nopred_prob[i], DIFF_UPDATE_PROB);
|
||||
#else
|
||||
t_nopred_prob[i] = get_binary_prob(count0, count1);
|
||||
#endif
|
||||
|
||||
// Add in the predictor signaling cost
|
||||
t_pred_cost += count0 * vp10_cost_zero(t_nopred_prob[i]) +
|
||||
|
@ -301,30 +274,17 @@ void vp10_choose_segmap_coding_method(VP10_COMMON *cm, MACROBLOCKD *xd) {
|
|||
// Now choose which coding method to use.
|
||||
if (t_pred_cost < no_pred_cost) {
|
||||
seg->temporal_update = 1;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
memcpy(segp->tree_probs, t_pred_tree, sizeof(t_pred_tree));
|
||||
memcpy(segp->pred_probs, t_nopred_prob, sizeof(t_nopred_prob));
|
||||
#endif
|
||||
} else {
|
||||
seg->temporal_update = 0;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
memcpy(segp->tree_probs, no_pred_tree, sizeof(no_pred_tree));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void vp10_reset_segment_features(VP10_COMMON *cm) {
|
||||
struct segmentation *seg = &cm->seg;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
struct segmentation_probs *segp = &cm->segp;
|
||||
#endif
|
||||
|
||||
// Set up default state for MB feature flags
|
||||
seg->enabled = 0;
|
||||
seg->update_map = 0;
|
||||
seg->update_data = 0;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
memset(segp->tree_probs, 255, sizeof(segp->tree_probs));
|
||||
#endif
|
||||
vp10_clearall_segfeatures(seg);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ static const uint8_t update_bits[255] = {
|
|||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 11 - CONFIG_MISC_FIXES,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
|
@ -86,7 +85,7 @@ static int prob_diff_update_cost(vpx_prob newp, vpx_prob oldp) {
|
|||
|
||||
static void encode_uniform(vpx_writer *w, int v) {
|
||||
const int l = 8;
|
||||
const int m = (1 << l) - 191 + CONFIG_MISC_FIXES;
|
||||
const int m = (1 << l) - 192;
|
||||
if (v < m) {
|
||||
vpx_write_literal(w, v, l - 1);
|
||||
} else {
|
||||
|
|
|
@ -91,9 +91,6 @@ struct vpx_codec_alg_priv {
|
|||
size_t pending_cx_data_sz;
|
||||
int pending_frame_count;
|
||||
size_t pending_frame_sizes[8];
|
||||
#if !CONFIG_MISC_FIXES
|
||||
size_t pending_frame_magnitude;
|
||||
#endif
|
||||
vpx_image_t preview_img;
|
||||
vpx_enc_frame_flags_t next_frame_flags;
|
||||
vp8_postproc_cfg_t preview_ppcfg;
|
||||
|
@ -783,39 +780,30 @@ static int write_superframe_index(vpx_codec_alg_priv_t *ctx) {
|
|||
uint8_t marker = 0xc0;
|
||||
unsigned int mask;
|
||||
int mag, index_sz;
|
||||
#if CONFIG_MISC_FIXES
|
||||
int i;
|
||||
size_t max_frame_sz = 0;
|
||||
#endif
|
||||
|
||||
assert(ctx->pending_frame_count);
|
||||
assert(ctx->pending_frame_count <= 8);
|
||||
|
||||
// Add the number of frames to the marker byte
|
||||
marker |= ctx->pending_frame_count - 1;
|
||||
#if CONFIG_MISC_FIXES
|
||||
for (i = 0; i < ctx->pending_frame_count - 1; i++) {
|
||||
const size_t frame_sz = (unsigned int) ctx->pending_frame_sizes[i] - 1;
|
||||
max_frame_sz = frame_sz > max_frame_sz ? frame_sz : max_frame_sz;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Choose the magnitude
|
||||
for (mag = 0, mask = 0xff; mag < 4; mag++) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
if (max_frame_sz <= mask)
|
||||
break;
|
||||
#else
|
||||
if (ctx->pending_frame_magnitude < mask)
|
||||
break;
|
||||
#endif
|
||||
mask <<= 8;
|
||||
mask |= 0xff;
|
||||
}
|
||||
marker |= mag << 3;
|
||||
|
||||
// Write the index
|
||||
index_sz = 2 + (mag + 1) * (ctx->pending_frame_count - CONFIG_MISC_FIXES);
|
||||
index_sz = 2 + (mag + 1) * (ctx->pending_frame_count - 1);
|
||||
if (ctx->pending_cx_data_sz + index_sz < ctx->cx_data_sz) {
|
||||
uint8_t *x = ctx->pending_cx_data + ctx->pending_cx_data_sz;
|
||||
int i, j;
|
||||
|
@ -835,11 +823,11 @@ static int write_superframe_index(vpx_codec_alg_priv_t *ctx) {
|
|||
#endif
|
||||
|
||||
*x++ = marker;
|
||||
for (i = 0; i < ctx->pending_frame_count - CONFIG_MISC_FIXES; i++) {
|
||||
for (i = 0; i < ctx->pending_frame_count - 1; i++) {
|
||||
unsigned int this_sz;
|
||||
|
||||
assert(ctx->pending_frame_sizes[i] > 0);
|
||||
this_sz = (unsigned int)ctx->pending_frame_sizes[i] - CONFIG_MISC_FIXES;
|
||||
this_sz = (unsigned int)ctx->pending_frame_sizes[i] - 1;
|
||||
for (j = 0; j <= mag; j++) {
|
||||
*x++ = this_sz & 0xff;
|
||||
this_sz >>= 8;
|
||||
|
@ -993,9 +981,6 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
|
|||
ctx->pending_cx_data = cx_data;
|
||||
ctx->pending_cx_data_sz += size;
|
||||
ctx->pending_frame_sizes[ctx->pending_frame_count++] = size;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
ctx->pending_frame_magnitude |= size;
|
||||
#endif
|
||||
cx_data += size;
|
||||
cx_data_sz -= size;
|
||||
|
||||
|
@ -1012,9 +997,6 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
|
|||
ctx->pending_cx_data = NULL;
|
||||
ctx->pending_cx_data_sz = 0;
|
||||
ctx->pending_frame_count = 0;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
ctx->pending_frame_magnitude = 0;
|
||||
#endif
|
||||
ctx->output_cx_pkt_cb.output_cx_pkt(
|
||||
&pkt, ctx->output_cx_pkt_cb.user_priv);
|
||||
}
|
||||
|
@ -1031,9 +1013,6 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
|
|||
|
||||
if (ctx->pending_cx_data) {
|
||||
ctx->pending_frame_sizes[ctx->pending_frame_count++] = size;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
ctx->pending_frame_magnitude |= size;
|
||||
#endif
|
||||
ctx->pending_cx_data_sz += size;
|
||||
// write the superframe only for the case when
|
||||
if (!ctx->output_cx_pkt_cb.output_cx_pkt)
|
||||
|
@ -1043,9 +1022,6 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
|
|||
ctx->pending_cx_data = NULL;
|
||||
ctx->pending_cx_data_sz = 0;
|
||||
ctx->pending_frame_count = 0;
|
||||
#if !CONFIG_MISC_FIXES
|
||||
ctx->pending_frame_magnitude = 0;
|
||||
#endif
|
||||
} else {
|
||||
pkt.data.frame.buf = cx_data;
|
||||
pkt.data.frame.sz = size;
|
||||
|
|
|
@ -43,11 +43,7 @@ int vpx_rb_read_signed_literal(struct vpx_read_bit_buffer *rb,
|
|||
|
||||
int vpx_rb_read_inv_signed_literal(struct vpx_read_bit_buffer *rb,
|
||||
int bits) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
const int nbits = sizeof(unsigned) * 8 - bits - 1;
|
||||
const unsigned value = vpx_rb_read_literal(rb, bits + 1) << nbits;
|
||||
return ((int) value) >> nbits;
|
||||
#else
|
||||
return vpx_rb_read_signed_literal(rb, bits);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -39,10 +39,5 @@ void vpx_wb_write_literal(struct vpx_write_bit_buffer *wb, int data, int bits) {
|
|||
|
||||
void vpx_wb_write_inv_signed_literal(struct vpx_write_bit_buffer *wb,
|
||||
int data, int bits) {
|
||||
#if CONFIG_MISC_FIXES
|
||||
vpx_wb_write_literal(wb, data, bits + 1);
|
||||
#else
|
||||
vpx_wb_write_literal(wb, abs(data), bits);
|
||||
vpx_wb_write_bit(wb, data < 0);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -832,11 +832,6 @@ static INLINE void highbd_dc_predictor(uint16_t *dst, ptrdiff_t stride,
|
|||
intra_pred_no_4x4(d207)
|
||||
intra_pred_no_4x4(d63)
|
||||
intra_pred_no_4x4(d45)
|
||||
#if CONFIG_MISC_FIXES
|
||||
intra_pred_allsizes(d207e)
|
||||
intra_pred_allsizes(d63e)
|
||||
intra_pred_no_4x4(d45e)
|
||||
#endif
|
||||
intra_pred_no_4x4(d117)
|
||||
intra_pred_no_4x4(d135)
|
||||
intra_pred_no_4x4(d153)
|
||||
|
|
Загрузка…
Ссылка в новой задаче