Index: libvpx/source/libvpx/vp8/encoder/encodeintra.c |
diff --git a/libvpx/source/libvpx/vp8/encoder/encodeintra.c b/libvpx/source/libvpx/vp8/encoder/encodeintra.c |
index 59db0253b466b3d8f3fdb3316da60857172174af..44000063c7d24e6f037f5331a812f42a7f046a32 100644 |
--- a/libvpx/source/libvpx/vp8/encoder/encodeintra.c |
+++ b/libvpx/source/libvpx/vp8/encoder/encodeintra.c |
@@ -21,50 +21,18 @@ |
#include "vp8/common/g_common.h" |
#include "encodeintra.h" |
+#define intra4x4ibias_rate 128 |
+#define intra4x4pbias_rate 256 |
+ |
#if CONFIG_RUNTIME_CPU_DETECT |
#define IF_RTCD(x) (x) |
#else |
#define IF_RTCD(x) NULL |
#endif |
- |
-int vp8_encode_intra(VP8_COMP *cpi, MACROBLOCK *x, int use_dc_pred) |
+void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x, BLOCK *be, BLOCKD *b, int best_mode) |
{ |
- |
- int i; |
- int intra_pred_var = 0; |
- (void) cpi; |
- |
- if (use_dc_pred) |
- { |
- x->e_mbd.mode_info_context->mbmi.mode = DC_PRED; |
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; |
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME; |
- |
- vp8_encode_intra16x16mby(IF_RTCD(&cpi->rtcd), x); |
- } |
- else |
- { |
- for (i = 0; i < 16; i++) |
- { |
- x->e_mbd.block[i].bmi.as_mode = B_DC_PRED; |
- vp8_encode_intra4x4block(IF_RTCD(&cpi->rtcd), x, i); |
- } |
- } |
- |
- intra_pred_var = VARIANCE_INVOKE(&cpi->rtcd.variance, getmbss)(x->src_diff); |
- |
- return intra_pred_var; |
-} |
- |
-void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd, |
- MACROBLOCK *x, int ib) |
-{ |
- BLOCKD *b = &x->e_mbd.block[ib]; |
- BLOCK *be = &x->block[ib]; |
- |
- RECON_INVOKE(&rtcd->common->recon, intra4x4_predict) |
- (b, b->bmi.as_mode, b->predictor); |
+ vp8_predict_intra4x4(b, best_mode, b->predictor); |
ENCODEMB_INVOKE(&rtcd->encodemb, subb)(be, b, 16); |
@@ -85,35 +53,72 @@ void vp8_encode_intra4x4mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb) |
vp8_intra_prediction_down_copy(x); |
for (i = 0; i < 16; i++) |
- vp8_encode_intra4x4block(rtcd, mb, i); |
+ { |
+ BLOCK *be = &mb->block[i]; |
+ BLOCKD *b = &x->block[i]; |
+ |
+ vp8_encode_intra4x4block(rtcd, mb, be, b, b->bmi.mode); |
+ } |
+ |
return; |
} |
void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) |
{ |
- BLOCK *b = &x->block[0]; |
+ int b; |
RECON_INVOKE(&rtcd->common->recon, build_intra_predictors_mby)(&x->e_mbd); |
- ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, *(b->base_src), x->e_mbd.predictor, b->src_stride); |
+ ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_mbd.predictor, x->src.y_stride); |
vp8_transform_intra_mby(x); |
vp8_quantize_mby(x); |
+#if !(CONFIG_REALTIME_ONLY) |
+#if 1 |
if (x->optimize) |
vp8_optimize_mby(x, rtcd); |
+#endif |
+#endif |
+ |
vp8_inverse_transform_mby(IF_RTCD(&rtcd->common->idct), &x->e_mbd); |
RECON_INVOKE(&rtcd->common->recon, recon_mby) |
(IF_RTCD(&rtcd->common->recon), &x->e_mbd); |
+ // make sure block modes are set the way we want them for context updates |
+ for (b = 0; b < 16; b++) |
+ { |
+ BLOCKD *d = &x->e_mbd.block[b]; |
+ |
+ switch (x->e_mbd.mode_info_context->mbmi.mode) |
+ { |
+ |
+ case DC_PRED: |
+ d->bmi.mode = B_DC_PRED; |
+ break; |
+ case V_PRED: |
+ d->bmi.mode = B_VE_PRED; |
+ break; |
+ case H_PRED: |
+ d->bmi.mode = B_HE_PRED; |
+ break; |
+ case TM_PRED: |
+ d->bmi.mode = B_TM_PRED; |
+ break; |
+ default: |
+ d->bmi.mode = B_DC_PRED; |
+ break; |
+ |
+ } |
+ } |
} |
void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) |
{ |
- RECON_INVOKE(&rtcd->common->recon, build_intra_predictors_mbuv)(&x->e_mbd); |
+ vp8_build_intra_predictors_mbuv(&x->e_mbd); |
ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->e_mbd.predictor, x->src.uv_stride); |
@@ -121,10 +126,17 @@ void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) |
vp8_quantize_mbuv(x); |
- if (x->optimize) |
+#if !(CONFIG_REALTIME_ONLY) |
+#if 1 |
+ |
+ if (x->optimize==2 ||(x->optimize && x->rddiv > 1)) |
vp8_optimize_mbuv(x, rtcd); |
+#endif |
+#endif |
+ |
vp8_inverse_transform_mbuv(IF_RTCD(&rtcd->common->idct), &x->e_mbd); |
vp8_recon_intra_mbuv(IF_RTCD(&rtcd->common->recon), &x->e_mbd); |
} |
+ |