Home | History | Annotate | Download | only in common
      1 /*
      2  *  Copyright (c) 2013 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 #ifndef VP9_COMMON_VP9_SCAN_H_
     12 #define VP9_COMMON_VP9_SCAN_H_
     13 
     14 #include "vpx/vpx_integer.h"
     15 #include "vpx_ports/mem.h"
     16 
     17 #include "vp9/common/vp9_enums.h"
     18 #include "vp9/common/vp9_blockd.h"
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 #define MAX_NEIGHBORS 2
     25 
     26 void vp9_init_neighbors();
     27 
     28 typedef struct {
     29   const int16_t *scan;
     30   const int16_t *iscan;
     31   const int16_t *neighbors;
     32 } scan_order;
     33 
     34 extern const scan_order vp9_default_scan_orders[TX_SIZES];
     35 extern const scan_order vp9_scan_orders[TX_SIZES][TX_TYPES];
     36 
     37 static INLINE int get_coef_context(const int16_t *neighbors,
     38                                    const uint8_t *token_cache, int c) {
     39   return (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
     40           token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
     41 }
     42 
     43 #ifdef __cplusplus
     44 }  // extern "C"
     45 #endif
     46 
     47 #endif  // VP9_COMMON_VP9_SCAN_H_
     48