summaryrefslogtreecommitdiff
path: root/vp9/common
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/common')
-rw-r--r--vp9/common/vp9_common.h5
-rw-r--r--vp9/common/vp9_debugmodes.c147
-rw-r--r--vp9/common/vp9_entropy.c26
-rw-r--r--vp9/common/vp9_entropy.h2
-rw-r--r--vp9/common/vp9_entropymode.c10
-rw-r--r--vp9/common/vp9_entropymode.h3
-rw-r--r--vp9/common/vp9_header.h39
-rw-r--r--vp9/common/vp9_modecont.h2
-rw-r--r--vp9/common/vp9_onyxc_int.h4
-rw-r--r--vp9/common/vp9_reconintra.c2
10 files changed, 24 insertions, 216 deletions
diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h
index b6252d93e..5c97f9863 100644
--- a/vp9/common/vp9_common.h
+++ b/vp9/common/vp9_common.h
@@ -60,4 +60,9 @@ static INLINE int multiple16(int value) {
return (value + 15) & ~15;
}
+#define SYNC_CODE_0 0x49
+#define SYNC_CODE_1 0x83
+#define SYNC_CODE_2 0x42
+
+
#endif // VP9_COMMON_VP9_COMMON_H_
diff --git a/vp9/common/vp9_debugmodes.c b/vp9/common/vp9_debugmodes.c
deleted file mode 100644
index 827e4bf84..000000000
--- a/vp9/common/vp9_debugmodes.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdio.h>
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_blockd.h"
-#include "vp9/common/vp9_tile_common.h"
-typedef struct {
- char *debug_array;
- int w;
- int h;
-} DEBUG_MODE_STRUCT;
-
-static void draw_rect(int r, int c, int w, int h, DEBUG_MODE_STRUCT *da) {
- int i;
- da->debug_array[r / 2 * da->w + c] = '+';
- for (i = r / 2 + 1; i < r / 2 + h / 2; i++) {
- da->debug_array[i * da->w + c] = '|';
- }
- for (i = c + 1; i < c + w; i++) {
- da->debug_array[r / 2 * da->w + i] = '-';
- }
-}
-static void debug_partitioning(VP9_COMMON * cm, MODE_INFO *m, int mi_row,
- int mi_col, BLOCK_SIZE_TYPE bsize,
- DEBUG_MODE_STRUCT *da) {
- const int mis = cm->mode_info_stride;
- int bwl, bhl;
- int bw, bh;
- int bsl = mi_width_log2(bsize), bs = (1 << bsl) / 2;
- int n;
- PARTITION_TYPE partition;
- BLOCK_SIZE_TYPE subsize;
-
- if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
- return;
-
- bwl = mi_width_log2(m->mbmi.sb_type);
- bhl = mi_height_log2(m->mbmi.sb_type);
- bw = 1 << bwl;
- bh = 1 << bhl;
-
- // parse the partition type
- if ((bwl == bsl) && (bhl == bsl))
- partition = PARTITION_NONE;
- else if ((bwl == bsl) && (bhl < bsl))
- partition = PARTITION_HORZ;
- else if ((bwl < bsl) && (bhl == bsl))
- partition = PARTITION_VERT;
- else if ((bwl < bsl) && (bhl < bsl))
- partition = PARTITION_SPLIT;
- else
- assert(0);
-
-#if CONFIG_AB4X4
- if (bsize == BLOCK_SIZE_SB8X8 && m->mbmi.sb_type < BLOCK_SIZE_SB8X8)
- partition = PARTITION_SPLIT;
- if (bsize < BLOCK_SIZE_SB8X8)
- return;
-#endif
-
-#if CONFIG_AB4X4
- if (bsize >= BLOCK_SIZE_SB8X8) {
-#else
- if (bsize > BLOCK_SIZE_SB8X8) {
-#endif
- }
-
- subsize = get_subsize(bsize, partition);
- switch (partition) {
- case PARTITION_NONE:
- draw_rect(mi_row * 8, mi_col * 8, bw * 8, bh * 8, da);
- break;
- case PARTITION_HORZ:
- draw_rect(mi_row * 8, mi_col * 8, bw * 8, bh * 8, da);
- if ((mi_row + bh) < cm->mi_rows)
- draw_rect(8 * bs + mi_row * 8, mi_col * 8, bw * 8, bh * 8, da);
- break;
- case PARTITION_VERT:
- draw_rect(mi_row * 8, mi_col * 8, bw * 8, bh * 8, da);
- if ((mi_col + bw) < cm->mi_cols)
- draw_rect(mi_row * 8, 8 * bs + mi_col * 8, bw * 8, bh * 8, da);
- break;
- case PARTITION_SPLIT:
- for (n = 0; n < 4; n++) {
- int j = n >> 1, i = n & 0x01;
- debug_partitioning(cm, m + j * bs * mis + i * bs, mi_row + j * bs,
- mi_col + i * bs, subsize, da);
- }
- break;
- default:
- assert(0);
- }
-}
-static void debug_partitionings(VP9_COMMON *c, DEBUG_MODE_STRUCT *da) {
- const int mis = c->mode_info_stride;
- MODE_INFO *m, *m_ptr = c->mi;
- int mi_row, mi_col;
-
- m_ptr += c->cur_tile_mi_col_start + c->cur_tile_mi_row_start * mis;
-
- for (mi_row = c->cur_tile_mi_row_start; mi_row < c->cur_tile_mi_row_end;
- mi_row += 8, m_ptr += 8 * mis) {
- m = m_ptr;
- for (mi_col = c->cur_tile_mi_col_start; mi_col < c->cur_tile_mi_col_end;
- mi_col += 8, m += 8) {
- debug_partitioning(c, m, mi_row, mi_col, BLOCK_SIZE_SB64X64, da);
- }
- }
-}
-void vp9_debug_tile_partitionings(VP9_COMMON *pc) {
- int tile_row, tile_col;
- DEBUG_MODE_STRUCT da;
-
- da.w = pc->width;
- da.h = pc->height / 2;
- da.debug_array = vpx_malloc(da.h * da.w);
- vpx_memset(da.debug_array, ' ', da.h * da.w);
- for (tile_row = 0; tile_row < pc->tile_rows; tile_row++) {
- vp9_get_tile_row_offsets(pc, tile_row);
- for (tile_col = 0; tile_col < pc->tile_columns; tile_col++) {
- vp9_get_tile_col_offsets(pc, tile_col);
-
- debug_partitionings(pc, &da);
- }
- }
- {
- FILE *f = fopen("partitionings.txt", "a");
- int i, j;
- fprintf(f, "\n\n\nFrame: %d \n", pc->current_video_frame);
- for (i = 0; i < da.h; i++) {
- for (j = 0; j < da.w; j++) {
- fprintf(f, "%c", da.debug_array[i * da.w + j]);
- }
- fprintf(f, "\n");
- }
- fclose(f);
- }
- vpx_free(da.debug_array);
-}
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c
index 1b7da6cd5..1ae35864c 100644
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -468,7 +468,7 @@ int vp9_get_coef_context(const int *scan, const int *neighbors,
} else {
ctx = token_cache[scan[neighbors[MAX_NEIGHBORS * c + 0]]];
}
- return vp9_pt_energy_class[ctx];
+ return ctx;
}
};
@@ -642,6 +642,17 @@ void vp9_coef_tree_initialize() {
#define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
+void vp9_full_to_model_count(unsigned int *model_count,
+ unsigned int *full_count) {
+ int n;
+ model_count[ZERO_TOKEN] = full_count[ZERO_TOKEN];
+ model_count[ONE_TOKEN] = full_count[ONE_TOKEN];
+ model_count[TWO_TOKEN] = full_count[TWO_TOKEN];
+ for (n = THREE_TOKEN; n < DCT_EOB_TOKEN; ++n)
+ model_count[TWO_TOKEN] += full_count[n];
+ model_count[DCT_EOB_MODEL_TOKEN] = full_count[DCT_EOB_TOKEN];
+}
+
void vp9_full_to_model_counts(
vp9_coeff_count_model *model_count, vp9_coeff_count *full_count) {
int i, j, k, l;
@@ -649,19 +660,10 @@ void vp9_full_to_model_counts(
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
- int n;
if (l >= 3 && k == 0)
continue;
- model_count[i][j][k][l][ZERO_TOKEN] =
- full_count[i][j][k][l][ZERO_TOKEN];
- model_count[i][j][k][l][ONE_TOKEN] =
- full_count[i][j][k][l][ONE_TOKEN];
- model_count[i][j][k][l][TWO_TOKEN] =
- full_count[i][j][k][l][TWO_TOKEN];
- for (n = THREE_TOKEN; n < DCT_EOB_TOKEN; ++n)
- model_count[i][j][k][l][TWO_TOKEN] += full_count[i][j][k][l][n];
- model_count[i][j][k][l][DCT_EOB_MODEL_TOKEN] =
- full_count[i][j][k][l][DCT_EOB_TOKEN];
+ vp9_full_to_model_count(model_count[i][j][k][l],
+ full_count[i][j][k][l]);
}
}
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index 5d57f149e..e76211a7c 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -174,6 +174,8 @@ typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS]
typedef unsigned int vp9_coeff_stats_model[REF_TYPES][COEF_BANDS]
[PREV_COEF_CONTEXTS]
[UNCONSTRAINED_NODES][2];
+extern void vp9_full_to_model_count(unsigned int *model_count,
+ unsigned int *full_count);
extern void vp9_full_to_model_counts(
vp9_coeff_count_model *model_count, vp9_coeff_count *full_count);
diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c
index 622f1dcf4..9c390dfd0 100644
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -141,13 +141,6 @@ const vp9_tree_index vp9_uv_mode_tree[VP9_UV_MODES * 2 - 2] = {
-H_PRED, -TM_PRED
};
-const vp9_tree_index vp9_mv_ref_tree[8] = {
- -ZEROMV, 2,
- -NEARESTMV, 4,
- -NEARMV, 6,
- -NEWMV, -SPLITMV
-};
-
const vp9_tree_index vp9_sb_mv_ref_tree[6] = {
-ZEROMV, 2,
-NEARESTMV, 4,
@@ -168,7 +161,6 @@ struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
struct vp9_token vp9_kf_ymode_encodings[VP9_YMODES];
struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
-struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
@@ -265,8 +257,6 @@ void vp9_entropy_mode_init() {
vp9_switchable_interp_tree);
vp9_tokens_from_tree(vp9_partition_encodings, vp9_partition_tree);
- vp9_tokens_from_tree_offset(vp9_mv_ref_encoding_array,
- vp9_mv_ref_tree, NEARESTMV);
vp9_tokens_from_tree_offset(vp9_sb_mv_ref_encoding_array,
vp9_sb_mv_ref_tree, NEARESTMV);
}
diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h
index 8fbc6f20e..7a83c702e 100644
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -29,9 +29,7 @@ extern const vp9_tree_index vp9_kf_ymode_tree[];
extern const vp9_tree_index vp9_uv_mode_tree[];
#define vp9_sb_ymode_tree vp9_uv_mode_tree
#define vp9_sb_kf_ymode_tree vp9_uv_mode_tree
-extern const vp9_tree_index vp9_mv_ref_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
-extern const vp9_tree_index vp9_sub_mv_ref_tree[];
extern struct vp9_token vp9_bmode_encodings[VP9_BINTRAMODES];
extern struct vp9_token vp9_kf_bmode_encodings[VP9_BINTRAMODES];
@@ -43,7 +41,6 @@ extern struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
/* Inter mode values do not start at zero */
-extern struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
extern struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
// probability models for partition information
diff --git a/vp9/common/vp9_header.h b/vp9/common/vp9_header.h
deleted file mode 100644
index 96b04e7d7..000000000
--- a/vp9/common/vp9_header.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef VP9_COMMON_VP9_HEADER_H_
-#define VP9_COMMON_VP9_HEADER_H_
-
-/* 24 bits total */
-typedef struct {
- unsigned int type: 1;
- unsigned int version: 3;
- unsigned int show_frame: 1;
-
- /* Allow 2^20 bytes = 8 megabits for first partition */
-
- unsigned int first_partition_length_in_bytes: 19;
-
-#ifdef PACKET_TESTING
- unsigned int frame_number;
- unsigned int update_gold: 1;
- unsigned int uses_gold: 1;
- unsigned int update_last: 1;
- unsigned int uses_last: 1;
-#endif
-} VP9_HEADER;
-
-#ifdef PACKET_TESTING
-#define VP9_HEADER_SIZE 8
-#else
-#define VP9_HEADER_SIZE 3
-#endif
-
-#endif // VP9_COMMON_VP9_HEADER_H_
diff --git a/vp9/common/vp9_modecont.h b/vp9/common/vp9_modecont.h
index 24f1a6cb3..30deb72d3 100644
--- a/vp9/common/vp9_modecont.h
+++ b/vp9/common/vp9_modecont.h
@@ -11,6 +11,8 @@
#ifndef VP9_COMMON_VP9_MODECONT_H_
#define VP9_COMMON_VP9_MODECONT_H_
+#include "vp9/common/vp9_entropy.h"
+
extern const int vp9_default_mode_contexts[INTER_MODE_CONTEXTS][4];
#endif // VP9_COMMON_VP9_MODECONT_H_
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index c277ea3cb..b148a6377 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -24,10 +24,6 @@
#include "vp9/common/vp9_postproc.h"
#endif
-/*#ifdef PACKET_TESTING*/
-#include "vp9/common/vp9_header.h"
-/*#endif*/
-
/* Create/destroy static data structures. */
void vp9_initialize_common(void);
diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c
index dd60a76c7..b1f327b43 100644
--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -402,7 +402,7 @@ void vp9_predict_intra_block(MACROBLOCKD *xd,
(block_idx >> bwl) || xd->up_available;
const int have_left =
(block_idx & wmask) || xd->left_available;
- const int have_right = ((block_idx & wmask) != wmask);
+ int have_right = ((block_idx & wmask) != wmask);
const int txfm_block_size = 4 << tx_size;
assert(bwl >= 0);