ref: a10a268e58ffd4366f6dbddd5f26600d688714c9
parent: 2370d440bd2dd78dec7e437ab2ae7dd0ab95f00d
author: Paul Wilkins <paulwilkins@google.com>
date: Thu Nov 3 08:50:09 EDT 2011
Segment Features. Removal of #ifdefs Removal of configure #ifdefs so that segment features always available. Removal of code supporting old segment feature method. Still a good deal of tidying up to do. Change-Id: I397855f086f8c09ab1fae0a5f65d9e06d2e3e39f
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -104,16 +104,12 @@
{
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
SEG_LVL_ALT_LF = 1, // Use alternate loop filter value...
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
SEG_LVL_REF_FRAME = 2, // Optional Segment reference frame
SEG_LVL_MODE = 3, // Optional Segment mode
SEG_LVL_EOB = 4, // EOB end stop marker.
SEG_LVL_TRANSFORM = 5, // Block transform size.
-
SEG_LVL_MAX = 6 // Number of MB level features supported
-#else
- SEG_LVL_MAX = 2 // Number of MB level features supported
-#endif
} SEG_LVL_FEATURES;
@@ -261,9 +257,8 @@
// Segment features
signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
unsigned int segment_feature_mask[MAX_MB_SEGMENTS];
-#endif
/* mode_based Loop filter adjustment */
unsigned char mode_ref_lf_delta_enabled;
--- a/vp8/common/entropy.c
+++ b/vp8/common/entropy.c
@@ -92,12 +92,6 @@
DECLARE_ALIGNED(64, short, vp8_default_zig_zag_mask_8x8[64]);//int64_t
#endif
-#if CONFIG_SEGFEATURES
-const int vp8_seg_feature_data_bits[SEG_LVL_MAX] = {7, 6, 4, 4, 4, 2};
-#else
-const int vp8_seg_feature_data_bits[SEG_LVL_MAX] = {7, 6};
-#endif
-
/* Array indices are identical to previously-existing CONTEXT_NODE indices */
const vp8_tree_index vp8_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
--- a/vp8/common/entropy.h
+++ b/vp8/common/entropy.h
@@ -106,7 +106,5 @@
extern DECLARE_ALIGNED(64, const int, vp8_default_zig_zag1d_8x8[64]);
extern short vp8_default_zig_zag_mask_8x8[64];//int64_t
#endif
-extern const int vp8_seg_feature_data_bits[SEG_LVL_MAX];
-
void vp8_coef_tree_initialize(void);
#endif
--- a/vp8/common/loopfilter.c
+++ b/vp8/common/loopfilter.c
@@ -14,9 +14,9 @@
#include "onyxc_int.h"
#include "vpx_mem/vpx_mem.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
+//#endif
typedef unsigned char uc;
@@ -221,11 +221,8 @@
// Set the baseline filter values for each segment
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( segfeature_active( xd, seg, SEG_LVL_ALT_LF ) )
-#else
- if ( xd->segmentation_enabled )
-#endif
{
/* Abs value */
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
--- a/vp8/common/seg_common.c
+++ b/vp8/common/seg_common.c
@@ -10,10 +10,10 @@
#include "vp8/common/seg_common.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
const int segfeaturedata_signed[SEG_LVL_MAX] = {1, 1, 0, 0, 0, 0};
+const int vp8_seg_feature_data_bits[SEG_LVL_MAX] = {7, 6, 4, 4, 4, 2};
-
// These functions provide access to new segment level features.
// Eventually these function may be "optimized out" but for the moment,
// the coding mechanism is still subject to change so these provide a
@@ -48,6 +48,11 @@
xd->segment_feature_mask[segment_id] &= ~(1 << feature_id);
}
+int seg_feature_data_bits( SEG_LVL_FEATURES feature_id )
+{
+ return vp8_seg_feature_data_bits[feature_id];
+}
+
int is_segfeature_signed( SEG_LVL_FEATURES feature_id )
{
return ( segfeaturedata_signed[feature_id] );
@@ -103,5 +108,3 @@
}
// TBD? Functions to read and write segment data with range / validity checking
-
-#endif
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -15,9 +15,8 @@
#include "onyxd_int.h"
#include "vp8/common/findnearmv.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#if CONFIG_SEGMENTATION
#include "vp8/common/seg_common.h"
@@ -93,21 +92,18 @@
if (pbi->mb.update_mb_segmentation_map)
vp8_read_mb_features(bc, &m->mbmi, &pbi->mb);
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( pbi->common.mb_no_coeff_skip &&
( !segfeature_active( &pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB ) ||
(pbi->mb.segment_feature_data[m->mbmi.segment_id]
[SEG_LVL_EOB] != 0) ) )
-#else
- // Read the macroblock coeff skip flag if this feature is in use,
- // else default to 0
- if (pbi->common.mb_no_coeff_skip)
-#endif
+ {
m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
+ }
else
{
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( segfeature_active( &pbi->mb,
m->mbmi.segment_id, SEG_LVL_EOB ) &&
(pbi->mb.segment_feature_data[m->mbmi.segment_id]
@@ -116,7 +112,6 @@
m->mbmi.mb_skip_coeff = 1;
}
else
-#endif
m->mbmi.mb_skip_coeff = 0;
}
@@ -238,15 +233,12 @@
MV_REFERENCE_FRAME ref_frame;
int seg_ref_active;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
MACROBLOCKD *const xd = &pbi->mb;
seg_ref_active = segfeature_active( xd,
segment_id,
SEG_LVL_REF_FRAME );
-#else
- seg_ref_active = 0;
-#endif
// Segment reference frame features not available
if ( !seg_ref_active )
@@ -264,7 +256,7 @@
}
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Segment reference frame features are enabled
else
{
@@ -335,7 +327,6 @@
}
}
}
-#endif
return (MV_REFERENCE_FRAME)ref_frame;
}
@@ -500,15 +491,12 @@
#endif
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( pbi->common.mb_no_coeff_skip &&
( !segfeature_active( xd,
mbmi->segment_id, SEG_LVL_EOB ) ||
(xd->segment_feature_data[mbmi->segment_id]
[SEG_LVL_EOB] != 0) ) )
-#else
- if (pbi->common.mb_no_coeff_skip)
-#endif
{
// Read the macroblock coeff skip flag if this feature is in use,
// else default to 0
@@ -516,7 +504,7 @@
}
else
{
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( segfeature_active( xd,
mbmi->segment_id, SEG_LVL_EOB ) &&
(xd->segment_feature_data[mbmi->segment_id]
@@ -525,7 +513,6 @@
mbmi->mb_skip_coeff = 1;
}
else
-#endif
mbmi->mb_skip_coeff = 0;
}
@@ -543,7 +530,7 @@
mbmi->ref_frame, pbi->common.ref_frame_sign_bias);
vp8_mv_ref_probs(mv_ref_p, rct);
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Is the segment level mode feature enabled for this segment
if ( segfeature_active( xd, mbmi->segment_id, SEG_LVL_MODE ) )
{
@@ -554,9 +541,6 @@
{
mbmi->mode = read_mv_ref(bc, mv_ref_p);
}
-#else
- mbmi->mode = read_mv_ref(bc, mv_ref_p);
-#endif
mbmi->uv_mode = DC_PRED;
switch (mbmi->mode)
@@ -709,12 +693,11 @@
/* required for left and above block mv */
mbmi->mv.as_int = 0;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( segfeature_active( xd, mbmi->segment_id, SEG_LVL_MODE ) )
mbmi->mode = (MB_PREDICTION_MODE)
get_segdata( xd, mbmi->segment_id, SEG_LVL_MODE );
else
-#endif
{
mbmi->mode = (MB_PREDICTION_MODE)
vp8_read_ymode(bc, pbi->common.fc.ymode_prob);
@@ -741,13 +724,12 @@
MODE_INFO *mi = pbi->common.mi;
int mb_row = -1;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#if 0
FILE *statsfile;
statsfile = fopen("decsegmap.stt", "a");
fprintf(statsfile, "\n" );
#endif
-#endif
mb_mode_mv_init(pbi);
@@ -772,11 +754,10 @@
mb_to_bottom_edge = ((pbi->common.mb_rows - 1 - mb_row) * 16) << 3;
mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#if 0
fprintf(statsfile, "\n" );
#endif
-#endif
while (++mb_col < pbi->common.mb_cols)
{
@@ -818,13 +799,13 @@
}
#endif
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#if 0
fprintf(statsfile, "%2d%2d%2d ",
mi->mbmi.segment_id, mi->mbmi.ref_frame, mi->mbmi.mode );
#endif
-#endif
+
mi++; /* next macroblock */
}
// printf("\n");
@@ -831,10 +812,10 @@
mi++; /* skip left predictor each row */
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#if 0
fclose(statsfile);
#endif
-#endif
+
}
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -37,9 +37,8 @@
#include "decoderthreading.h"
#include "dboolhuff.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#include <assert.h>
#include <stdio.h>
@@ -81,11 +80,8 @@
// Set the Q baseline allowing for any segment level adjustment
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( segfeature_active( xd, segment_id, SEG_LVL_ALT_Q ) )
-#else
- if ( xd->segmentation_enabled )
-#endif
{
/* Abs Value */
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
@@ -807,10 +803,9 @@
// Reset the segment feature data to the default stats:
// Features disabled, 0, with delta coding (Default state).
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
vpx_memset(xd->segment_feature_mask, 0,
sizeof(xd->segment_feature_mask));
-#endif
vpx_memset(xd->segment_feature_data, 0,
sizeof(xd->segment_feature_data));
@@ -883,7 +878,6 @@
int mb_row;
int i, j, k, l;
- const int *const mb_feature_data_bits = vp8_seg_feature_data_bits;
int corrupt_tokens = 0;
int prev_independent_partitions = pbi->independent_partitions;
@@ -1028,58 +1022,41 @@
if (xd->update_mb_segmentation_data)
{
+ int data;
+
xd->mb_segement_abs_delta = (unsigned char)vp8_read_bit(bc);
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
clearall_segfeatures( xd );
// For each segmentation...
- for (j = 0; j < MAX_MB_SEGMENTS; j++)
+ for (i = 0; i < MAX_MB_SEGMENTS; i++)
{
// For each of the segments features...
- for (i = 0; i < SEG_LVL_MAX; i++)
+ for (j = 0; j < SEG_LVL_MAX; j++)
{
-#else
- // Clear down feature data structure
- vpx_memset(xd->segment_feature_data, 0,
- sizeof(xd->segment_feature_data));
-
- // For each segmentation feature...
- for (i = 0; i < SEG_LVL_MAX; i++)
- {
- // For each segmentation...
- for (j = 0; j < MAX_MB_SEGMENTS; j++)
- {
-#endif
// Is the feature enabled
if (vp8_read_bit(bc))
{
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Update the feature data and mask
- enable_segfeature(xd, j, i);
-#endif
- xd->segment_feature_data[j][i] =
- (signed char)vp8_read_literal(
- bc, mb_feature_data_bits[i]);
+ enable_segfeature(xd, i, j);
-#if CONFIG_SEGFEATURES
+ data = (signed char)vp8_read_literal(
+ bc, seg_feature_data_bits(j));
+
+//#if CONFIG_SEGFEATURES
// Is the segment data signed..
- if ( is_segfeature_signed(i) )
-#else
- if ( 1 )
-#endif
+ if ( is_segfeature_signed(j) )
{
if (vp8_read_bit(bc))
- {
- xd->segment_feature_data[j][i] =
- -xd->segment_feature_data[j][i];
- }
+ data = - data;
}
}
else
- {
- xd->segment_feature_data[j][i] = 0;
- }
+ data = 0;
+
+ set_segdata(xd, i, j, data);
}
}
}
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -16,9 +16,8 @@
#include "vpx_ports/mem.h"
#include "detokenize.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#define BOOL_DATA UINT8
@@ -651,7 +650,7 @@
INT16 v;
const vp8_prob *Prob;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
int seg_eob = 16;
int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -659,7 +658,6 @@
{
seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
}
-#endif
type = 3;
i = 0;
@@ -701,10 +699,9 @@
Prob += v * ENTROPY_NODES;
DO_WHILE:
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( c == seg_eob )
goto BLOCK_FINISHED;
-#endif
Prob += coef_bands_x[c];
DECODE_AND_BRANCH_IF_ZERO(Prob[EOB_CONTEXT_NODE], BLOCK_FINISHED);
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -69,11 +69,10 @@
vpx_memcpy(mbd->segment_feature_data,
xd->segment_feature_data,
sizeof(xd->segment_feature_data));
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
vpx_memcpy(mbd->segment_feature_mask,
xd->segment_feature_mask,
sizeof(xd->segment_feature_mask));
-#endif
/*signed char ref_lf_deltas[MAX_REF_LF_DELTAS];*/
vpx_memcpy(mbd->ref_lf_deltas, xd->ref_lf_deltas, sizeof(xd->ref_lf_deltas));
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -25,9 +25,8 @@
#include "defaultcoefcounts.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#if CONFIG_SEGMENTATION
static int segment_cost = 0;
@@ -883,13 +882,10 @@
int prob_gf_coded )
{
int seg_ref_active;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
seg_ref_active = segfeature_active( xd,
segment_id,
SEG_LVL_REF_FRAME );
-#else
- seg_ref_active = 0;
-#endif
// No segment features or segment reference frame featuure is disabled
if ( !seg_ref_active )
@@ -913,7 +909,7 @@
}
}
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
else
{
if (rf == INTRA_FRAME)
@@ -955,7 +951,6 @@
}
}
}
-#endif
}
static void pack_inter_mode_mvs(VP8_COMP *const cpi)
@@ -985,13 +980,12 @@
cpi->mb.partition_info = cpi->mb.pi;
- // Calculate the probabilities to be used to code the reference frame based on actual useage this frame
-#if CONFIG_SEGFEATURES
+ // Calculate the probabilities to be used to code the reference frame
+ // based on actual useage this frame
+//#if CONFIG_SEGFEATURES
cpi->prob_intra_coded = (rf_intra + rf_inter)
? rf_intra * 255 / (rf_intra + rf_inter) : 1;
-#else
- cpi->prob_intra_coded = rf_intra * 255 / (rf_intra + rf_inter);
-#endif
+
if (!cpi->prob_intra_coded)
cpi->prob_intra_coded = 1;
@@ -1111,13 +1105,10 @@
#endif
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( pc->mb_no_coeff_skip &&
( !segfeature_active( xd, segment_id, SEG_LVL_EOB ) ||
(xd->segment_feature_data[segment_id][SEG_LVL_EOB] != 0) ) )
-#else
- if (pc->mb_no_coeff_skip)
-#endif
{
vp8_encode_bool(w, mi->mb_skip_coeff, prob_skip_false);
}
@@ -1133,12 +1124,9 @@
active_section = 6;
#endif
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( !segfeature_active( xd, segment_id, SEG_LVL_MODE ) )
write_ymode(w, mode, pc->fc.ymode_prob);
-#else
- write_ymode(w, mode, pc->fc.ymode_prob);
-#endif
if (mode == B_PRED)
{
@@ -1172,15 +1160,13 @@
active_section = 3;
#endif
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Is the segment coding of reference frame enabled
if ( !segfeature_active( xd, segment_id, SEG_LVL_MODE ) )
{
write_mv_ref(w, mode, mv_ref_p);
}
-#else
- write_mv_ref(w, mode, mv_ref_p);
-#endif
+
{
switch (mode) /* new, split require MVs */
{
@@ -1268,9 +1254,8 @@
int mb_row = -1;
int prob_skip_false = 0;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
MACROBLOCKD *xd = &cpi->mb.e_mbd;
-#endif
if (c->mb_no_coeff_skip)
{
@@ -1332,13 +1317,10 @@
#endif
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( c->mb_no_coeff_skip &&
( !segfeature_active( xd, segment_id, SEG_LVL_EOB ) ||
(xd->segment_feature_data[segment_id][SEG_LVL_EOB] != 0) ) )
-#else
- if (c->mb_no_coeff_skip)
-#endif
{
vp8_encode_bool(bc, m->mbmi.mb_skip_coeff, prob_skip_false);
}
@@ -1591,12 +1573,10 @@
if (cpi->common.frame_type != KEY_FRAME)
{
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
new_intra = (rf_intra + rf_inter)
? rf_intra * 255 / (rf_intra + rf_inter) : 1;
-#else
- new_intra = rf_intra * 255 / (rf_intra + rf_inter);
-#endif
+
if (!new_intra)
new_intra = 1;
@@ -1988,7 +1968,6 @@
oh.version = pc->version;
oh.first_partition_length_in_bytes = 0;
- mb_feature_data_bits = vp8_seg_feature_data_bits;
cx_data += 3;
#if defined(SECTIONBITS_OUTPUT)
@@ -2049,39 +2028,24 @@
vp8_write_bit(bc, (xd->mb_segement_abs_delta) ? 1 : 0);
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// For each segments id...
- for (j = 0; j < MAX_MB_SEGMENTS; j++)
+ for (i = 0; i < MAX_MB_SEGMENTS; i++)
{
// For each segmentation codable feature...
- for (i = 0; i < SEG_LVL_MAX; i++)
-#else
- // For each segmentation codable feature...
- for (i = 0; i < SEG_LVL_MAX; i++)
- {
- // For each of the segments id...
- for (j = 0; j < MAX_MB_SEGMENTS; j++)
-#endif
+ for (j = 0; j < SEG_LVL_MAX; j++)
{
- Data = xd->segment_feature_data[j][i];
+ Data = get_segdata( xd, i, j );
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// If the feature is enabled...
- if ( segfeature_active( xd, j, i ) )
-#else
- // If the feature is enabled...Indicated by non zero
- // value in VP8
- if (Data)
-#endif
+ if ( segfeature_active( xd, i, j ) )
{
vp8_write_bit(bc, 1);
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Is the segment data signed..
- if ( is_segfeature_signed(i) )
-#else
- if ( 1 )
-#endif
+ if ( is_segfeature_signed(j) )
{
// Encode the relevant feature data
if (Data < 0)
@@ -2088,13 +2052,13 @@
{
Data = - Data;
vp8_write_literal(bc, Data,
- mb_feature_data_bits[i]);
+ seg_feature_data_bits(j));
vp8_write_bit(bc, 1);
}
else
{
vp8_write_literal(bc, Data,
- mb_feature_data_bits[i]);
+ seg_feature_data_bits(j));
vp8_write_bit(bc, 0);
}
}
@@ -2101,7 +2065,7 @@
// Unsigned data element so no sign bit needed
else
vp8_write_literal(bc, Data,
- mb_feature_data_bits[i]);
+ seg_feature_data_bits(j));
}
else
vp8_write_bit(bc, 0);
--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -46,9 +46,8 @@
int src;
int src_stride;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
int eob_max_offset;
-#endif
} BLOCK;
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -31,9 +31,8 @@
#include "vp8/common/subpixel.h"
#include "vpx_ports/vpx_timer.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
//#define DBG_PRNT_SEGMAP 1
-#endif
#if CONFIG_RUNTIME_CPU_DETECT
#define RTCD(x) &cpi->common.rtcd.x
@@ -846,7 +845,7 @@
#endif
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// debug output
#if DBG_PRNT_SEGMAP
{
@@ -856,7 +855,6 @@
fclose(statsfile);
}
#endif
-#endif
}
void init_encode_frame_mb_context(VP8_COMP *cpi)
@@ -967,7 +965,7 @@
int totalrate;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// debug output
#if DBG_PRNT_SEGMAP
{
@@ -977,7 +975,6 @@
fclose(statsfile);
}
#endif
-#endif
vpx_memset(segment_counts, 0, sizeof(segment_counts));
totalrate = 0;
@@ -1350,7 +1347,7 @@
cpi->prob_gf_coded = 1;
}
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
else
{
// Trap case where cpi->count_mb_ref_frame_usage[] blank.
@@ -1358,7 +1355,6 @@
cpi->prob_last_coded = 128;
cpi->prob_gf_coded = 128;
}
-#endif
}
#if 0
// Keep record of the total distortion this time around for future use
@@ -1661,7 +1657,7 @@
vp8cx_mb_init_quantizer(cpi, x);
}
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
else
{
//segfeature_test_function(cpi, xd);
@@ -1680,7 +1676,6 @@
}
#endif
}
-#endif
}
{
@@ -1711,8 +1706,7 @@
vp8_update_zbin_extra(cpi, x);
}
-#if CONFIG_SEGFEATURES
-
+//#if CONFIG_SEGFEATURES
// If we have just a single reference frame coded for a segment then
// exclude from the reference frame counts used to work out
// probabilities. NOTE: At the moment we dont support custom trees
@@ -1726,9 +1720,6 @@
{
cpi->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame]++;
}
-#else
- cpi->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
-#endif
#if CONFIG_T8X8
if (xd->segmentation_enabled)
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -356,9 +356,8 @@
z->block[i].src = x->block[i].src;
*/
z->block[i].src_stride = x->block[i].src_stride;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
z->block[i].eob_max_offset = x->block[i].eob_max_offset;
-#endif
}
{
@@ -397,11 +396,10 @@
xd->segment_feature_data,
sizeof(xd->segment_feature_data));
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
vpx_memcpy(zd->segment_feature_mask,
xd->segment_feature_mask,
sizeof(xd->segment_feature_mask));
-#endif
for (i = 0; i < 25; i++)
{
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -34,10 +34,9 @@
#include "vpx_ports/vpx_timer.h"
#include "temporal_filter.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
#include "mbgraph.h"
-#endif
#if ARCH_ARM
#include "vpx_ports/arm.h"
@@ -338,9 +337,8 @@
vpx_memset(xd->mb_segment_tree_probs, 255, sizeof(xd->mb_segment_tree_probs));
vpx_memset(xd->segment_feature_data, 0, sizeof(xd->segment_feature_data));
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
vpx_memset(xd->segment_feature_mask, 0, sizeof(xd->segment_feature_mask));
-#endif
xd->mode_ref_lf_delta_enabled = 0;
xd->mode_ref_lf_delta_update = 0;
@@ -458,10 +456,9 @@
feature_data[SEG_LVL_ALT_LF][2] = 0;
feature_data[SEG_LVL_ALT_LF][3] = 0;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Enable features as required
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
-#endif
// Initialise the feature data structure
// SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
@@ -474,7 +471,7 @@
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
static void init_seg_features(VP8_COMP *cpi)
{
VP8_COMMON *cm = &cpi->common;
@@ -656,8 +653,6 @@
fclose(statsfile);
}
-#endif
-
// A simple function to cyclically refresh the background at a lower Q
static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment)
{
@@ -741,11 +736,10 @@
feature_data[SEG_LVL_ALT_LF][2] = 0;
feature_data[SEG_LVL_ALT_LF][3] = 0;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Enable the loop and quant changes in the feature mask
enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
-#endif
// Initialise the feature data structure
// SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
@@ -2133,7 +2127,7 @@
}
#endif
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
for (i = 0; i < ( sizeof(cpi->mbgraph_stats) /
sizeof(cpi->mbgraph_stats[0]) ); i++)
{
@@ -2142,7 +2136,6 @@
sizeof(*cpi->mbgraph_stats[i].mb_stats),
1));
}
-#endif
// Should we use the cyclic refresh method.
// Currently this is tied to error resilliant mode
@@ -2598,12 +2591,11 @@
vpx_free(cpi->tok);
vpx_free(cpi->cyclic_refresh_map);
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
for (i = 0; i < sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0]); i++)
{
vpx_free(cpi->mbgraph_stats[i].mb_stats);
}
-#endif
vp8_remove_common(&cpi->common);
vpx_free(cpi);
@@ -3698,14 +3690,9 @@
cpi->mb.e_mbd.segmentation_enabled = 1;
cpi->mb.e_mbd.update_mb_segmentation_map = 1;
#else
- #if CONFIG_SEGFEATURES
- // Test code for new segment features
- init_seg_features( cpi );
- #else
- // Set default state for segment update flags
- cpi->mb.e_mbd.update_mb_segmentation_map = 0;
- cpi->mb.e_mbd.update_mb_segmentation_data = 0;
- #endif
+//#if CONFIG_SEGFEATURES
+ // Test code for new segment features
+ init_seg_features( cpi );
#endif
if (cpi->drop_frames_allowed)
@@ -4712,12 +4699,11 @@
#endif
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#if 0
// Debug stats for segment feature experiments.
print_seg_map(cpi);
#endif
-#endif
// If this was a kf or Gf note the Q
if ((cm->frame_type == KEY_FRAME) || cm->refresh_golden_frame || cm->refresh_alt_ref_frame)
@@ -5445,7 +5431,7 @@
cpi->segment_encode_breakout[2] = threshold[2];
cpi->segment_encode_breakout[3] = threshold[3];
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Enable the loop and quant changes in the feature mask
for ( i = 0; i < 4; i++ )
{
@@ -5459,7 +5445,6 @@
else
disable_segfeature(xd, i, SEG_LVL_ALT_LF);
}
-#endif
// Initialise the feature data structure
// SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -27,9 +27,8 @@
#include "rdopt.h"
#include "vpx_mem/vpx_mem.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#if CONFIG_RUNTIME_CPU_DETECT
#define IF_RTCD(x) (x)
@@ -521,7 +520,7 @@
this_mode = vp8_mode_order[mode_index];
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Experimental use of Segment features.
if ( xd->segmentation_enabled && !cm->refresh_alt_ref_frame )
{
@@ -542,7 +541,9 @@
continue;
}
}
-#else
+
+//#if !CONFIG_SEGFEATURES
+ /* TBD PGW
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
// unless ARNR filtering is enabled in which case we want
// an unfiltered alternative
@@ -552,27 +553,7 @@
x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
continue;
}
-
- // Check to see if the testing frequency for this mode is at its max
- // If so then prevent it from being tested and increase the threshold for its testing
- if (cpi->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1))
- {
- //if ( (cpi->mbs_tested_so_far / cpi->mode_test_hit_counts[mode_index]) <= cpi->mode_check_freq[mode_index] )
- if (cpi->mbs_tested_so_far <= (cpi->mode_check_freq[mode_index] * cpi->mode_test_hit_counts[mode_index]))
- {
- // Increase the threshold for coding this mode to make it less likely to be chosen
- cpi->rd_thresh_mult[mode_index] += 4;
-
- if (cpi->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- cpi->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
-
- cpi->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * cpi->rd_thresh_mult[mode_index];
-
- continue;
- }
- }
-#endif
-
+*/
// We have now reached the point where we are going to test the current mode so increment the counter for the number of times it has been tested
cpi->mode_test_hit_counts[mode_index] ++;
--- a/vp8/encoder/quantize.c
+++ b/vp8/encoder/quantize.c
@@ -16,9 +16,8 @@
#include "quantize.h"
#include "vp8/common/quant_common.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#ifdef ENC_DEBUG
extern int enc_debug;
@@ -136,11 +135,8 @@
eob = -1;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
for (i = 0; i < b->eob_max_offset; i++)
-#else
- for (i = 0; i < 16; i++)
-#endif
{
rc = vp8_default_zig_zag1d[i];
z = coeff_ptr[rc];
@@ -1178,11 +1174,8 @@
int segment_id = xd->mode_info_context->mbmi.segment_id;
// Select the baseline MB Q index allowing for any segment level change.
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if ( segfeature_active( xd, segment_id, SEG_LVL_ALT_Q ) )
-#else
- if ( xd->segmentation_enabled )
-#endif
{
// Abs Value
if (xd->mb_segement_abs_delta == SEGMENT_ABSDATA)
@@ -1217,17 +1210,16 @@
x->e_mbd.block[i].dequant = cpi->common.Y1dequant[QIndex];
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_y1[QIndex];
x->block[i].zbin_extra = (short)zbin_extra;
-#if CONFIG_SEGFEATURES
- // Segment max eob offset feature.
- if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
- {
- x->block[i].eob_max_offset =
- xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+//#if CONFIG_SEGFEATURES
+ // Segment max eob offset feature.
+ if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
+ {
+ x->block[i].eob_max_offset =
+ xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ }
+ else
+ x->block[i].eob_max_offset = 16;
}
- else
- x->block[i].eob_max_offset = 16;
-#endif
- }
// UV
zbin_extra = ( cpi->common.UVdequant[QIndex][1] *
@@ -1245,17 +1237,16 @@
x->e_mbd.block[i].dequant = cpi->common.UVdequant[QIndex];
x->block[i].zrun_zbin_boost = cpi->zrun_zbin_boost_uv[QIndex];
x->block[i].zbin_extra = (short)zbin_extra;
-#if CONFIG_SEGFEATURES
- // Segment max eob offset feature.
- if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
- {
- x->block[i].eob_max_offset =
- xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+//#if CONFIG_SEGFEATURES
+ // Segment max eob offset feature.
+ if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
+ {
+ x->block[i].eob_max_offset =
+ xd->segment_feature_data[segment_id][SEG_LVL_EOB];
+ }
+ else
+ x->block[i].eob_max_offset = 16;
}
- else
- x->block[i].eob_max_offset = 16;
-#endif
- }
// Y2
zbin_extra = ( cpi->common.Y2dequant[QIndex][1] *
@@ -1272,7 +1263,7 @@
x->block[24].zrun_zbin_boost = cpi->zrun_zbin_boost_y2[QIndex];
x->block[24].zbin_extra = (short)zbin_extra;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// TBD perhaps not use for Y2
// Segment max eob offset feature.
if ( segfeature_active( xd, segment_id, SEG_LVL_EOB ) )
@@ -1282,7 +1273,6 @@
}
else
x->block[24].eob_max_offset = 16;
-#endif
/* save this macroblock QIndex for vp8_update_zbin_extra() */
x->q_index = QIndex;
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -36,9 +36,8 @@
#include "dct.h"
#include "vp8/common/systemdependent.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
#if CONFIG_RUNTIME_CPU_DETECT
#define IF_RTCD(x) (x)
@@ -2124,7 +2123,7 @@
x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
x->e_mbd.mode_info_context->mbmi.ref_frame = vp8_ref_frame_order[mode_index];
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// Experimental use of Segment features.
if ( xd->segmentation_enabled && !cm->refresh_alt_ref_frame )
{
@@ -2145,7 +2144,9 @@
continue;
}
}
-#else
+//#if !CONFIG_SEGFEATURES
+ // TBD PGW
+ /*
// Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
// unless ARNR filtering is enabled in which case we want
// an unfiltered alternative
@@ -2154,8 +2155,7 @@
if (this_mode != ZEROMV ||
x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
continue;
- }
-#endif
+ }*/
/* everything but intra */
if (x->e_mbd.mode_info_context->mbmi.ref_frame)
@@ -2169,29 +2169,6 @@
vpx_memcpy(mdcounts, frame_mdcounts[x->e_mbd.mode_info_context->mbmi.ref_frame], sizeof(mdcounts));
lf_or_gf = frame_lf_or_gf[x->e_mbd.mode_info_context->mbmi.ref_frame];
}
-
-#if !CONFIG_SEGFEATURES
- // Check to see if the testing frequency for this mode is at its max
- // If so then prevent it from being tested and increase the threshold for its testing
- if (cpi->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1))
- {
- if (cpi->mbs_tested_so_far <= cpi->mode_check_freq[mode_index] * cpi->mode_test_hit_counts[mode_index])
- {
- // Increase the threshold for coding this mode to make it less likely to be chosen
- cpi->rd_thresh_mult[mode_index] += 4;
-
- if (cpi->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- cpi->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
-
- cpi->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * cpi->rd_thresh_mult[mode_index];
-
- continue;
- }
- }
-
- // We have now reached the point where we are going to test the current mode so increment the counter for the number of times it has been tested
- cpi->mode_test_hit_counts[mode_index] ++;
-#endif
// Experimental code. Special case for gf and arf zeromv modes. Increase zbin size to supress noise
if (cpi->zbin_mode_boost_enabled)
--- a/vp8/encoder/segmentation.c
+++ b/vp8/encoder/segmentation.c
@@ -109,10 +109,8 @@
vpx_memcpy(cpi->mb.e_mbd.segment_feature_data, feature_data,
sizeof(cpi->mb.e_mbd.segment_feature_data));
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// TBD ?? Set the feature mask
// vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0,
// sizeof(cpi->mb.e_mbd.segment_feature_mask));
-#endif
-
}
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -17,9 +17,8 @@
#include "tokenize.h"
#include "vpx_mem/vpx_mem.h"
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
#include "vp8/common/seg_common.h"
-#endif
/* Global event counters used for accumulating statistics across several
compressions, then generating context.c = initial stats. */
@@ -185,7 +184,7 @@
ENTROPY_CONTEXT * l;
int band, rc, v, token;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
int seg_eob = 16;
int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -193,7 +192,6 @@
{
seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
}
-#endif
b = xd->block + 24;
qcoeff_ptr = b->qcoeff;
@@ -222,11 +220,8 @@
t++;
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if (c < seg_eob)
-#else
- if (c < 16)
-#endif
{
band = vp8_coef_bands[c];
t->Token = DCT_EOB_TOKEN;
@@ -325,7 +320,7 @@
int band, rc, v;
int tmp1, tmp2;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
int seg_eob = 16;
int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -333,7 +328,6 @@
{
seg_eob = xd->segment_feature_data[segment_id][SEG_LVL_EOB];
}
-#endif
b = xd->block;
/* Luma */
@@ -370,11 +364,8 @@
t++;
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if (c < seg_eob)
-#else
- if (c < 16)
-#endif
{
band = vp8_coef_bands[c];
t->Token = DCT_EOB_TOKEN;
@@ -422,11 +413,8 @@
pt = vp8_prev_token_class[token];
t++;
}
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
if (c < seg_eob)
-#else
- if (c < 16)
-#endif
{
band = vp8_coef_bands[c];
t->Token = DCT_EOB_TOKEN;
@@ -491,7 +479,7 @@
int has_y2_block;
int b;
-#if CONFIG_SEGFEATURES
+//#if CONFIG_SEGFEATURES
// If the MB is going to be skipped because of a segment level flag
// exclude this from the skip count stats used to calculate the
// transmitted skip probability;
@@ -505,9 +493,6 @@
}
else
skip_inc = 0;
-#else
- int skip_inc = 1;
-#endif
has_y2_block = (x->mode_info_context->mbmi.mode != B_PRED
#if CONFIG_I8X8
--- a/vp8/encoder/x86/x86_csystemdependent.c
+++ b/vp8/encoder/x86/x86_csystemdependent.c
@@ -217,9 +217,9 @@
cpi->rtcd.encodemb.submby = vp8_subtract_mby_sse2;
cpi->rtcd.encodemb.submbuv = vp8_subtract_mbuv_sse2;
-#if !CONFIG_SEGFEATURES
- cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse2;
-#endif
+//#if !CONFIG_SEGFEATURES
+// cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse2;
+//#endif
cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_sse2;
#if !(CONFIG_REALTIME_ONLY)
@@ -281,9 +281,9 @@
cpi->rtcd.variance.sad4x4x8 = vp8_sad4x4x8_sse4;
cpi->rtcd.search.full_search = vp8_full_search_sadx8;
-#if !CONFIG_SEGFEATURES
- cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse4;
-#endif
+//#if !CONFIG_SEGFEATURES
+// cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse4;
+//#endif
}
#endif