*/
#ifndef VP9_COMMON_VP9_COEFUPDATEPROBS_H_
-#define VP9_COMMON_VP9_COEFUPDATEPROBS_H__
+#define VP9_COMMON_VP9_COEFUPDATEPROBS_H_
/* Update probabilities for the nodes in the token entropy tree.
Generated file included by vp9_entropy.c */
#ifndef VP9_COMMON_VP9_COMMON_H_
#define VP9_COMMON_VP9_COMMON_H_
-#include <assert.h>
-#include "vpx_config.h"
/* Interface header for common constant data structures and lookup tables */
+#include <assert.h>
+
+#include "./vpx_config.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx/vpx_integer.h"
*/
#include <stdio.h>
+
#include "vp9/common/vp9_blockd.h"
void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
int mb_index = 0;
FILE *mvs = fopen("mvs.stt", "a");
- /* print out the macroblock Y modes */
- mb_index = 0;
+ // Print out the macroblock Y modes
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
for (mb_row = 0; mb_row < rows; mb_row++) {
*/
+#include <limits.h>
+
#include "vp9/common/vp9_findnearmv.h"
#include "vp9/common/vp9_sadmxn.h"
#include "vp9/common/vp9_subpelvar.h"
-#include <limits.h>
const uint8_t vp9_mbsplit_offset[4][16] = {
{ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
- vp9_prob p[4], const int context
- ) {
+ vp9_prob p[4], const int context) {
p[0] = pc->fc.vp9_mode_contexts[context][0];
p[1] = pc->fc.vp9_mode_contexts[context][1];
p[2] = pc->fc.vp9_mode_contexts[context][2];
#include "vp9/common/vp9_treecoder.h"
#include "vp9/common/vp9_onyxc_int.h"
+#define LEFT_TOP_MARGIN (16 << 3)
+#define RIGHT_BOTTOM_MARGIN (16 << 3)
+
/* check a list of motion vectors by sad score using a number rows of pixels
* above and a number cols of pixels in the left to select the one with best
* score to use as ref motion vector
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
int_mv *mvp, const int *ref_frame_sign_bias) {
- MV xmv;
- xmv = mvp->as_mv;
+ MV xmv = mvp->as_mv;
if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
xmv.row *= -1;
mvp->as_mv = xmv;
}
-#define LEFT_TOP_MARGIN (16 << 3)
-#define RIGHT_BOTTOM_MARGIN (16 << 3)
static void clamp_mv(int_mv *mv,
int mb_to_left_edge,
int mb_to_right_edge,
int mb_to_top_edge,
int mb_to_bottom_edge) {
- return (mv->as_mv.col < mb_to_left_edge) ||
- (mv->as_mv.col > mb_to_right_edge) ||
- (mv->as_mv.row < mb_to_top_edge) ||
- (mv->as_mv.row > mb_to_bottom_edge);
+ return mv->as_mv.col < mb_to_left_edge ||
+ mv->as_mv.col > mb_to_right_edge ||
+ mv->as_mv.row < mb_to_top_edge ||
+ mv->as_mv.row > mb_to_bottom_edge;
}
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
if (!xd->left_available)
return 0;
- /* On L edge, get from MB to left of us */
+ // On L edge, get from MB to left of us
--cur_mb;
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.mv[0].as_int;
+
b += 4;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-extern unsigned int vp9_sad16x16_sse3(
- unsigned char *src_ptr,
- int src_stride,
- unsigned char *ref_ptr,
- int ref_stride,
- int max_err);
-extern void vp9_sad16x16x3_sse3(
+unsigned int vp9_sad16x16_sse3(
unsigned char *src_ptr,
int src_stride,
unsigned char *ref_ptr,
int ref_stride,
- int *results);
+ int max_err);
-extern int vp8_growmaskmb_sse3(
+int vp8_growmaskmb_sse3(
unsigned char *om,
unsigned char *nm);
-extern void vp8_makemask_sse3(
+void vp8_makemask_sse3(
unsigned char *y,
unsigned char *u,
unsigned char *v,
for (i = 0; i < 256; i++)
ym[i] = nym[i];
}
+
void make_mb_mask(unsigned char *y, unsigned char *u, unsigned char *v,
unsigned char *ym, unsigned char *uvm,
int yp, int uvp,
return sad;
}
+
int unmasked_sad(unsigned char *src, int p, unsigned char *dst, int dp,
unsigned char *ym) {
int i, j;
return sad;
}
+
int masked_motion_search(unsigned char *y, unsigned char *u, unsigned char *v,
int yp, int uvp,
unsigned char *dy, unsigned char *du, unsigned char *dv,
}
fclose(f);
fclose(g);
- return;
+ return 0;
}
int mv_stride,
uint8_t **base,
uint8_t **base2,
- int Stride,
+ int stride,
int offset,
BLOCKSET bs) {
if (bs == DEST) {
- b->dst_stride = Stride;
+ b->dst_stride = stride;
b->dst = offset;
b->base_dst = base;
} else {
- b->pre_stride = Stride;
+ b->pre_stride = stride;
b->pre = offset;
b->base_pre = base;
b->base_second_pre = base2;
#include "vp9/common/vp9_mvref_common.h"
#define MVREF_NEIGHBOURS 8
+
static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {-1, -1}, {0, -2},
{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
};
+
static int mb_ref_distance_weight[MVREF_NEIGHBOURS] =
{ 3, 3, 2, 1, 1, 1, 1, 1 };
+
static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
{-1, -1}, {0, -2}, {-2, 0}, {-1, -2}
};
+
static int sb_ref_distance_weight[MVREF_NEIGHBOURS] =
{ 3, 3, 2, 2, 2, 1, 1, 1 };
// clamp_mv_ref
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
-static void clamp_mv_ref(const MACROBLOCKD *xd, int_mv *mv) {
+static void clamp_mv_ref(const MACROBLOCKD *xd, int_mv *mv) {
if (mv->as_mv.col < (xd->mb_to_left_edge - MV_BORDER))
mv->as_mv.col = xd->mb_to_left_edge - MV_BORDER;
else if (mv->as_mv.col > xd->mb_to_right_edge + MV_BORDER)
// Gets a candidate refenence motion vector from the given mode info
// structure if one exists that matches the given reference frame.
-static int get_matching_candidate(
- const MODE_INFO *candidate_mi,
+static int get_matching_candidate(const MODE_INFO *candidate_mi,
MV_REFERENCE_FRAME ref_frame,
- int_mv *c_mv
-) {
+ int_mv *c_mv) {
int ret_val = TRUE;
if (ref_frame == candidate_mi->mbmi.ref_frame) {
#define VP9_COMMON_VP9_POSTPROC_H_
#include "vpx_ports/mem.h"
+
struct postproc_state {
- int last_q;
- int last_noise;
- char noise[3072];
+ int last_q;
+ int last_noise;
+ char noise[3072];
DECLARE_ALIGNED(16, char, blackclamp[16]);
DECLARE_ALIGNED(16, char, whiteclamp[16]);
DECLARE_ALIGNED(16, char, bothclamp[16]);
};
+
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_ppflags.h"
+
int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
vp9_ppflags_t *flags);
+void vp9_de_noise(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
+ int q, int low_var_thresh, int flag);
-void vp9_de_noise(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag);
-
-void vp9_deblock(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
- int flag);
+void vp9_deblock(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
+ int q, int low_var_thresh, int flag);
#endif // VP9_COMMON_VP9_POSTPROC_H_
#ifdef __INTEL_COMPILER
#pragma warning(disable:997 1011 170)
#endif
+
#ifdef _MSC_VER
#pragma warning(disable:4799)
#endif
pred_context += (m - 1)->mbmi.seg_id_predicted;
break;
-
case PRED_REF:
pred_context = (m - cm->mode_info_stride)->mbmi.ref_predicted;
if (xd->left_available)
break;
default:
- // TODO *** add error trap code.
- pred_context = 0;
+ pred_context = 0; // *** add error trap code.
break;
}
vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
const MACROBLOCKD *const xd,
PRED_ID pred_id) {
- vp9_prob pred_probability;
- int pred_context;
-
- // Get the appropriate prediction context
- pred_context = vp9_get_pred_context(cm, xd, pred_id);
+ const int pred_context = vp9_get_pred_context(cm, xd, pred_id);
switch (pred_id) {
case PRED_SEG_ID:
- pred_probability = cm->segment_pred_probs[pred_context];
- break;
-
+ return cm->segment_pred_probs[pred_context];
case PRED_REF:
- pred_probability = cm->ref_pred_probs[pred_context];
- break;
-
+ return cm->ref_pred_probs[pred_context];
case PRED_COMP:
// In keeping with convention elsewhre the probability returned is
// the probability of a "0" outcome which in this case means the
// probability of comp pred off.
- pred_probability = cm->prob_comppred[pred_context];
- break;
-
+ return cm->prob_comppred[pred_context];
case PRED_MBSKIP:
- pred_probability = cm->mbskip_pred_probs[pred_context];
- break;
-
+ return cm->mbskip_pred_probs[pred_context];
default:
- // TODO *** add error trap code.
- pred_probability = 128;
- break;
+ return 128; // *** add error trap code.
}
-
- return pred_probability;
}
// This function returns a context probability ptr for coding a given
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
const MACROBLOCKD *const xd,
PRED_ID pred_id) {
- const vp9_prob *pred_probability;
- int pred_context;
-
- // Get the appropriate prediction context
- pred_context = vp9_get_pred_context(cm, xd, pred_id);
+ const int pred_context = vp9_get_pred_context(cm, xd, pred_id);
switch (pred_id) {
case PRED_SEG_ID:
- pred_probability = &cm->segment_pred_probs[pred_context];
- break;
-
+ return &cm->segment_pred_probs[pred_context];
case PRED_REF:
- pred_probability = &cm->ref_pred_probs[pred_context];
- break;
-
+ return &cm->ref_pred_probs[pred_context];
case PRED_COMP:
// In keeping with convention elsewhre the probability returned is
// the probability of a "0" outcome which in this case means the
// probability of comp pred off.
- pred_probability = &cm->prob_comppred[pred_context];
- break;
-
+ return &cm->prob_comppred[pred_context];
case PRED_MBSKIP:
- pred_probability = &cm->mbskip_pred_probs[pred_context];
- break;
-
+ return &cm->mbskip_pred_probs[pred_context];
case PRED_SWITCHABLE_INTERP:
- pred_probability = &cm->fc.switchable_interp_prob[pred_context][0];
- break;
-
+ return &cm->fc.switchable_interp_prob[pred_context][0];
default:
- // TODO *** add error trap code.
- pred_probability = NULL;
- break;
+ return NULL; // *** add error trap code.
}
-
- return pred_probability;
}
// This function returns the status of the given prediction signal.
// I.e. is the predicted value for the given signal correct.
unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
PRED_ID pred_id) {
- unsigned char pred_flag = 0;
-
switch (pred_id) {
case PRED_SEG_ID:
- pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
- break;
-
+ return xd->mode_info_context->mbmi.seg_id_predicted;
case PRED_REF:
- pred_flag = xd->mode_info_context->mbmi.ref_predicted;
- break;
-
+ return xd->mode_info_context->mbmi.ref_predicted;
case PRED_MBSKIP:
- pred_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
- break;
-
+ return xd->mode_info_context->mbmi.mb_skip_coeff;
default:
- // TODO *** add error trap code.
- pred_flag = 0;
- break;
+ return 0; // *** add error trap code.
}
-
- return pred_flag;
}
// This function sets the status of the given prediction signal.
break;
default:
- // TODO *** add error trap code.
+ // *** add error trap code.
break;
}
}
MV_REFERENCE_FRAME pred_ref = LAST_FRAME;
int segment_id = xd->mode_info_context->mbmi.segment_id;
- int seg_ref_active;
int i;
unsigned char frame_allowed[MAX_REF_FRAMES] = {1, 1, 1, 1};
unsigned char above_left_in_image;
// Is segment coding ennabled
- seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
+ int seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
// Special case treatment if segment coding is enabled.
// Dont allow prediction of a reference frame that the segment
// Functions to computes a set of modified reference frame probabilities
// to use when the prediction of the reference frame value fails
void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
- int tot_count;
-
- tot_count = count[0] + count[1] + count[2] + count[3];
+ int tot_count = count[0] + count[1] + count[2] + count[3];
probs[0] = get_prob(count[0], tot_count);
tot_count -= count[0];
// they are not allowed for a given segment.
void vp9_compute_mod_refprobs(VP9_COMMON *const cm) {
int norm_cnt[MAX_REF_FRAMES];
- int intra_count;
- int inter_count;
- int last_count;
- int gfarf_count;
- int gf_count;
- int arf_count;
-
- intra_count = cm->prob_intra_coded;
- inter_count = (255 - intra_count);
- last_count = (inter_count * cm->prob_last_coded) / 255;
- gfarf_count = inter_count - last_count;
- gf_count = (gfarf_count * cm->prob_gf_coded) / 255;
- arf_count = gfarf_count - gf_count;
+ const int intra_count = cm->prob_intra_coded;
+ const int inter_count = (255 - intra_count);
+ const int last_count = (inter_count * cm->prob_last_coded) / 255;
+ const int gfarf_count = inter_count - last_count;
+ const int gf_count = (gfarf_count * cm->prob_gf_coded) / 255;
+ const int arf_count = gfarf_count - gf_count;
// Work out modified reference frame probabilities to use where prediction
// of the reference frame fails
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "vp9/common/vp9_onyxc_int.h"
-#include "vp9/common/vp9_blockd.h"
-
#ifndef VP9_COMMON_VP9_PRED_COMMON_H_
#define VP9_COMMON_VP9_PRED_COMMON_H_
+#include "vp9/common/vp9_blockd.h"
+#include "vp9/common/vp9_onyxc_int.h"
// Predicted items
typedef enum {
- PRED_SEG_ID = 0, // Segment identifier
+ PRED_SEG_ID = 0, // Segment identifier
PRED_REF = 1,
PRED_COMP = 2,
PRED_MBSKIP = 3,
PRED_SWITCHABLE_INTERP = 4
} PRED_ID;
-extern unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
- const MACROBLOCKD *const xd,
- PRED_ID pred_id);
+unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
+ const MACROBLOCKD *const xd,
+ PRED_ID pred_id);
+
+vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
+ const MACROBLOCKD *const xd,
+ PRED_ID pred_id);
-extern vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
- const MACROBLOCKD *const xd,
- PRED_ID pred_id);
+const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
+ const MACROBLOCKD *const xd,
+ PRED_ID pred_id);
-extern const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
- const MACROBLOCKD *const xd,
- PRED_ID pred_id);
+unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
+ PRED_ID pred_id);
-extern unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
- PRED_ID pred_id);
+void vp9_set_pred_flag(MACROBLOCKD *const xd,
+ PRED_ID pred_id,
+ unsigned char pred_flag);
-extern void vp9_set_pred_flag(MACROBLOCKD *const xd,
- PRED_ID pred_id,
- unsigned char pred_flag);
+unsigned char vp9_get_pred_mb_segid(const VP9_COMMON *const cm,
+ const MACROBLOCKD *const xd,
+ int MbIndex);
-extern unsigned char vp9_get_pred_mb_segid(const VP9_COMMON *const cm,
- const MACROBLOCKD *const xd,
- int MbIndex);
+MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
+ const MACROBLOCKD *const xd);
-extern MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
- const MACROBLOCKD *const xd);
-extern void vp9_compute_mod_refprobs(VP9_COMMON *const cm);
+void vp9_compute_mod_refprobs(VP9_COMMON *const cm);
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
#include "vp9/common/vp9_tile_common.h"
+#define MIN_TILE_WIDTH 256
+#define MAX_TILE_WIDTH 4096
+#define MIN_TILE_WIDTH_SBS (MIN_TILE_WIDTH >> 6)
+#define MAX_TILE_WIDTH_SBS (MAX_TILE_WIDTH >> 6)
+
static void vp9_get_tile_offsets(VP9_COMMON *cm, int *min_tile_off,
int *max_tile_off, int tile_idx,
int log2_n_tiles, int n_mbs) {
cm->log2_tile_rows, cm->mb_rows);
}
-#define MIN_TILE_WIDTH_SBS (MIN_TILE_WIDTH >> 6)
-#define MAX_TILE_WIDTH_SBS (MAX_TILE_WIDTH >> 6)
void vp9_get_tile_n_bits(VP9_COMMON *cm, int *min_log2_n_tiles_ptr,
int *delta_log2_n_tiles) {
#include "vp9/common/vp9_onyxc_int.h"
-#define MIN_TILE_WIDTH 256
-#define MAX_TILE_WIDTH 4096
-
void vp9_get_tile_col_offsets(VP9_COMMON *cm, int tile_col_idx);
void vp9_get_tile_row_offsets(VP9_COMMON *cm, int tile_row_idx);
* be found in the AUTHORS file in the root of the source tree.
*/
-
-#include "vp9/decoder/vp9_dboolhuff.h"
#include "vpx_ports/mem.h"
#include "vpx_mem/vpx_mem.h"
+#include "vp9/decoder/vp9_dboolhuff.h"
+
int vp9_start_decode(BOOL_DECODER *br,
const unsigned char *source,
unsigned int source_sz) {
#include <stddef.h>
#include <limits.h>
+
#include "./vpx_config.h"
#include "vpx_ports/mem.h"
#include "vpx/vpx_integer.h"
*/
+#include <stdio.h>
+#include <assert.h>
+
#include "vp9/common/vp9_onyxc_int.h"
#if CONFIG_POSTPROC
#include "vp9/common/vp9_postproc.h"
#include "vp9/common/vp9_alloccommon.h"
#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_swapyv12buffer.h"
-#include <stdio.h>
-#include <assert.h>
#include "vp9/common/vp9_quant_common.h"
#include "vpx_scale/vpx_scale.h"
}
#endif
-void vp9_initialize_dec(void) {
+void vp9_initialize_dec() {
static int init_done = 0;
if (!init_done) {
#define VP9_DECODER_VP9_TREEREADER_H_
#include "vp9/common/vp9_treecoder.h"
-
#include "vp9/decoder/vp9_dboolhuff.h"
typedef BOOL_DECODER vp9_reader;
#include "./vpx_config.h"
#include "vp9/encoder/vp9_block.h"
+#include "vp9/encoder/vp9_onyx_int.h"
typedef struct {
MB_PREDICTION_MODE mode;
} MODE_DEFINITION;
-#include "vp9/encoder/vp9_onyx_int.h"
struct VP9_ENCODER_RTCD;
void vp9_encode_inter16x16(MACROBLOCK *x, int mb_row, int mb_col);
#ifndef VPX_PORTS_MEM_H
#define VPX_PORTS_MEM_H
+
#include "vpx_config.h"
#include "vpx/vpx_integer.h"