summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs.mk2
-rw-r--r--examples.mk33
-rw-r--r--examples/decode_to_md5.c2
-rw-r--r--examples/force_keyframe.c2
-rw-r--r--vp9/common/vp9_entropy.c6
-rw-r--r--vp9/common/vp9_entropy.h6
-rw-r--r--vp9/common/vp9_filter.c14
-rw-r--r--vp9/common/vp9_filter.h14
-rw-r--r--vp9/common/vp9_pred_common.h2
-rw-r--r--vp9/common/vp9_prob.c2
-rw-r--r--vp9/encoder/vp9_bitstream.c51
-rw-r--r--vp9/encoder/vp9_encodeframe.c6
-rw-r--r--vp9/encoder/vp9_encodemb.c59
-rw-r--r--vp9/encoder/vp9_firstpass.c20
-rw-r--r--vp9/encoder/vp9_mbgraph.c2
-rw-r--r--vp9/encoder/vp9_onyx_if.c155
-rw-r--r--vp9/encoder/vp9_ratectrl.c2
-rw-r--r--vp9/encoder/vp9_rdopt.c2
-rw-r--r--vp9/encoder/vp9_vaq.c10
-rw-r--r--vpx/vp8cx.h11
-rw-r--r--vpx/vpx_frame_buffer.h4
21 files changed, 221 insertions, 184 deletions
diff --git a/docs.mk b/docs.mk
index 9426f76ea..797b46618 100644
--- a/docs.mk
+++ b/docs.mk
@@ -30,7 +30,9 @@ TXT_DOX = $(call enabled,TXT_DOX)
EXAMPLE_PATH += $(SRC_PATH_BARE) #for CHANGELOG, README, etc
+EXAMPLE_PATH += $(SRC_PATH_BARE)/examples
+doxyfile: $(if $(findstring examples, $(ALL_TARGETS)),examples.doxy)
doxyfile: libs.doxy_template libs.doxy
@echo " [CREATE] $@"
@cat $^ > $@
diff --git a/examples.mk b/examples.mk
index e4abcf702..40756e182 100644
--- a/examples.mk
+++ b/examples.mk
@@ -285,3 +285,36 @@ INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
$(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
$(foreach proj,$(call enabled,PROJECTS),\
$(eval $(call vcproj_template,$(proj))))
+
+#
+# Documentation Rules
+#
+%.dox: %.c
+ @echo " [DOXY] $@"
+ @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
+ @echo " \includelineno $(<F)" >> $@
+ @echo "*/" >> $@
+
+samples.dox: examples.mk
+ @echo " [DOXY] $@"
+ @echo "/*!\page samples Sample Code" > $@
+ @echo " This SDK includes a number of sample applications."\
+ "Each sample documents a feature of the SDK in both prose"\
+ "and the associated C code."\
+ "The following samples are included: ">>$@
+ @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
+ echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
+ @echo >> $@
+ @echo " In addition, the SDK contains a number of utilities."\
+ "Since these utilities are built upon the concepts described"\
+ "in the sample code listed above, they are not documented in"\
+ "pieces like the samples are. Their source is included here"\
+ "for reference. The following utilities are included:" >> $@
+ @$(foreach ex,$(sort $(UTILS:.c=)),\
+ echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
+ @echo "*/" >> $@
+
+CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
+DOCS-yes += examples.doxy samples.dox
+examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
+ @echo "INPUT += $^" > $@
diff --git a/examples/decode_to_md5.c b/examples/decode_to_md5.c
index aabac60ee..28d1ad569 100644
--- a/examples/decode_to_md5.c
+++ b/examples/decode_to_md5.c
@@ -115,7 +115,7 @@ int main(int argc, char **argv) {
size_t frame_size = 0;
const unsigned char *frame = vpx_video_reader_get_frame(reader,
&frame_size);
- if (vpx_codec_decode(&codec, frame, frame_size, NULL, 0))
+ if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
die_codec(&codec, "Failed to decode frame");
while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
diff --git a/examples/force_keyframe.c b/examples/force_keyframe.c
index f03b3d0d8..6531e4713 100644
--- a/examples/force_keyframe.c
+++ b/examples/force_keyframe.c
@@ -119,7 +119,7 @@ static void write_ivf_frame_header(FILE *outfile,
return;
pts = pkt->data.frame.pts;
- mem_put_le32(header, pkt->data.frame.sz);
+ mem_put_le32(header, (unsigned int)pkt->data.frame.sz);
mem_put_le32(header+4, pts&0xFFFFFFFF);
mem_put_le32(header+8, pts >> 32);
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c
index 13e954efe..bc12f9aa2 100644
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -16,7 +16,7 @@
#include "vpx/vpx_integer.h"
-DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_8x8plus[1024]) = {
+const uint8_t vp9_coefband_trans_8x8plus[1024] = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 5,
// beyond MAXBAND_INDEX+1 all values are filled as 5
@@ -85,11 +85,11 @@ DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_8x8plus[1024]) = {
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
};
-DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_4x4[16]) = {
+const uint8_t vp9_coefband_trans_4x4[16] = {
0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5,
};
-DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]) = {
+const uint8_t vp9_pt_energy_class[ENTROPY_TOKENS] = {
0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5
};
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index d6b380fd5..aab8b5388 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -42,7 +42,7 @@ extern "C" {
#define ENTROPY_NODES 11
-extern DECLARE_ALIGNED(16, const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_pt_energy_class[ENTROPY_TOKENS]);
#define EOB_MODEL_TOKEN 3
extern const vp9_tree_index vp9_coefmodel_tree[];
@@ -116,8 +116,8 @@ static INLINE void reset_skip_context(MACROBLOCKD *xd, BLOCK_SIZE bsize) {
// This macro is currently unused but may be used by certain implementations
#define MAXBAND_INDEX 21
-extern DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_8x8plus[1024]);
-extern DECLARE_ALIGNED(16, const uint8_t, vp9_coefband_trans_4x4[16]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_coefband_trans_8x8plus[1024]);
+DECLARE_ALIGNED(16, extern const uint8_t, vp9_coefband_trans_4x4[16]);
static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
return tx_size == TX_4X4 ? vp9_coefband_trans_4x4
diff --git a/vp9/common/vp9_filter.c b/vp9/common/vp9_filter.c
index 546f603b6..7474a88bc 100644
--- a/vp9/common/vp9_filter.c
+++ b/vp9/common/vp9_filter.c
@@ -10,12 +10,9 @@
#include <assert.h>
-#include "vpx_ports/mem.h"
-
#include "vp9/common/vp9_filter.h"
-DECLARE_ALIGNED(256, const InterpKernel,
- vp9_bilinear_filters[SUBPEL_SHIFTS]) = {
+const InterpKernel vp9_bilinear_filters[SUBPEL_SHIFTS] = {
{ 0, 0, 0, 128, 0, 0, 0, 0 },
{ 0, 0, 0, 120, 8, 0, 0, 0 },
{ 0, 0, 0, 112, 16, 0, 0, 0 },
@@ -35,8 +32,7 @@ DECLARE_ALIGNED(256, const InterpKernel,
};
// Lagrangian interpolation filter
-DECLARE_ALIGNED(256, const InterpKernel,
- vp9_sub_pel_filters_8[SUBPEL_SHIFTS]) = {
+const InterpKernel vp9_sub_pel_filters_8[SUBPEL_SHIFTS] = {
{ 0, 0, 0, 128, 0, 0, 0, 0},
{ 0, 1, -5, 126, 8, -3, 1, 0},
{ -1, 3, -10, 122, 18, -6, 2, 0},
@@ -56,8 +52,7 @@ DECLARE_ALIGNED(256, const InterpKernel,
};
// DCT based filter
-DECLARE_ALIGNED(256, const InterpKernel,
- vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]) = {
+const InterpKernel vp9_sub_pel_filters_8s[SUBPEL_SHIFTS] = {
{0, 0, 0, 128, 0, 0, 0, 0},
{-1, 3, -7, 127, 8, -3, 1, 0},
{-2, 5, -13, 125, 17, -6, 3, -1},
@@ -77,8 +72,7 @@ DECLARE_ALIGNED(256, const InterpKernel,
};
// freqmultiplier = 0.5
-DECLARE_ALIGNED(256, const InterpKernel,
- vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]) = {
+const InterpKernel vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS] = {
{ 0, 0, 0, 128, 0, 0, 0, 0},
{-3, -1, 32, 64, 38, 1, -3, 0},
{-2, -2, 29, 63, 41, 2, -3, 0},
diff --git a/vp9/common/vp9_filter.h b/vp9/common/vp9_filter.h
index 15610d781..29d3867c9 100644
--- a/vp9/common/vp9_filter.h
+++ b/vp9/common/vp9_filter.h
@@ -13,6 +13,8 @@
#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
+#include "vpx_ports/mem.h"
+
#ifdef __cplusplus
extern "C" {
@@ -37,10 +39,14 @@ typedef int16_t InterpKernel[SUBPEL_TAPS];
const InterpKernel *vp9_get_interp_kernel(INTERP_FILTER filter);
-extern const InterpKernel vp9_bilinear_filters[SUBPEL_SHIFTS];
-extern const InterpKernel vp9_sub_pel_filters_8[SUBPEL_SHIFTS];
-extern const InterpKernel vp9_sub_pel_filters_8s[SUBPEL_SHIFTS];
-extern const InterpKernel vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS];
+DECLARE_ALIGNED(256, extern const InterpKernel,
+ vp9_bilinear_filters[SUBPEL_SHIFTS]);
+DECLARE_ALIGNED(256, extern const InterpKernel,
+ vp9_sub_pel_filters_8[SUBPEL_SHIFTS]);
+DECLARE_ALIGNED(256, extern const InterpKernel,
+ vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]);
+DECLARE_ALIGNED(256, extern const InterpKernel,
+ vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]);
// The VP9_BILINEAR_FILTERS_2TAP macro returns a pointer to the bilinear
// filter kernel as a 2 tap filter.
diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h
index 7f9e56392..6c7a0d383 100644
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -39,7 +39,7 @@ static INLINE int vp9_get_pred_context_seg_id(const MACROBLOCKD *xd) {
return above_sip + left_sip;
}
-static INLINE vp9_prob vp9_get_pred_prob_seg_id(struct segmentation *seg,
+static INLINE vp9_prob vp9_get_pred_prob_seg_id(const struct segmentation *seg,
const MACROBLOCKD *xd) {
return seg->pred_probs[vp9_get_pred_context_seg_id(xd)];
}
diff --git a/vp9/common/vp9_prob.c b/vp9/common/vp9_prob.c
index f9bc06ecf..a1befc63e 100644
--- a/vp9/common/vp9_prob.c
+++ b/vp9/common/vp9_prob.c
@@ -10,7 +10,7 @@
#include "vp9/common/vp9_prob.h"
-DECLARE_ALIGNED(16, const uint8_t, vp9_norm[256]) = {
+const uint8_t vp9_norm[256] = {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 2a1836f40..31ec069d0 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -34,7 +34,6 @@
#include "vp9/encoder/vp9_write_bit_buffer.h"
#ifdef ENTROPY_STATS
-vp9_coeff_stats tree_update_hist[TX_SIZES][PLANE_TYPES];
extern unsigned int active_section;
#endif
@@ -247,15 +246,15 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
const nmv_context *nmvc = &cm->fc.nmvc;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
- struct segmentation *seg = &cm->seg;
+ const struct segmentation *const seg = &cm->seg;
MB_MODE_INFO *const mi = &m->mbmi;
- const MV_REFERENCE_FRAME rf = mi->ref_frame[0];
- const MV_REFERENCE_FRAME sec_rf = mi->ref_frame[1];
+ const MV_REFERENCE_FRAME ref0 = mi->ref_frame[0];
+ const MV_REFERENCE_FRAME ref1 = mi->ref_frame[1];
const MB_PREDICTION_MODE mode = mi->mode;
const int segment_id = mi->segment_id;
- int skip;
const BLOCK_SIZE bsize = mi->sb_type;
const int allow_hp = cm->allow_high_precision_mv;
+ int skip;
#ifdef ENTROPY_STATS
active_section = 9;
@@ -276,15 +275,15 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
skip = write_skip(cpi, segment_id, m, bc);
if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
- vp9_write(bc, rf != INTRA_FRAME, vp9_get_intra_inter_prob(cm, xd));
+ vp9_write(bc, ref0 != INTRA_FRAME, vp9_get_intra_inter_prob(cm, xd));
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
- !(rf != INTRA_FRAME &&
+ !(ref0 != INTRA_FRAME &&
(skip || vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)))) {
write_selected_tx_size(cpi, m, mi->tx_size, bsize, bc);
}
- if (rf == INTRA_FRAME) {
+ if (ref0 == INTRA_FRAME) {
#ifdef ENTROPY_STATS
active_section = 6;
#endif
@@ -306,7 +305,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
} else {
vp9_prob *mv_ref_p;
encode_ref_frame(cpi, bc);
- mv_ref_p = cpi->common.fc.inter_mode_probs[mi->mode_context[rf]];
+ mv_ref_p = cm->fc.inter_mode_probs[mi->mode_context[ref0]];
#ifdef ENTROPY_STATS
active_section = 3;
@@ -316,7 +315,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)) {
if (bsize >= BLOCK_8X8) {
write_inter_mode(bc, mode, mv_ref_p);
- ++cm->counts.inter_mode[mi->mode_context[rf]][INTER_OFFSET(mode)];
+ ++cm->counts.inter_mode[mi->mode_context[ref0]][INTER_OFFSET(mode)];
}
}
@@ -336,21 +335,19 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
const int j = idy * 2 + idx;
- const MB_PREDICTION_MODE blockmode = m->bmi[j].as_mode;
- write_inter_mode(bc, blockmode, mv_ref_p);
- ++cm->counts.inter_mode[mi->mode_context[rf]]
- [INTER_OFFSET(blockmode)];
-
- if (blockmode == NEWMV) {
+ const MB_PREDICTION_MODE b_mode = m->bmi[j].as_mode;
+ write_inter_mode(bc, b_mode, mv_ref_p);
+ ++cm->counts.inter_mode[mi->mode_context[ref0]][INTER_OFFSET(b_mode)];
+ if (b_mode == NEWMV) {
#ifdef ENTROPY_STATS
active_section = 11;
#endif
vp9_encode_mv(cpi, bc, &m->bmi[j].as_mv[0].as_mv,
- &mi->ref_mvs[rf][0].as_mv, nmvc, allow_hp);
+ &mi->ref_mvs[ref0][0].as_mv, nmvc, allow_hp);
if (has_second_ref(mi))
vp9_encode_mv(cpi, bc, &m->bmi[j].as_mv[1].as_mv,
- &mi->ref_mvs[sec_rf][0].as_mv, nmvc, allow_hp);
+ &mi->ref_mvs[ref1][0].as_mv, nmvc, allow_hp);
}
}
}
@@ -359,11 +356,11 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
active_section = 5;
#endif
vp9_encode_mv(cpi, bc, &mi->mv[0].as_mv,
- &mi->ref_mvs[rf][0].as_mv, nmvc, allow_hp);
+ &mi->ref_mvs[ref0][0].as_mv, nmvc, allow_hp);
if (has_second_ref(mi))
vp9_encode_mv(cpi, bc, &mi->mv[1].as_mv,
- &mi->ref_mvs[sec_rf][0].as_mv, nmvc, allow_hp);
+ &mi->ref_mvs[ref1][0].as_mv, nmvc, allow_hp);
}
}
}
@@ -628,10 +625,6 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
if (s > 0 && newp != *oldp)
u = 1;
vp9_write(bc, u, upd);
-#ifdef ENTROPY_STATS
- if (!cpi->dummy_packing)
- ++tree_update_hist[tx_size][i][j][k][l][t][u];
-#endif
if (u) {
/* send/use new probability */
vp9_write_prob_diff_update(bc, newp, *oldp);
@@ -683,10 +676,6 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
updates += u;
if (u == 0 && updates == 0) {
noupdates_before_first++;
-#ifdef ENTROPY_STATS
- if (!cpi->dummy_packing)
- ++tree_update_hist[tx_size][i][j][k][l][t][u];
-#endif
continue;
}
if (u == 1 && updates == 1) {
@@ -697,10 +686,6 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
vp9_write(bc, 0, upd);
}
vp9_write(bc, u, upd);
-#ifdef ENTROPY_STATS
- if (!cpi->dummy_packing)
- ++tree_update_hist[tx_size][i][j][k][l][t][u];
-#endif
if (u) {
/* send/use new probability */
vp9_write_prob_diff_update(bc, newp, *oldp);
@@ -1272,7 +1257,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size) {
active_section = 7;
#endif
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
first_part_size = write_compressed_header(cpi, data);
data += first_part_size;
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 1a9ab6000..ce8614639 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -627,7 +627,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
int orig_rdmult = x->rdmult;
double rdmult_ratio;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
rdmult_ratio = 1.0; // avoid uninitialized warnings
// Use the lower precision, but faster, 32x32 fdct for mode selection.
@@ -683,7 +683,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
activity_masking(cpi, x);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
x->rdmult = round(x->rdmult * rdmult_ratio);
} else if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) {
const int mi_offset = mi_row * cm->mi_cols + mi_col;
@@ -713,7 +713,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile,
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
x->rdmult = orig_rdmult;
if (*totalrate != INT_MAX) {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
*totalrate = round(*totalrate * rdmult_ratio);
}
}
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 6f976f584..19421aaac 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -345,6 +345,15 @@ static void optimize_init_b(int plane, BLOCK_SIZE bsize,
pd->above_context, pd->left_context,
num_4x4_w, num_4x4_h);
}
+
+static INLINE void fdct32x32(int rd_transform,
+ const int16_t *src, int16_t *dst, int src_stride) {
+ if (rd_transform)
+ vp9_fdct32x32_rd(src, dst, src_stride);
+ else
+ vp9_fdct32x32(src, dst, src_stride);
+}
+
void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
@@ -364,10 +373,7 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
switch (tx_size) {
case TX_32X32:
scan_order = &vp9_default_scan_orders[TX_32X32];
- if (x->use_lp32x32fdct)
- vp9_fdct32x32_rd(src_diff, coeff, diff_stride);
- else
- vp9_fdct32x32(src_diff, coeff, diff_stride);
+ fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, p->zbin_extra, eob, scan_order->scan,
@@ -533,10 +539,12 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
uint8_t *src, *dst;
int16_t *src_diff;
uint16_t *eob = &p->eobs[block];
+ const int src_stride = p->src.stride;
+ const int dst_stride = pd->dst.stride;
int i, j;
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * (j * pd->dst.stride + i)];
- src = &p->src.buf[4 * (j * p->src.stride + i)];
+ dst = &pd->dst.buf[4 * (j * dst_stride + i)];
+ src = &p->src.buf[4 * (j * src_stride + i)];
src_diff = &p->src_diff[4 * (j * diff_stride + i)];
// if (x->optimize)
@@ -548,22 +556,19 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 6, bwl, TX_32X32, mode,
x->skip_encode ? src : dst,
- x->skip_encode ? p->src.stride : pd->dst.stride,
- dst, pd->dst.stride, i, j, plane);
+ x->skip_encode ? src_stride : dst_stride,
+ dst, dst_stride, i, j, plane);
if (!x->skip_recode) {
vp9_subtract_block(32, 32, src_diff, diff_stride,
- src, p->src.stride, dst, pd->dst.stride);
- if (x->use_lp32x32fdct)
- vp9_fdct32x32_rd(src_diff, coeff, diff_stride);
- else
- vp9_fdct32x32(src_diff, coeff, diff_stride);
+ src, src_stride, dst, dst_stride);
+ fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
vp9_quantize_b_32x32(coeff, 1024, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
pd->dequant, p->zbin_extra, eob, scan_order->scan,
scan_order->iscan);
}
if (!x->skip_encode && *eob)
- vp9_idct32x32_add(dqcoeff, dst, pd->dst.stride, *eob);
+ vp9_idct32x32_add(dqcoeff, dst, dst_stride, *eob);
break;
case TX_16X16:
tx_type = get_tx_type_16x16(pd->plane_type, xd);
@@ -571,11 +576,11 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 4, bwl, TX_16X16, mode,
x->skip_encode ? src : dst,
- x->skip_encode ? p->src.stride : pd->dst.stride,
- dst, pd->dst.stride, i, j, plane);
+ x->skip_encode ? src_stride : dst_stride,
+ dst, dst_stride, i, j, plane);
if (!x->skip_recode) {
vp9_subtract_block(16, 16, src_diff, diff_stride,
- src, p->src.stride, dst, pd->dst.stride);
+ src, src_stride, dst, dst_stride);
vp9_fht16x16(src_diff, coeff, diff_stride, tx_type);
vp9_quantize_b(coeff, 256, x->skip_block, p->zbin, p->round,
p->quant, p->quant_shift, qcoeff, dqcoeff,
@@ -583,7 +588,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
scan_order->iscan);
}
if (!x->skip_encode && *eob)
- vp9_iht16x16_add(tx_type, dqcoeff, dst, pd->dst.stride, *eob);
+ vp9_iht16x16_add(tx_type, dqcoeff, dst, dst_stride, *eob);
break;
case TX_8X8:
tx_type = get_tx_type_8x8(pd->plane_type, xd);
@@ -591,11 +596,11 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
vp9_predict_intra_block(xd, block >> 2, bwl, TX_8X8, mode,
x->skip_encode ? src : dst,
- x->skip_encode ? p->src.stride : pd->dst.stride,
- dst, pd->dst.stride, i, j, plane);
+ x->skip_encode ? src_stride : dst_stride,
+ dst, dst_stride, i, j, plane);
if (!x->skip_recode) {
vp9_subtract_block(8, 8, src_diff, diff_stride,
- src, p->src.stride, dst, pd->dst.stride);
+ src, src_stride, dst, dst_stride);
vp9_fht8x8(src_diff, coeff, diff_stride, tx_type);
vp9_quantize_b(coeff, 64, x->skip_block, p->zbin, p->round, p->quant,
p->quant_shift, qcoeff, dqcoeff,
@@ -603,7 +608,7 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
scan_order->iscan);
}
if (!x->skip_encode && *eob)
- vp9_iht8x8_add(tx_type, dqcoeff, dst, pd->dst.stride, *eob);
+ vp9_iht8x8_add(tx_type, dqcoeff, dst, dst_stride, *eob);
break;
case TX_4X4:
tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
@@ -615,12 +620,12 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
vp9_predict_intra_block(xd, block, bwl, TX_4X4, mode,
x->skip_encode ? src : dst,
- x->skip_encode ? p->src.stride : pd->dst.stride,
- dst, pd->dst.stride, i, j, plane);
+ x->skip_encode ? src_stride : dst_stride,
+ dst, dst_stride, i, j, plane);
if (!x->skip_recode) {
vp9_subtract_block(4, 4, src_diff, diff_stride,
- src, p->src.stride, dst, pd->dst.stride);
+ src, src_stride, dst, dst_stride);
if (tx_type != DCT_DCT)
vp9_fht4x4(src_diff, coeff, diff_stride, tx_type);
else
@@ -636,9 +641,9 @@ static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
// this is like vp9_short_idct4x4 but has a special case around eob<=1
// which is significant (not just an optimization) for the lossless
// case.
- xd->itxm_add(dqcoeff, dst, pd->dst.stride, *eob);
+ xd->itxm_add(dqcoeff, dst, dst_stride, *eob);
else
- vp9_iht4x4_16_add(dqcoeff, dst, pd->dst.stride, tx_type);
+ vp9_iht4x4_16_add(dqcoeff, dst, dst_stride, tx_type);
}
break;
default:
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index c2aac3ecf..ddb901dd1 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -495,7 +495,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
struct twopass_rc *const twopass = &cpi->twopass;
const MV zero_mv = {0, 0};
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
vp9_setup_src_planes(x, cpi->Source, 0, 0);
setup_pre_planes(xd, 0, lst_yv12, 0, 0, NULL);
@@ -544,7 +544,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
double error_weight = 1.0;
const BLOCK_SIZE bsize = get_bsize(cm, mb_row, mb_col);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
xd->plane[0].dst.buf = new_yv12->y_buffer + recon_yoffset;
xd->plane[1].dst.buf = new_yv12->u_buffer + recon_uvoffset;
@@ -565,7 +565,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
// Do intra 16x16 prediction.
this_error = vp9_encode_intra(x, use_dc_pred);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
this_error = (int)(this_error * error_weight);
}
@@ -601,7 +601,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
first_pass_motion_search(cpi, x, &best_ref_mv.as_mv, &mv.as_mv,
&motion_error);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
motion_error = (int)(motion_error * error_weight);
}
@@ -612,7 +612,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
first_pass_motion_search(cpi, x, &zero_mv, &tmp_mv.as_mv,
&tmp_err);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
tmp_err = (int)(tmp_err * error_weight);
}
@@ -633,7 +633,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
first_pass_motion_search(cpi, x, &zero_mv, &tmp_mv.as_mv,
&gf_motion_error);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
gf_motion_error = (int)(gf_motion_error * error_weight);
}
@@ -742,10 +742,10 @@ void vp9_first_pass(VP9_COMP *cpi) {
x->plane[2].src.buf += uv_mb_height * x->plane[1].src.stride -
uv_mb_height * cm->mb_cols;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
}
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
{
FIRSTPASS_STATS fps;
@@ -1409,7 +1409,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
twopass->gf_group_bits = 0;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
start_pos = twopass->stats_in;
@@ -1907,7 +1907,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
vp9_zero(next_frame);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
start_position = twopass->stats_in;
cpi->common.frame_type = KEY_FRAME;
diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c
index 7eacda217..44c1f9078 100644
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -419,7 +419,7 @@ void vp9_update_mbgraph_stats(VP9_COMP *cpi) {
golden_ref, cpi->Source);
}
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
separate_arf_mbs(cpi);
}
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 23274fc8a..cdb03c00c 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -154,20 +154,22 @@ void vp9_initialize_enc() {
}
static void dealloc_compressor_data(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+
// Delete sementation map
vpx_free(cpi->segmentation_map);
- cpi->segmentation_map = 0;
- vpx_free(cpi->common.last_frame_seg_map);
- cpi->common.last_frame_seg_map = 0;
+ cpi->segmentation_map = NULL;
+ vpx_free(cm->last_frame_seg_map);
+ cm->last_frame_seg_map = NULL;
vpx_free(cpi->coding_context.last_frame_seg_map_copy);
- cpi->coding_context.last_frame_seg_map_copy = 0;
+ cpi->coding_context.last_frame_seg_map_copy = NULL;
vpx_free(cpi->complexity_map);
cpi->complexity_map = 0;
vpx_free(cpi->active_map);
cpi->active_map = 0;
- vp9_free_frame_buffers(&cpi->common);
+ vp9_free_frame_buffers(cm);
vp9_free_frame_buffer(&cpi->last_frame_uf);
vp9_free_frame_buffer(&cpi->scaled_source);
@@ -194,19 +196,20 @@ static void dealloc_compressor_data(VP9_COMP *cpi) {
// to a target value
// target q value
int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget) {
+ const RATE_CONTROL *const rc = &cpi->rc;
+ int start_index = rc->worst_quality;
+ int target_index = rc->worst_quality;
int i;
- int start_index = cpi->rc.worst_quality;
- int target_index = cpi->rc.worst_quality;
// Convert the average q value to an index.
- for (i = cpi->rc.best_quality; i < cpi->rc.worst_quality; i++) {
+ for (i = rc->best_quality; i < rc->worst_quality; ++i) {
start_index = i;
if (vp9_convert_qindex_to_q(i) >= qstart)
break;
}
// Convert the q target to an index
- for (i = cpi->rc.best_quality; i < cpi->rc.worst_quality; i++) {
+ for (i = rc->best_quality; i < rc->worst_quality; ++i) {
target_index = i;
if (vp9_convert_qindex_to_q(i) >= qtarget)
break;
@@ -221,25 +224,20 @@ int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget) {
static int compute_qdelta_by_rate(VP9_COMP *cpi, int base_q_index,
double rate_target_ratio) {
int i;
- int base_bits_per_mb;
- int target_bits_per_mb;
int target_index = cpi->rc.worst_quality;
- // Make SURE use of floating point in this function is safe.
- vp9_clear_system_state();
-
// Look up the current projected bits per block for the base index
- base_bits_per_mb = vp9_rc_bits_per_mb(cpi->common.frame_type,
- base_q_index, 1.0);
+ const int base_bits_per_mb = vp9_rc_bits_per_mb(cpi->common.frame_type,
+ base_q_index, 1.0);
// Find the target bits per mb based on the base value and given ratio.
- target_bits_per_mb = (int)(rate_target_ratio * base_bits_per_mb);
+ const int target_bits_per_mb = (int)(rate_target_ratio * base_bits_per_mb);
// Convert the q target to an index
- for (i = cpi->rc.best_quality; i < cpi->rc.worst_quality; i++) {
+ for (i = cpi->rc.best_quality; i < cpi->rc.worst_quality; ++i) {
target_index = i;
- if (vp9_rc_bits_per_mb(cpi->common.frame_type,
- i, 1.0) <= target_bits_per_mb )
+ if (vp9_rc_bits_per_mb(cpi->common.frame_type, i, 1.0) <=
+ target_bits_per_mb )
break;
}
@@ -249,11 +247,8 @@ static int compute_qdelta_by_rate(VP9_COMP *cpi, int base_q_index,
// This function sets up a set of segments with delta Q values around
// the baseline frame quantizer.
static void setup_in_frame_q_adj(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- struct segmentation *seg = &cm->seg;
- // double q_ratio;
- int segment;
- int qindex_delta;
+ VP9_COMMON *const cm = &cpi->common;
+ struct segmentation *const seg = &cm->seg;
// Make SURE use of floating point in this function is safe.
vp9_clear_system_state();
@@ -261,6 +256,8 @@ static void setup_in_frame_q_adj(VP9_COMP *cpi) {
if (cm->frame_type == KEY_FRAME ||
cpi->refresh_alt_ref_frame ||
(cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) {
+ int segment;
+
// Clear down the segment map
vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols);
@@ -278,16 +275,16 @@ static void setup_in_frame_q_adj(VP9_COMP *cpi) {
// Use some of the segments for in frame Q adjustment
for (segment = 1; segment < 2; segment++) {
- qindex_delta = compute_qdelta_by_rate(cpi, cm->base_qindex,
- in_frame_q_adj_ratio[segment]);
+ const int qindex_delta = compute_qdelta_by_rate(cpi, cm->base_qindex,
+ in_frame_q_adj_ratio[segment]);
vp9_enable_segfeature(seg, segment, SEG_LVL_ALT_Q);
vp9_set_segdata(seg, segment, SEG_LVL_ALT_Q, qindex_delta);
}
}
}
static void configure_static_seg_features(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
- struct segmentation *seg = &cm->seg;
+ VP9_COMMON *const cm = &cpi->common;
+ struct segmentation *const seg = &cm->seg;
int high_q = (int)(cpi->rc.avg_q > 48.0);
int qi_delta;
@@ -431,13 +428,13 @@ static void print_seg_map(VP9_COMP *cpi) {
static void update_reference_segmentation_map(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
+ MODE_INFO **mi_8x8_ptr = cm->mi_grid_visible;
+ uint8_t *cache_ptr = cm->last_frame_seg_map;
int row, col;
- MODE_INFO **mi_8x8, **mi_8x8_ptr = cm->mi_grid_visible;
- uint8_t *cache_ptr = cm->last_frame_seg_map, *cache;
for (row = 0; row < cm->mi_rows; row++) {
- mi_8x8 = mi_8x8_ptr;
- cache = cache_ptr;
+ MODE_INFO **mi_8x8 = mi_8x8_ptr;
+ uint8_t *cache = cache_ptr;
for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++)
cache[0] = mi_8x8[0]->mbmi.segment_id;
mi_8x8_ptr += cm->mode_info_stride;
@@ -975,16 +972,17 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
+ const VP9_CONFIG *oxcf = &cpi->oxcf;
- cpi->lookahead = vp9_lookahead_init(cpi->oxcf.width, cpi->oxcf.height,
+ cpi->lookahead = vp9_lookahead_init(oxcf->width, oxcf->height,
cm->subsampling_x, cm->subsampling_y,
- cpi->oxcf.lag_in_frames);
+ oxcf->lag_in_frames);
if (!cpi->lookahead)
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate lag buffers");
if (vp9_realloc_frame_buffer(&cpi->alt_ref_buffer,
- cpi->oxcf.width, cpi->oxcf.height,
+ oxcf->width, oxcf->height,
cm->subsampling_x, cm->subsampling_y,
VP9_ENC_BORDER_IN_PIXELS, NULL, NULL, NULL))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
@@ -2221,7 +2219,7 @@ static void calc_psnr(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b,
psnr->samples[1 + i] = samples;
psnr->psnr[1 + i] = vp9_mse2psnr(samples, 255.0, (double) sse);
- total_sse += (uint64_t)sse;
+ total_sse += sse;
total_samples += samples;
}
@@ -2740,7 +2738,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) {
FILE *const f = fopen("tmp.stt", cm->current_video_frame ? "a" : "w");
int recon_err;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
recon_err = vp9_calc_ss_err(cpi->Source, get_frame_new_buffer(cm));
@@ -2799,7 +2797,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
uint8_t *dest,
int q) {
VP9_COMMON *const cm = &cpi->common;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
vp9_set_quantizer(cpi, q);
// Set up entropy context depending on frame type. The decoder mandates
@@ -2828,7 +2826,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi,
// Update the skip mb flag probabilities based on the distribution
// seen in the last encoder iteration.
// update_base_skip_probs(cpi);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
}
static void encode_with_recode_loop(VP9_COMP *cpi,
@@ -2838,6 +2836,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
int bottom_index,
int top_index) {
VP9_COMMON *const cm = &cpi->common;
+ RATE_CONTROL *const rc = &cpi->rc;
int loop_count = 0;
int loop = 0;
int overshoot_seen = 0;
@@ -2847,12 +2846,12 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
int frame_under_shoot_limit;
// Decide frame size bounds
- vp9_rc_compute_frame_size_bounds(cpi, cpi->rc.this_frame_target,
+ vp9_rc_compute_frame_size_bounds(cpi, rc->this_frame_target,
&frame_under_shoot_limit,
&frame_over_shoot_limit);
do {
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
vp9_set_quantizer(cpi, q);
@@ -2887,7 +2886,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
// seen in the last encoder iteration.
// update_base_skip_probs(cpi);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
// Dummy pack of the bitstream using up to date stats to get an
// accurate estimate of output frame size to determine if we need
@@ -2898,7 +2897,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
if (!cpi->sf.use_pick_mode)
vp9_pack_bitstream(cpi, dest, size);
- cpi->rc.projected_frame_size = (int)(*size) << 3;
+ rc->projected_frame_size = (int)(*size) << 3;
vp9_restore_coding_context(cpi);
if (frame_over_shoot_limit == 0)
@@ -2909,8 +2908,8 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
loop = 0;
} else {
if ((cm->frame_type == KEY_FRAME) &&
- cpi->rc.this_key_frame_forced &&
- (cpi->rc.projected_frame_size < cpi->rc.max_frame_bandwidth)) {
+ rc->this_key_frame_forced &&
+ (rc->projected_frame_size < rc->max_frame_bandwidth)) {
int last_q = q;
int kf_err = vp9_calc_ss_err(cpi->Source, get_frame_new_buffer(cm));
@@ -2923,9 +2922,9 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
// The key frame is not good enough or we can afford
// to make it better without undue risk of popping.
if ((kf_err > high_err_target &&
- cpi->rc.projected_frame_size <= frame_over_shoot_limit) ||
+ rc->projected_frame_size <= frame_over_shoot_limit) ||
(kf_err > low_err_target &&
- cpi->rc.projected_frame_size <= frame_under_shoot_limit)) {
+ rc->projected_frame_size <= frame_under_shoot_limit)) {
// Lower q_high
q_high = q > q_low ? q - 1 : q_low;
@@ -2933,7 +2932,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
q = (q * high_err_target) / kf_err;
q = MIN(q, (q_high + q_low) >> 1);
} else if (kf_err < low_err_target &&
- cpi->rc.projected_frame_size >= frame_under_shoot_limit) {
+ rc->projected_frame_size >= frame_under_shoot_limit) {
// The key frame is much better than the previous frame
// Raise q_low
q_low = q < q_high ? q + 1 : q_high;
@@ -2959,10 +2958,10 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
// Update correction factor & compute new Q to try...
// Frame is too large
- if (cpi->rc.projected_frame_size > cpi->rc.this_frame_target) {
+ if (rc->projected_frame_size > rc->this_frame_target) {
// Special case if the projected size is > the max allowed.
- if (cpi->rc.projected_frame_size >= cpi->rc.max_frame_bandwidth)
- q_high = cpi->rc.worst_quality;
+ if (rc->projected_frame_size >= rc->max_frame_bandwidth)
+ q_high = rc->worst_quality;
// Raise Qlow as to at least the current value
q_low = q < q_high ? q + 1 : q_high;
@@ -2976,12 +2975,12 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
// Update rate_correction_factor unless
vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, cpi->rc.this_frame_target,
+ q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
bottom_index, MAX(q_high, top_index));
while (q < q_low && retries < 10) {
vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, cpi->rc.this_frame_target,
+ q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
bottom_index, MAX(q_high, top_index));
retries++;
}
@@ -2997,7 +2996,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
q = (q_high + q_low) / 2;
} else {
vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, cpi->rc.this_frame_target,
+ q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
bottom_index, top_index);
// Special case reset for qlow for constrained quality.
// This should only trigger where there is very substantial
@@ -3010,7 +3009,7 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
while (q > q_high && retries < 10) {
vp9_rc_update_rate_correction_factors(cpi, 0);
- q = vp9_rc_regulate_q(cpi, cpi->rc.this_frame_target,
+ q = vp9_rc_regulate_q(cpi, rc->this_frame_target,
bottom_index, top_index);
retries++;
}
@@ -3029,8 +3028,8 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
}
// Special case for overlay frame.
- if (cpi->rc.is_src_frame_alt_ref &&
- (cpi->rc.projected_frame_size < cpi->rc.max_frame_bandwidth))
+ if (rc->is_src_frame_alt_ref &&
+ rc->projected_frame_size < rc->max_frame_bandwidth)
loop = 0;
if (loop) {
@@ -3098,8 +3097,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
int top_index;
int bottom_index;
- SPEED_FEATURES *const sf = &cpi->sf;
- unsigned int max_mv_def = MIN(cm->width, cm->height);
+ const SPEED_FEATURES *const sf = &cpi->sf;
+ const unsigned int max_mv_def = MIN(cm->width, cm->height);
struct segmentation *const seg = &cm->seg;
set_ext_overrides(cpi);
@@ -3238,7 +3237,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
if (!frame_is_intra_only(cm)) {
cm->interp_filter = DEFAULT_INTERP_FILTER;
/* TODO: Decide this more intelligently */
- set_high_precision_mv(cpi, (q < HIGH_PRECISION_MV_QTHRESH));
+ set_high_precision_mv(cpi, q < HIGH_PRECISION_MV_QTHRESH);
}
if (cpi->sf.recode_loop == DISALLOW_RECODE) {
@@ -3431,6 +3430,7 @@ static void Pass2Encode(VP9_COMP *cpi, size_t *size,
static void check_initial_width(VP9_COMP *cpi, int subsampling_x,
int subsampling_y) {
VP9_COMMON *const cm = &cpi->common;
+
if (!cpi->initial_width) {
cm->subsampling_x = subsampling_x;
cm->subsampling_y = subsampling_y;
@@ -3444,12 +3444,12 @@ static void check_initial_width(VP9_COMP *cpi, int subsampling_x,
int vp9_receive_raw_frame(VP9_PTR ptr, unsigned int frame_flags,
YV12_BUFFER_CONFIG *sd, int64_t time_stamp,
int64_t end_time) {
- VP9_COMP *cpi = (VP9_COMP *) ptr;
- VP9_COMMON *cm = &cpi->common;
- struct vpx_usec_timer timer;
- int res = 0;
- const int subsampling_x = sd->uv_width < sd->y_width;
- const int subsampling_y = sd->uv_height < sd->y_height;
+ VP9_COMP *cpi = (VP9_COMP *)ptr;
+ VP9_COMMON *cm = &cpi->common;
+ struct vpx_usec_timer timer;
+ int res = 0;
+ const int subsampling_x = sd->uv_width < sd->y_width;
+ const int subsampling_y = sd->uv_height < sd->y_height;
check_initial_width(cpi, subsampling_x, subsampling_y);
vpx_usec_timer_start(&timer);
@@ -3681,7 +3681,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
*size = 0;
// Clear down mmx registers
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
/* find a free buffer for the new frame, releasing the reference previously
* held.
@@ -3843,22 +3843,23 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
int vp9_get_preview_raw_frame(VP9_PTR comp, YV12_BUFFER_CONFIG *dest,
vp9_ppflags_t *flags) {
- VP9_COMP *cpi = (VP9_COMP *) comp;
+ VP9_COMP *cpi = (VP9_COMP *)comp;
+ VP9_COMMON *cm = &cpi->common;
- if (!cpi->common.show_frame) {
+ if (!cm->show_frame) {
return -1;
} else {
int ret;
#if CONFIG_VP9_POSTPROC
- ret = vp9_post_proc_frame(&cpi->common, dest, flags);
+ ret = vp9_post_proc_frame(cm, dest, flags);
#else
- if (cpi->common.frame_to_show) {
- *dest = *cpi->common.frame_to_show;
- dest->y_width = cpi->common.width;
- dest->y_height = cpi->common.height;
- dest->uv_width = cpi->common.width >> cpi->common.subsampling_x;
- dest->uv_height = cpi->common.height >> cpi->common.subsampling_y;
+ if (cm->frame_to_show) {
+ *dest = *cm->frame_to_show;
+ dest->y_width = cm->width;
+ dest->y_height = cm->height;
+ dest->uv_width = cm->width >> cm->subsampling_x;
+ dest->uv_height = cm->height >> cm->subsampling_y;
ret = 0;
} else {
ret = -1;
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index a5560631f..f78ebfe18 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -354,7 +354,7 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
int projected_size_based_on_q = 0;
// Clear down mmx registers to allow floating point in what follows
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
// Work out how big we would have expected the frame to be at this Q given
// the current correction factor.
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index a3e879b82..074af0e96 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -274,7 +274,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) {
MACROBLOCK *x = &cpi->mb;
int qindex, i;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
// Further tests required to see if optimum is different
// for key frames, golden frames and arf frames.
diff --git a/vp9/encoder/vp9_vaq.c b/vp9/encoder/vp9_vaq.c
index 896cd2ca2..89570a648 100644
--- a/vp9/encoder/vp9_vaq.c
+++ b/vp9/encoder/vp9_vaq.c
@@ -44,7 +44,7 @@ unsigned int vp9_vaq_segment_id(int energy) {
double vp9_vaq_rdmult_ratio(int energy) {
ENERGY_IN_BOUNDS(energy);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
return RDMULT_RATIO(energy);
}
@@ -52,7 +52,7 @@ double vp9_vaq_rdmult_ratio(int energy) {
double vp9_vaq_inv_q_ratio(int energy) {
ENERGY_IN_BOUNDS(energy);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
return Q_RATIO(-energy);
}
@@ -63,7 +63,7 @@ void vp9_vaq_init() {
assert(ENERGY_SPAN <= MAX_SEGMENTS);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
base_ratio = 1.5;
@@ -88,7 +88,7 @@ void vp9_vaq_frame_setup(VP9_COMP *cpi) {
seg->abs_delta = SEGMENT_DELTADATA;
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
for (i = ENERGY_MIN; i <= ENERGY_MAX; i++) {
int qindex_delta, segment_rdmult;
@@ -141,7 +141,7 @@ int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
double energy;
unsigned int var = block_variance(cpi, x, bs);
- vp9_clear_system_state(); // __asm emms;
+ vp9_clear_system_state();
energy = 0.9 * (log(var + 1.0) - 10.0);
return clamp(round(energy), ENERGY_MIN, ENERGY_MAX);
diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
index d0ac1afc8..f7dde6272 100644
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -297,9 +297,16 @@ typedef struct vpx_svc_parameters {
int alt_fb_idx; /**< alt reference frame frame buffer index */
} vpx_svc_parameters_t;
+/*!\brief vp9 svc layer parameters
+ *
+ * This defines the spatial and temporal layer id numbers for svc encoding.
+ * This is used with the #VP9E_SET_SVC_LAYER_ID control to set the spatial and
+ * temporal layer id for the current frame.
+ *
+ */
typedef struct vpx_svc_layer_id {
- int spatial_layer_id;
- int temporal_layer_id;
+ int spatial_layer_id; /**< Spatial layer id number. */
+ int temporal_layer_id; /**< Temporal layer id number. */
} vpx_svc_layer_id_t;
/*!\brief VP8 encoder control function parameter type
diff --git a/vpx/vpx_frame_buffer.h b/vpx/vpx_frame_buffer.h
index 6803759d7..e69df4bc8 100644
--- a/vpx/vpx_frame_buffer.h
+++ b/vpx/vpx_frame_buffer.h
@@ -11,6 +11,10 @@
#ifndef VPX_VPX_FRAME_BUFFER_H_
#define VPX_VPX_FRAME_BUFFER_H_
+/*!\file
+ * \brief Describes the decoder external frame buffer interface.
+ */
+
#ifdef __cplusplus
extern "C" {
#endif