tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

wedge.h (4428B)


      1 /*
      2 * Copyright © 2018, VideoLAN and dav1d authors
      3 * Copyright © 2018, Two Orioles, LLC
      4 * All rights reserved.
      5 *
      6 * Redistribution and use in source and binary forms, with or without
      7 * modification, are permitted provided that the following conditions are met:
      8 *
      9 * 1. Redistributions of source code must retain the above copyright notice, this
     10 *    list of conditions and the following disclaimer.
     11 *
     12 * 2. Redistributions in binary form must reproduce the above copyright notice,
     13 *    this list of conditions and the following disclaimer in the documentation
     14 *    and/or other materials provided with the distribution.
     15 *
     16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
     17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
     20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26 */
     27 
     28 #ifndef DAV1D_SRC_WEDGE_H
     29 #define DAV1D_SRC_WEDGE_H
     30 
     31 #include "src/levels.h"
     32 
     33 typedef struct {
     34    /* Offsets, in units of 8 bytes, relative to the start of the struct. */
     35    struct {
     36        uint16_t wedge[2 /* sign */][16 /* wedge_idx */];
     37        uint16_t ii[N_INTER_INTRA_PRED_MODES];
     38    } offsets[3 /* 444, 422, 420 */][BS_8x8 - BS_32x32 + 1];
     39 
     40    uint8_t ALIGN(wedge_444_32x32[    16 * 32 * 32], 64);
     41    uint8_t ALIGN(wedge_444_32x16[    16 * 32 * 16], 64);
     42    uint8_t ALIGN(wedge_444_32x8 [    16 * 32 *  8], 64);
     43    uint8_t ALIGN(wedge_444_16x32[    16 * 16 * 32], 64);
     44    uint8_t ALIGN(wedge_444_16x16[    16 * 16 * 16], 64);
     45    uint8_t ALIGN(wedge_444_16x8 [    16 * 16 *  8], 64);
     46    uint8_t ALIGN(wedge_444_8x32 [    16 *  8 * 32], 64);
     47    uint8_t ALIGN(wedge_444_8x16 [    16 *  8 * 16], 64);
     48    uint8_t ALIGN(wedge_444_8x8  [    16 *  8 *  8], 64);
     49 
     50    uint8_t ALIGN(wedge_422_16x32[2 * 16 * 16 * 32], 64);
     51    uint8_t ALIGN(wedge_422_16x16[2 * 16 * 16 * 16], 64);
     52    uint8_t ALIGN(wedge_422_16x8 [2 * 16 * 16 *  8], 64);
     53    uint8_t ALIGN(wedge_422_8x32 [2 * 16 *  8 * 32], 64);
     54    uint8_t ALIGN(wedge_422_8x16 [2 * 16 *  8 * 16], 64);
     55    uint8_t ALIGN(wedge_422_8x8  [2 * 16 *  8 *  8], 64);
     56    uint8_t ALIGN(wedge_422_4x32 [2 * 16 *  4 * 32], 64);
     57    uint8_t ALIGN(wedge_422_4x16 [2 * 16 *  4 * 16], 64);
     58    uint8_t ALIGN(wedge_422_4x8  [2 * 16 *  4 *  8], 64);
     59 
     60    uint8_t ALIGN(wedge_420_16x16[2 * 16 * 16 * 16], 64);
     61    uint8_t ALIGN(wedge_420_16x8 [2 * 16 * 16 *  8], 64);
     62    uint8_t ALIGN(wedge_420_16x4 [2 * 16 * 16 *  4], 64);
     63    uint8_t ALIGN(wedge_420_8x16 [2 * 16 *  8 * 16], 64);
     64    uint8_t ALIGN(wedge_420_8x8  [2 * 16 *  8 *  8], 64);
     65    uint8_t ALIGN(wedge_420_8x4  [2 * 16 *  8 *  4], 64);
     66    uint8_t ALIGN(wedge_420_4x16 [2 * 16 *  4 * 16], 64);
     67    uint8_t ALIGN(wedge_420_4x8  [2 * 16 *  4 *  8], 64);
     68    uint8_t ALIGN(wedge_420_4x4  [2 * 16 *  4 *  4], 64);
     69 
     70    uint8_t ALIGN(ii_dc         [    32 * 32], 64);
     71    uint8_t ALIGN(ii_nondc_32x32[3 * 32 * 32], 64);
     72    uint8_t ALIGN(ii_nondc_16x32[3 * 16 * 32], 64);
     73    uint8_t ALIGN(ii_nondc_16x16[3 * 16 * 16], 64);
     74    uint8_t ALIGN(ii_nondc_8x32 [3 *  8 * 32], 64);
     75    uint8_t ALIGN(ii_nondc_8x16 [3 *  8 * 16], 64);
     76    uint8_t ALIGN(ii_nondc_8x8  [3 *  8 *  8], 64);
     77    uint8_t ALIGN(ii_nondc_4x16 [3 *  4 * 16], 64);
     78    uint8_t ALIGN(ii_nondc_4x8  [3 *  4 *  8], 32);
     79    uint8_t ALIGN(ii_nondc_4x4  [3 *  4 *  4], 16);
     80 } Dav1dMasks;
     81 
     82 #define II_MASK(c, bs, b) \
     83    ((const uint8_t*)((uintptr_t)&dav1d_masks + \
     84    (size_t)((b)->interintra_type == INTER_INTRA_BLEND ? \
     85    dav1d_masks.offsets[c][(bs)-BS_32x32].ii[(b)->interintra_mode] : \
     86    dav1d_masks.offsets[c][(bs)-BS_32x32].wedge[0][(b)->wedge_idx]) * 8))
     87 
     88 #define WEDGE_MASK(c, bs, sign, idx) \
     89    ((const uint8_t*)((uintptr_t)&dav1d_masks + \
     90    (size_t)dav1d_masks.offsets[c][(bs)-BS_32x32].wedge[sign][idx] * 8))
     91 
     92 EXTERN Dav1dMasks dav1d_masks;
     93 
     94 void dav1d_init_ii_wedge_masks(void);
     95 
     96 #endif /* DAV1D_SRC_WEDGE_H */