Home | History | Annotate | Download | only in encoder
      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 
     12 #ifndef __INC_BLOCK_H
     13 #define __INC_BLOCK_H
     14 
     15 #include "onyx.h"
     16 #include "blockd.h"
     17 #include "entropymv.h"
     18 #include "entropy.h"
     19 #include "vpx_ports/mem.h"
     20 
     21 // motion search site
     22 typedef struct
     23 {
     24     MV mv;
     25     int offset;
     26 } search_site;
     27 
     28 typedef struct
     29 {
     30     // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
     31     short *src_diff;
     32     short *coeff;
     33 
     34     // 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries
     35     short *quant;
     36     short *quant_shift;
     37     short *zbin;
     38     short *zrun_zbin_boost;
     39     short *round;
     40 
     41     // Zbin Over Quant value
     42     short zbin_extra;
     43 
     44     unsigned char **base_src;
     45     int src;
     46     int src_stride;
     47 
     48 //  MV  enc_mv;
     49     int force_empty;
     50 
     51 } BLOCK;
     52 
     53 typedef struct
     54 {
     55     int count;
     56     B_MODE_INFO bmi[16];
     57 } PARTITION_INFO;
     58 
     59 typedef struct
     60 {
     61     DECLARE_ALIGNED(16, short, src_diff[400]);       // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
     62     DECLARE_ALIGNED(16, short, coeff[400]);     // 16x16 Y 8x8 U 8x8 V 4x4 2nd Y
     63 
     64     // 16 Y blocks, 4 U blocks, 4 V blocks, 1 DC 2nd order block each with 16 entries
     65     BLOCK block[25];
     66 
     67     YV12_BUFFER_CONFIG src;
     68 
     69     MACROBLOCKD e_mbd;
     70     PARTITION_INFO *partition_info; /* work pointer */
     71     PARTITION_INFO *pi;   /* Corresponds to upper left visible macroblock */
     72     PARTITION_INFO *pip;  /* Base of allocated array */
     73 
     74     search_site *ss;
     75     int ss_count;
     76     int searches_per_step;
     77 
     78     int errorperbit;
     79     int sadperbit16;
     80     int sadperbit4;
     81     int errthresh;
     82     int rddiv;
     83     int rdmult;
     84 
     85     int mvcosts[2][MVvals+1];
     86     int *mvcost[2];
     87     int mvsadcosts[2][MVvals+1];
     88     int *mvsadcost[2];
     89     int mbmode_cost[2][MB_MODE_COUNT];
     90     int intra_uv_mode_cost[2][MB_MODE_COUNT];
     91     unsigned int bmode_costs[10][10][10];
     92     unsigned int inter_bmode_costs[B_MODE_COUNT];
     93 
     94     // These define limits to motion vector components to prevent them from extending outside the UMV borders
     95     int mv_col_min;
     96     int mv_col_max;
     97     int mv_row_min;
     98     int mv_row_max;
     99 
    100     int vector_range;    // Used to monitor limiting range of recent vectors to guide search.
    101     int skip;
    102 
    103     int encode_breakout;
    104 
    105     //char * gf_active_ptr;
    106     signed char *gf_active_ptr;
    107 
    108     unsigned char *active_ptr;
    109     MV_CONTEXT *mvc;
    110 
    111     unsigned int token_costs[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef_tokens];
    112     int optimize;
    113 
    114     void (*vp8_short_fdct4x4)(short *input, short *output, int pitch);
    115     void (*vp8_short_fdct8x4)(short *input, short *output, int pitch);
    116     void (*short_walsh4x4)(short *input, short *output, int pitch);
    117     void (*quantize_b)(BLOCK *b, BLOCKD *d);
    118 
    119 } MACROBLOCK;
    120 
    121 
    122 #endif
    123