Code cleanup.
Removing redundant 'extern' keywords, fixing formatting and #include order, code simplification. Change-Id: I0e5fdc8009010f3f885f13b5d76859b9da511758
This commit is contained in:
parent
764be4f66f
commit
7f99c3c59a
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VP9_COMMON_VP9_COEFUPDATEPROBS_H_
|
#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.
|
/* Update probabilities for the nodes in the token entropy tree.
|
||||||
Generated file included by vp9_entropy.c */
|
Generated file included by vp9_entropy.c */
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
#ifndef VP9_COMMON_VP9_COMMON_H_
|
#ifndef VP9_COMMON_VP9_COMMON_H_
|
||||||
#define 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 */
|
/* 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_mem/vpx_mem.h"
|
||||||
#include "vpx/vpx_integer.h"
|
#include "vpx/vpx_integer.h"
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "vp9/common/vp9_blockd.h"
|
#include "vp9/common/vp9_blockd.h"
|
||||||
|
|
||||||
void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
||||||
@ -18,8 +19,7 @@ void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
|||||||
int mb_index = 0;
|
int mb_index = 0;
|
||||||
FILE *mvs = fopen("mvs.stt", "a");
|
FILE *mvs = fopen("mvs.stt", "a");
|
||||||
|
|
||||||
/* print out the macroblock Y modes */
|
// Print out the macroblock Y modes
|
||||||
mb_index = 0;
|
|
||||||
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
|
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
|
||||||
|
|
||||||
for (mb_row = 0; mb_row < rows; mb_row++) {
|
for (mb_row = 0; mb_row < rows; mb_row++) {
|
||||||
|
@ -9,10 +9,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "vp9/common/vp9_findnearmv.h"
|
#include "vp9/common/vp9_findnearmv.h"
|
||||||
#include "vp9/common/vp9_sadmxn.h"
|
#include "vp9/common/vp9_sadmxn.h"
|
||||||
#include "vp9/common/vp9_subpelvar.h"
|
#include "vp9/common/vp9_subpelvar.h"
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
const uint8_t vp9_mbsplit_offset[4][16] = {
|
const uint8_t vp9_mbsplit_offset[4][16] = {
|
||||||
{ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
@ -32,8 +33,7 @@ static void lower_mv_precision(int_mv *mv, int usehp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
|
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[0] = pc->fc.vp9_mode_contexts[context][0];
|
||||||
p[1] = pc->fc.vp9_mode_contexts[context][1];
|
p[1] = pc->fc.vp9_mode_contexts[context][1];
|
||||||
p[2] = pc->fc.vp9_mode_contexts[context][2];
|
p[2] = pc->fc.vp9_mode_contexts[context][2];
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
#include "vp9/common/vp9_treecoder.h"
|
#include "vp9/common/vp9_treecoder.h"
|
||||||
#include "vp9/common/vp9_onyxc_int.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
|
/* 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
|
* above and a number cols of pixels in the left to select the one with best
|
||||||
* score to use as ref motion vector
|
* score to use as ref motion vector
|
||||||
@ -30,8 +33,7 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
|
|||||||
|
|
||||||
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
|
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
|
||||||
int_mv *mvp, const int *ref_frame_sign_bias) {
|
int_mv *mvp, const int *ref_frame_sign_bias) {
|
||||||
MV xmv;
|
MV xmv = mvp->as_mv;
|
||||||
xmv = mvp->as_mv;
|
|
||||||
|
|
||||||
if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
|
if (refmb_ref_frame_sign_bias != ref_frame_sign_bias[refframe]) {
|
||||||
xmv.row *= -1;
|
xmv.row *= -1;
|
||||||
@ -41,8 +43,6 @@ static void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
|
|||||||
mvp->as_mv = xmv;
|
mvp->as_mv = xmv;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LEFT_TOP_MARGIN (16 << 3)
|
|
||||||
#define RIGHT_BOTTOM_MARGIN (16 << 3)
|
|
||||||
|
|
||||||
static void clamp_mv(int_mv *mv,
|
static void clamp_mv(int_mv *mv,
|
||||||
int mb_to_left_edge,
|
int mb_to_left_edge,
|
||||||
@ -72,10 +72,10 @@ static unsigned int check_mv_bounds(int_mv *mv,
|
|||||||
int mb_to_right_edge,
|
int mb_to_right_edge,
|
||||||
int mb_to_top_edge,
|
int mb_to_top_edge,
|
||||||
int mb_to_bottom_edge) {
|
int mb_to_bottom_edge) {
|
||||||
return (mv->as_mv.col < mb_to_left_edge) ||
|
return mv->as_mv.col < mb_to_left_edge ||
|
||||||
(mv->as_mv.col > mb_to_right_edge) ||
|
mv->as_mv.col > mb_to_right_edge ||
|
||||||
(mv->as_mv.row < mb_to_top_edge) ||
|
mv->as_mv.row < mb_to_top_edge ||
|
||||||
(mv->as_mv.row > mb_to_bottom_edge);
|
mv->as_mv.row > mb_to_bottom_edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
|
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
|
||||||
@ -90,11 +90,12 @@ static int left_block_mv(const MACROBLOCKD *xd,
|
|||||||
if (!xd->left_available)
|
if (!xd->left_available)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* On L edge, get from MB to left of us */
|
// On L edge, get from MB to left of us
|
||||||
--cur_mb;
|
--cur_mb;
|
||||||
|
|
||||||
if (cur_mb->mbmi.mode != SPLITMV)
|
if (cur_mb->mbmi.mode != SPLITMV)
|
||||||
return cur_mb->mbmi.mv[0].as_int;
|
return cur_mb->mbmi.mv[0].as_int;
|
||||||
|
|
||||||
b += 4;
|
b += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,25 +11,19 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
extern unsigned int vp9_sad16x16_sse3(
|
|
||||||
|
unsigned int vp9_sad16x16_sse3(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
int src_stride,
|
int src_stride,
|
||||||
unsigned char *ref_ptr,
|
unsigned char *ref_ptr,
|
||||||
int ref_stride,
|
int ref_stride,
|
||||||
int max_err);
|
int max_err);
|
||||||
|
|
||||||
extern void vp9_sad16x16x3_sse3(
|
int vp8_growmaskmb_sse3(
|
||||||
unsigned char *src_ptr,
|
|
||||||
int src_stride,
|
|
||||||
unsigned char *ref_ptr,
|
|
||||||
int ref_stride,
|
|
||||||
int *results);
|
|
||||||
|
|
||||||
extern int vp8_growmaskmb_sse3(
|
|
||||||
unsigned char *om,
|
unsigned char *om,
|
||||||
unsigned char *nm);
|
unsigned char *nm);
|
||||||
|
|
||||||
extern void vp8_makemask_sse3(
|
void vp8_makemask_sse3(
|
||||||
unsigned char *y,
|
unsigned char *y,
|
||||||
unsigned char *u,
|
unsigned char *u,
|
||||||
unsigned char *v,
|
unsigned char *v,
|
||||||
@ -238,6 +232,7 @@ void grow_ymask(unsigned char *ym) {
|
|||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
ym[i] = nym[i];
|
ym[i] = nym[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void make_mb_mask(unsigned char *y, unsigned char *u, unsigned char *v,
|
void make_mb_mask(unsigned char *y, unsigned char *u, unsigned char *v,
|
||||||
unsigned char *ym, unsigned char *uvm,
|
unsigned char *ym, unsigned char *uvm,
|
||||||
int yp, int uvp,
|
int yp, int uvp,
|
||||||
@ -283,6 +278,7 @@ int compare_masks(unsigned char *sym, unsigned char *ym) {
|
|||||||
|
|
||||||
return sad;
|
return sad;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unmasked_sad(unsigned char *src, int p, unsigned char *dst, int dp,
|
int unmasked_sad(unsigned char *src, int p, unsigned char *dst, int dp,
|
||||||
unsigned char *ym) {
|
unsigned char *ym) {
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -294,6 +290,7 @@ int unmasked_sad(unsigned char *src, int p, unsigned char *dst, int dp,
|
|||||||
|
|
||||||
return sad;
|
return sad;
|
||||||
}
|
}
|
||||||
|
|
||||||
int masked_motion_search(unsigned char *y, unsigned char *u, unsigned char *v,
|
int masked_motion_search(unsigned char *y, unsigned char *u, unsigned char *v,
|
||||||
int yp, int uvp,
|
int yp, int uvp,
|
||||||
unsigned char *dy, unsigned char *du, unsigned char *dv,
|
unsigned char *dy, unsigned char *du, unsigned char *dv,
|
||||||
@ -802,5 +799,5 @@ int mainz(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
fclose(g);
|
fclose(g);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,15 @@ static void setup_block(BLOCKD *b,
|
|||||||
int mv_stride,
|
int mv_stride,
|
||||||
uint8_t **base,
|
uint8_t **base,
|
||||||
uint8_t **base2,
|
uint8_t **base2,
|
||||||
int Stride,
|
int stride,
|
||||||
int offset,
|
int offset,
|
||||||
BLOCKSET bs) {
|
BLOCKSET bs) {
|
||||||
if (bs == DEST) {
|
if (bs == DEST) {
|
||||||
b->dst_stride = Stride;
|
b->dst_stride = stride;
|
||||||
b->dst = offset;
|
b->dst = offset;
|
||||||
b->base_dst = base;
|
b->base_dst = base;
|
||||||
} else {
|
} else {
|
||||||
b->pre_stride = Stride;
|
b->pre_stride = stride;
|
||||||
b->pre = offset;
|
b->pre = offset;
|
||||||
b->base_pre = base;
|
b->base_pre = base;
|
||||||
b->base_second_pre = base2;
|
b->base_second_pre = base2;
|
||||||
|
@ -11,23 +11,27 @@
|
|||||||
#include "vp9/common/vp9_mvref_common.h"
|
#include "vp9/common/vp9_mvref_common.h"
|
||||||
|
|
||||||
#define MVREF_NEIGHBOURS 8
|
#define MVREF_NEIGHBOURS 8
|
||||||
|
|
||||||
static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
|
static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
|
||||||
{0, -1}, {-1, 0}, {-1, -1}, {0, -2},
|
{0, -1}, {-1, 0}, {-1, -1}, {0, -2},
|
||||||
{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
|
{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mb_ref_distance_weight[MVREF_NEIGHBOURS] =
|
static int mb_ref_distance_weight[MVREF_NEIGHBOURS] =
|
||||||
{ 3, 3, 2, 1, 1, 1, 1, 1 };
|
{ 3, 3, 2, 1, 1, 1, 1, 1 };
|
||||||
|
|
||||||
static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
|
static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
|
||||||
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
|
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
|
||||||
{-1, -1}, {0, -2}, {-2, 0}, {-1, -2}
|
{-1, -1}, {0, -2}, {-2, 0}, {-1, -2}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sb_ref_distance_weight[MVREF_NEIGHBOURS] =
|
static int sb_ref_distance_weight[MVREF_NEIGHBOURS] =
|
||||||
{ 3, 3, 2, 2, 2, 1, 1, 1 };
|
{ 3, 3, 2, 2, 2, 1, 1, 1 };
|
||||||
|
|
||||||
// clamp_mv_ref
|
// clamp_mv_ref
|
||||||
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
|
#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))
|
if (mv->as_mv.col < (xd->mb_to_left_edge - MV_BORDER))
|
||||||
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)
|
else if (mv->as_mv.col > xd->mb_to_right_edge + MV_BORDER)
|
||||||
@ -41,11 +45,9 @@ static void clamp_mv_ref(const MACROBLOCKD *xd, int_mv *mv) {
|
|||||||
|
|
||||||
// Gets a candidate refenence motion vector from the given mode info
|
// Gets a candidate refenence motion vector from the given mode info
|
||||||
// structure if one exists that matches the given reference frame.
|
// structure if one exists that matches the given reference frame.
|
||||||
static int get_matching_candidate(
|
static int get_matching_candidate(const MODE_INFO *candidate_mi,
|
||||||
const MODE_INFO *candidate_mi,
|
|
||||||
MV_REFERENCE_FRAME ref_frame,
|
MV_REFERENCE_FRAME ref_frame,
|
||||||
int_mv *c_mv
|
int_mv *c_mv) {
|
||||||
) {
|
|
||||||
int ret_val = TRUE;
|
int ret_val = TRUE;
|
||||||
|
|
||||||
if (ref_frame == candidate_mi->mbmi.ref_frame) {
|
if (ref_frame == candidate_mi->mbmi.ref_frame) {
|
||||||
|
@ -13,30 +13,26 @@
|
|||||||
#define VP9_COMMON_VP9_POSTPROC_H_
|
#define VP9_COMMON_VP9_POSTPROC_H_
|
||||||
|
|
||||||
#include "vpx_ports/mem.h"
|
#include "vpx_ports/mem.h"
|
||||||
|
|
||||||
struct postproc_state {
|
struct postproc_state {
|
||||||
int last_q;
|
int last_q;
|
||||||
int last_noise;
|
int last_noise;
|
||||||
char noise[3072];
|
char noise[3072];
|
||||||
DECLARE_ALIGNED(16, char, blackclamp[16]);
|
DECLARE_ALIGNED(16, char, blackclamp[16]);
|
||||||
DECLARE_ALIGNED(16, char, whiteclamp[16]);
|
DECLARE_ALIGNED(16, char, whiteclamp[16]);
|
||||||
DECLARE_ALIGNED(16, char, bothclamp[16]);
|
DECLARE_ALIGNED(16, char, bothclamp[16]);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "vp9/common/vp9_onyxc_int.h"
|
#include "vp9/common/vp9_onyxc_int.h"
|
||||||
#include "vp9/common/vp9_ppflags.h"
|
#include "vp9/common/vp9_ppflags.h"
|
||||||
|
|
||||||
int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
|
int vp9_post_proc_frame(struct VP9Common *oci, YV12_BUFFER_CONFIG *dest,
|
||||||
vp9_ppflags_t *flags);
|
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,
|
void vp9_deblock(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post,
|
||||||
YV12_BUFFER_CONFIG *post,
|
int q, int low_var_thresh, int flag);
|
||||||
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_
|
#endif // VP9_COMMON_VP9_POSTPROC_H_
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
#pragma warning(disable:997 1011 170)
|
#pragma warning(disable:997 1011 170)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable:4799)
|
#pragma warning(disable:4799)
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,7 +34,6 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
|||||||
pred_context += (m - 1)->mbmi.seg_id_predicted;
|
pred_context += (m - 1)->mbmi.seg_id_predicted;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case PRED_REF:
|
case PRED_REF:
|
||||||
pred_context = (m - cm->mode_info_stride)->mbmi.ref_predicted;
|
pred_context = (m - cm->mode_info_stride)->mbmi.ref_predicted;
|
||||||
if (xd->left_available)
|
if (xd->left_available)
|
||||||
@ -101,8 +100,7 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO *** add error trap code.
|
pred_context = 0; // *** add error trap code.
|
||||||
pred_context = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,39 +112,23 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
|||||||
vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd,
|
const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id) {
|
PRED_ID pred_id) {
|
||||||
vp9_prob pred_probability;
|
const int pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
||||||
int pred_context;
|
|
||||||
|
|
||||||
// Get the appropriate prediction context
|
|
||||||
pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
|
||||||
|
|
||||||
switch (pred_id) {
|
switch (pred_id) {
|
||||||
case PRED_SEG_ID:
|
case PRED_SEG_ID:
|
||||||
pred_probability = cm->segment_pred_probs[pred_context];
|
return cm->segment_pred_probs[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_REF:
|
case PRED_REF:
|
||||||
pred_probability = cm->ref_pred_probs[pred_context];
|
return cm->ref_pred_probs[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_COMP:
|
case PRED_COMP:
|
||||||
// In keeping with convention elsewhre the probability returned is
|
// In keeping with convention elsewhre the probability returned is
|
||||||
// the probability of a "0" outcome which in this case means the
|
// the probability of a "0" outcome which in this case means the
|
||||||
// probability of comp pred off.
|
// probability of comp pred off.
|
||||||
pred_probability = cm->prob_comppred[pred_context];
|
return cm->prob_comppred[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_MBSKIP:
|
case PRED_MBSKIP:
|
||||||
pred_probability = cm->mbskip_pred_probs[pred_context];
|
return cm->mbskip_pred_probs[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO *** add error trap code.
|
return 128; // *** add error trap code.
|
||||||
pred_probability = 128;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pred_probability;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function returns a context probability ptr for coding a given
|
// This function returns a context probability ptr for coding a given
|
||||||
@ -154,71 +136,41 @@ vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
|||||||
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd,
|
const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id) {
|
PRED_ID pred_id) {
|
||||||
const vp9_prob *pred_probability;
|
const int pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
||||||
int pred_context;
|
|
||||||
|
|
||||||
// Get the appropriate prediction context
|
|
||||||
pred_context = vp9_get_pred_context(cm, xd, pred_id);
|
|
||||||
|
|
||||||
switch (pred_id) {
|
switch (pred_id) {
|
||||||
case PRED_SEG_ID:
|
case PRED_SEG_ID:
|
||||||
pred_probability = &cm->segment_pred_probs[pred_context];
|
return &cm->segment_pred_probs[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_REF:
|
case PRED_REF:
|
||||||
pred_probability = &cm->ref_pred_probs[pred_context];
|
return &cm->ref_pred_probs[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_COMP:
|
case PRED_COMP:
|
||||||
// In keeping with convention elsewhre the probability returned is
|
// In keeping with convention elsewhre the probability returned is
|
||||||
// the probability of a "0" outcome which in this case means the
|
// the probability of a "0" outcome which in this case means the
|
||||||
// probability of comp pred off.
|
// probability of comp pred off.
|
||||||
pred_probability = &cm->prob_comppred[pred_context];
|
return &cm->prob_comppred[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_MBSKIP:
|
case PRED_MBSKIP:
|
||||||
pred_probability = &cm->mbskip_pred_probs[pred_context];
|
return &cm->mbskip_pred_probs[pred_context];
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_SWITCHABLE_INTERP:
|
case PRED_SWITCHABLE_INTERP:
|
||||||
pred_probability = &cm->fc.switchable_interp_prob[pred_context][0];
|
return &cm->fc.switchable_interp_prob[pred_context][0];
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO *** add error trap code.
|
return NULL; // *** add error trap code.
|
||||||
pred_probability = NULL;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pred_probability;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function returns the status of the given prediction signal.
|
// This function returns the status of the given prediction signal.
|
||||||
// I.e. is the predicted value for the given signal correct.
|
// I.e. is the predicted value for the given signal correct.
|
||||||
unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id) {
|
PRED_ID pred_id) {
|
||||||
unsigned char pred_flag = 0;
|
|
||||||
|
|
||||||
switch (pred_id) {
|
switch (pred_id) {
|
||||||
case PRED_SEG_ID:
|
case PRED_SEG_ID:
|
||||||
pred_flag = xd->mode_info_context->mbmi.seg_id_predicted;
|
return xd->mode_info_context->mbmi.seg_id_predicted;
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_REF:
|
case PRED_REF:
|
||||||
pred_flag = xd->mode_info_context->mbmi.ref_predicted;
|
return xd->mode_info_context->mbmi.ref_predicted;
|
||||||
break;
|
|
||||||
|
|
||||||
case PRED_MBSKIP:
|
case PRED_MBSKIP:
|
||||||
pred_flag = xd->mode_info_context->mbmi.mb_skip_coeff;
|
return xd->mode_info_context->mbmi.mb_skip_coeff;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO *** add error trap code.
|
return 0; // *** add error trap code.
|
||||||
pred_flag = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pred_flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function sets the status of the given prediction signal.
|
// This function sets the status of the given prediction signal.
|
||||||
@ -280,7 +232,7 @@ void vp9_set_pred_flag(MACROBLOCKD *const xd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO *** add error trap code.
|
// *** add error trap code.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,7 +277,6 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
|||||||
MV_REFERENCE_FRAME pred_ref = LAST_FRAME;
|
MV_REFERENCE_FRAME pred_ref = LAST_FRAME;
|
||||||
|
|
||||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||||
int seg_ref_active;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
unsigned char frame_allowed[MAX_REF_FRAMES] = {1, 1, 1, 1};
|
unsigned char frame_allowed[MAX_REF_FRAMES] = {1, 1, 1, 1};
|
||||||
@ -336,7 +287,7 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
|||||||
unsigned char above_left_in_image;
|
unsigned char above_left_in_image;
|
||||||
|
|
||||||
// Is segment coding ennabled
|
// 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.
|
// Special case treatment if segment coding is enabled.
|
||||||
// Dont allow prediction of a reference frame that the segment
|
// Dont allow prediction of a reference frame that the segment
|
||||||
@ -389,9 +340,7 @@ MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
|||||||
// Functions to computes a set of modified reference frame probabilities
|
// Functions to computes a set of modified reference frame probabilities
|
||||||
// to use when the prediction of the reference frame value fails
|
// to use when the prediction of the reference frame value fails
|
||||||
void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
|
void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
|
||||||
int tot_count;
|
int tot_count = count[0] + count[1] + count[2] + count[3];
|
||||||
|
|
||||||
tot_count = count[0] + count[1] + count[2] + count[3];
|
|
||||||
probs[0] = get_prob(count[0], tot_count);
|
probs[0] = get_prob(count[0], tot_count);
|
||||||
|
|
||||||
tot_count -= count[0];
|
tot_count -= count[0];
|
||||||
@ -407,19 +356,12 @@ void vp9_calc_ref_probs(int *count, vp9_prob *probs) {
|
|||||||
// they are not allowed for a given segment.
|
// they are not allowed for a given segment.
|
||||||
void vp9_compute_mod_refprobs(VP9_COMMON *const cm) {
|
void vp9_compute_mod_refprobs(VP9_COMMON *const cm) {
|
||||||
int norm_cnt[MAX_REF_FRAMES];
|
int norm_cnt[MAX_REF_FRAMES];
|
||||||
int intra_count;
|
const int intra_count = cm->prob_intra_coded;
|
||||||
int inter_count;
|
const int inter_count = (255 - intra_count);
|
||||||
int last_count;
|
const int last_count = (inter_count * cm->prob_last_coded) / 255;
|
||||||
int gfarf_count;
|
const int gfarf_count = inter_count - last_count;
|
||||||
int gf_count;
|
const int gf_count = (gfarf_count * cm->prob_gf_coded) / 255;
|
||||||
int arf_count;
|
const int arf_count = gfarf_count - gf_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;
|
|
||||||
|
|
||||||
// Work out modified reference frame probabilities to use where prediction
|
// Work out modified reference frame probabilities to use where prediction
|
||||||
// of the reference frame fails
|
// of the reference frame fails
|
||||||
|
@ -8,48 +8,48 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* 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_
|
#ifndef VP9_COMMON_VP9_PRED_COMMON_H_
|
||||||
#define 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
|
// Predicted items
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PRED_SEG_ID = 0, // Segment identifier
|
PRED_SEG_ID = 0, // Segment identifier
|
||||||
PRED_REF = 1,
|
PRED_REF = 1,
|
||||||
PRED_COMP = 2,
|
PRED_COMP = 2,
|
||||||
PRED_MBSKIP = 3,
|
PRED_MBSKIP = 3,
|
||||||
PRED_SWITCHABLE_INTERP = 4
|
PRED_SWITCHABLE_INTERP = 4
|
||||||
} PRED_ID;
|
} PRED_ID;
|
||||||
|
|
||||||
extern unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd,
|
const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id);
|
PRED_ID pred_id);
|
||||||
|
|
||||||
extern vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
vp9_prob vp9_get_pred_prob(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd,
|
const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id);
|
PRED_ID pred_id);
|
||||||
|
|
||||||
extern const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd,
|
const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id);
|
PRED_ID pred_id);
|
||||||
|
|
||||||
extern unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
unsigned char vp9_get_pred_flag(const MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id);
|
PRED_ID pred_id);
|
||||||
|
|
||||||
extern void vp9_set_pred_flag(MACROBLOCKD *const xd,
|
void vp9_set_pred_flag(MACROBLOCKD *const xd,
|
||||||
PRED_ID pred_id,
|
PRED_ID pred_id,
|
||||||
unsigned char pred_flag);
|
unsigned char pred_flag);
|
||||||
|
|
||||||
|
|
||||||
extern unsigned char vp9_get_pred_mb_segid(const VP9_COMMON *const cm,
|
unsigned char vp9_get_pred_mb_segid(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd,
|
const MACROBLOCKD *const xd,
|
||||||
int MbIndex);
|
int MbIndex);
|
||||||
|
|
||||||
extern MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
MV_REFERENCE_FRAME vp9_get_pred_ref(const VP9_COMMON *const cm,
|
||||||
const MACROBLOCKD *const xd);
|
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_
|
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
#include "vp9/common/vp9_tile_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,
|
static void vp9_get_tile_offsets(VP9_COMMON *cm, int *min_tile_off,
|
||||||
int *max_tile_off, int tile_idx,
|
int *max_tile_off, int tile_idx,
|
||||||
int log2_n_tiles, int n_mbs) {
|
int log2_n_tiles, int n_mbs) {
|
||||||
@ -35,8 +40,6 @@ void vp9_get_tile_row_offsets(VP9_COMMON *cm, int tile_row_idx) {
|
|||||||
cm->log2_tile_rows, cm->mb_rows);
|
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,
|
void vp9_get_tile_n_bits(VP9_COMMON *cm, int *min_log2_n_tiles_ptr,
|
||||||
int *delta_log2_n_tiles) {
|
int *delta_log2_n_tiles) {
|
||||||
|
@ -13,9 +13,6 @@
|
|||||||
|
|
||||||
#include "vp9/common/vp9_onyxc_int.h"
|
#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_col_offsets(VP9_COMMON *cm, int tile_col_idx);
|
||||||
|
|
||||||
void vp9_get_tile_row_offsets(VP9_COMMON *cm, int tile_row_idx);
|
void vp9_get_tile_row_offsets(VP9_COMMON *cm, int tile_row_idx);
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* 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_ports/mem.h"
|
||||||
#include "vpx_mem/vpx_mem.h"
|
#include "vpx_mem/vpx_mem.h"
|
||||||
|
|
||||||
|
#include "vp9/decoder/vp9_dboolhuff.h"
|
||||||
|
|
||||||
int vp9_start_decode(BOOL_DECODER *br,
|
int vp9_start_decode(BOOL_DECODER *br,
|
||||||
const unsigned char *source,
|
const unsigned char *source,
|
||||||
unsigned int source_sz) {
|
unsigned int source_sz) {
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "./vpx_config.h"
|
#include "./vpx_config.h"
|
||||||
#include "vpx_ports/mem.h"
|
#include "vpx_ports/mem.h"
|
||||||
#include "vpx/vpx_integer.h"
|
#include "vpx/vpx_integer.h"
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "vp9/common/vp9_onyxc_int.h"
|
#include "vp9/common/vp9_onyxc_int.h"
|
||||||
#if CONFIG_POSTPROC
|
#if CONFIG_POSTPROC
|
||||||
#include "vp9/common/vp9_postproc.h"
|
#include "vp9/common/vp9_postproc.h"
|
||||||
@ -19,8 +22,6 @@
|
|||||||
#include "vp9/common/vp9_alloccommon.h"
|
#include "vp9/common/vp9_alloccommon.h"
|
||||||
#include "vp9/common/vp9_loopfilter.h"
|
#include "vp9/common/vp9_loopfilter.h"
|
||||||
#include "vp9/common/vp9_swapyv12buffer.h"
|
#include "vp9/common/vp9_swapyv12buffer.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "vp9/common/vp9_quant_common.h"
|
#include "vp9/common/vp9_quant_common.h"
|
||||||
#include "vpx_scale/vpx_scale.h"
|
#include "vpx_scale/vpx_scale.h"
|
||||||
@ -99,7 +100,7 @@ void write_dx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void vp9_initialize_dec(void) {
|
void vp9_initialize_dec() {
|
||||||
static int init_done = 0;
|
static int init_done = 0;
|
||||||
|
|
||||||
if (!init_done) {
|
if (!init_done) {
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#define VP9_DECODER_VP9_TREEREADER_H_
|
#define VP9_DECODER_VP9_TREEREADER_H_
|
||||||
|
|
||||||
#include "vp9/common/vp9_treecoder.h"
|
#include "vp9/common/vp9_treecoder.h"
|
||||||
|
|
||||||
#include "vp9/decoder/vp9_dboolhuff.h"
|
#include "vp9/decoder/vp9_dboolhuff.h"
|
||||||
|
|
||||||
typedef BOOL_DECODER vp9_reader;
|
typedef BOOL_DECODER vp9_reader;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "./vpx_config.h"
|
#include "./vpx_config.h"
|
||||||
#include "vp9/encoder/vp9_block.h"
|
#include "vp9/encoder/vp9_block.h"
|
||||||
|
#include "vp9/encoder/vp9_onyx_int.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MB_PREDICTION_MODE mode;
|
MB_PREDICTION_MODE mode;
|
||||||
@ -21,7 +22,6 @@ typedef struct {
|
|||||||
} MODE_DEFINITION;
|
} MODE_DEFINITION;
|
||||||
|
|
||||||
|
|
||||||
#include "vp9/encoder/vp9_onyx_int.h"
|
|
||||||
struct VP9_ENCODER_RTCD;
|
struct VP9_ENCODER_RTCD;
|
||||||
void vp9_encode_inter16x16(MACROBLOCK *x, int mb_row, int mb_col);
|
void vp9_encode_inter16x16(MACROBLOCK *x, int mb_row, int mb_col);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#ifndef VPX_PORTS_MEM_H
|
#ifndef VPX_PORTS_MEM_H
|
||||||
#define VPX_PORTS_MEM_H
|
#define VPX_PORTS_MEM_H
|
||||||
|
|
||||||
#include "vpx_config.h"
|
#include "vpx_config.h"
|
||||||
#include "vpx/vpx_integer.h"
|
#include "vpx/vpx_integer.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user