LCOV - code coverage report
Current view: top level - media/libvpx/libvpx/vp8/encoder - encodeintra.c (source / functions) Hit Total Coverage
Test: output.info Lines: 0 58 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #include "vpx_config.h"
      12             : #include "vp8_rtcd.h"
      13             : #include "./vpx_dsp_rtcd.h"
      14             : #include "vp8/encoder/quantize.h"
      15             : #include "vp8/common/reconintra.h"
      16             : #include "vp8/common/reconintra4x4.h"
      17             : #include "encodemb.h"
      18             : #include "vp8/common/invtrans.h"
      19             : #include "encodeintra.h"
      20             : 
      21           0 : int vp8_encode_intra(VP8_COMP *cpi, MACROBLOCK *x, int use_dc_pred) {
      22             :   int i;
      23           0 :   int intra_pred_var = 0;
      24             :   (void)cpi;
      25             : 
      26           0 :   if (use_dc_pred) {
      27           0 :     x->e_mbd.mode_info_context->mbmi.mode = DC_PRED;
      28           0 :     x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
      29           0 :     x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
      30             : 
      31           0 :     vp8_encode_intra16x16mby(x);
      32             : 
      33           0 :     vp8_inverse_transform_mby(&x->e_mbd);
      34             :   } else {
      35           0 :     for (i = 0; i < 16; ++i) {
      36           0 :       x->e_mbd.block[i].bmi.as_mode = B_DC_PRED;
      37           0 :       vp8_encode_intra4x4block(x, i);
      38             :     }
      39             :   }
      40             : 
      41           0 :   intra_pred_var = vpx_get_mb_ss(x->src_diff);
      42             : 
      43           0 :   return intra_pred_var;
      44             : }
      45             : 
      46           0 : void vp8_encode_intra4x4block(MACROBLOCK *x, int ib) {
      47           0 :   BLOCKD *b = &x->e_mbd.block[ib];
      48           0 :   BLOCK *be = &x->block[ib];
      49           0 :   int dst_stride = x->e_mbd.dst.y_stride;
      50           0 :   unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset;
      51           0 :   unsigned char *Above = dst - dst_stride;
      52           0 :   unsigned char *yleft = dst - 1;
      53           0 :   unsigned char top_left = Above[-1];
      54             : 
      55           0 :   vp8_intra4x4_predict(Above, yleft, dst_stride, b->bmi.as_mode, b->predictor,
      56             :                        16, top_left);
      57             : 
      58           0 :   vp8_subtract_b(be, b, 16);
      59             : 
      60           0 :   x->short_fdct4x4(be->src_diff, be->coeff, 32);
      61             : 
      62           0 :   x->quantize_b(be, b);
      63             : 
      64           0 :   if (*b->eob > 1) {
      65           0 :     vp8_short_idct4x4llm(b->dqcoeff, b->predictor, 16, dst, dst_stride);
      66             :   } else {
      67           0 :     vp8_dc_only_idct_add(b->dqcoeff[0], b->predictor, 16, dst, dst_stride);
      68             :   }
      69           0 : }
      70             : 
      71           0 : void vp8_encode_intra4x4mby(MACROBLOCK *mb) {
      72             :   int i;
      73             : 
      74           0 :   MACROBLOCKD *xd = &mb->e_mbd;
      75           0 :   intra_prediction_down_copy(xd, xd->dst.y_buffer - xd->dst.y_stride + 16);
      76             : 
      77           0 :   for (i = 0; i < 16; ++i) vp8_encode_intra4x4block(mb, i);
      78           0 :   return;
      79             : }
      80             : 
      81           0 : void vp8_encode_intra16x16mby(MACROBLOCK *x) {
      82           0 :   BLOCK *b = &x->block[0];
      83           0 :   MACROBLOCKD *xd = &x->e_mbd;
      84             : 
      85           0 :   vp8_build_intra_predictors_mby_s(xd, xd->dst.y_buffer - xd->dst.y_stride,
      86           0 :                                    xd->dst.y_buffer - 1, xd->dst.y_stride,
      87           0 :                                    xd->dst.y_buffer, xd->dst.y_stride);
      88             : 
      89           0 :   vp8_subtract_mby(x->src_diff, *(b->base_src), b->src_stride, xd->dst.y_buffer,
      90             :                    xd->dst.y_stride);
      91             : 
      92           0 :   vp8_transform_intra_mby(x);
      93             : 
      94           0 :   vp8_quantize_mby(x);
      95             : 
      96           0 :   if (x->optimize) vp8_optimize_mby(x);
      97           0 : }
      98             : 
      99           0 : void vp8_encode_intra16x16mbuv(MACROBLOCK *x) {
     100           0 :   MACROBLOCKD *xd = &x->e_mbd;
     101             : 
     102           0 :   vp8_build_intra_predictors_mbuv_s(xd, xd->dst.u_buffer - xd->dst.uv_stride,
     103           0 :                                     xd->dst.v_buffer - xd->dst.uv_stride,
     104           0 :                                     xd->dst.u_buffer - 1, xd->dst.v_buffer - 1,
     105           0 :                                     xd->dst.uv_stride, xd->dst.u_buffer,
     106           0 :                                     xd->dst.v_buffer, xd->dst.uv_stride);
     107             : 
     108           0 :   vp8_subtract_mbuv(x->src_diff, x->src.u_buffer, x->src.v_buffer,
     109           0 :                     x->src.uv_stride, xd->dst.u_buffer, xd->dst.v_buffer,
     110             :                     xd->dst.uv_stride);
     111             : 
     112           0 :   vp8_transform_mbuv(x);
     113             : 
     114           0 :   vp8_quantize_mbuv(x);
     115             : 
     116           0 :   if (x->optimize) vp8_optimize_mbuv(x);
     117           0 : }

Generated by: LCOV version 1.13