1*77c1e3ccSAndroid Build Coastguard Worker /* 2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2016, Alliance for Open Media. All rights reserved. 3*77c1e3ccSAndroid Build Coastguard Worker * 4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and 5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can 7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the 9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10*77c1e3ccSAndroid Build Coastguard Worker */ 11*77c1e3ccSAndroid Build Coastguard Worker 12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_AV1_COMMON_TILE_COMMON_H_ 13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_AV1_COMMON_TILE_COMMON_H_ 14*77c1e3ccSAndroid Build Coastguard Worker 15*77c1e3ccSAndroid Build Coastguard Worker #include <stdbool.h> 16*77c1e3ccSAndroid Build Coastguard Worker 17*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_config.h" 18*77c1e3ccSAndroid Build Coastguard Worker 19*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus 20*77c1e3ccSAndroid Build Coastguard Worker extern "C" { 21*77c1e3ccSAndroid Build Coastguard Worker #endif 22*77c1e3ccSAndroid Build Coastguard Worker 23*77c1e3ccSAndroid Build Coastguard Worker struct AV1Common; 24*77c1e3ccSAndroid Build Coastguard Worker struct SequenceHeader; 25*77c1e3ccSAndroid Build Coastguard Worker struct CommonTileParams; 26*77c1e3ccSAndroid Build Coastguard Worker 27*77c1e3ccSAndroid Build Coastguard Worker #define DEFAULT_MAX_NUM_TG 1 28*77c1e3ccSAndroid Build Coastguard Worker 29*77c1e3ccSAndroid Build Coastguard Worker typedef struct TileInfo { 30*77c1e3ccSAndroid Build Coastguard Worker int mi_row_start, mi_row_end; 31*77c1e3ccSAndroid Build Coastguard Worker int mi_col_start, mi_col_end; 32*77c1e3ccSAndroid Build Coastguard Worker int tile_row; 33*77c1e3ccSAndroid Build Coastguard Worker int tile_col; 34*77c1e3ccSAndroid Build Coastguard Worker } TileInfo; 35*77c1e3ccSAndroid Build Coastguard Worker 36*77c1e3ccSAndroid Build Coastguard Worker // initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on 37*77c1e3ccSAndroid Build Coastguard Worker // 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)' 38*77c1e3ccSAndroid Build Coastguard Worker void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row, 39*77c1e3ccSAndroid Build Coastguard Worker int col); 40*77c1e3ccSAndroid Build Coastguard Worker 41*77c1e3ccSAndroid Build Coastguard Worker void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row); 42*77c1e3ccSAndroid Build Coastguard Worker void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col); 43*77c1e3ccSAndroid Build Coastguard Worker 44*77c1e3ccSAndroid Build Coastguard Worker int av1_get_sb_rows_in_tile(const struct AV1Common *cm, const TileInfo *tile); 45*77c1e3ccSAndroid Build Coastguard Worker int av1_get_sb_cols_in_tile(const struct AV1Common *cm, const TileInfo *tile); 46*77c1e3ccSAndroid Build Coastguard Worker 47*77c1e3ccSAndroid Build Coastguard Worker // Define tile maximum width and area 48*77c1e3ccSAndroid Build Coastguard Worker // There is no maximum height since height is limited by area and width limits 49*77c1e3ccSAndroid Build Coastguard Worker // The minimum tile width or height is fixed at one superblock 50*77c1e3ccSAndroid Build Coastguard Worker #define MAX_TILE_WIDTH (4096) // Max Tile width in pixels 51*77c1e3ccSAndroid Build Coastguard Worker #define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels 52*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_CWG_C013 53*77c1e3ccSAndroid Build Coastguard Worker #define MAX_TILE_AREA_LEVEL_7_AND_ABOVE (4096 * 4608) 54*77c1e3ccSAndroid Build Coastguard Worker #endif 55*77c1e3ccSAndroid Build Coastguard Worker 56*77c1e3ccSAndroid Build Coastguard Worker // Gets the width and height (in units of MI_SIZE) of the tiles in a tile list. 57*77c1e3ccSAndroid Build Coastguard Worker // Returns true on success, false on failure. 58*77c1e3ccSAndroid Build Coastguard Worker bool av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h); 59*77c1e3ccSAndroid Build Coastguard Worker void av1_get_tile_limits(struct AV1Common *const cm); 60*77c1e3ccSAndroid Build Coastguard Worker void av1_calculate_tile_cols(const struct SequenceHeader *const seq_params, 61*77c1e3ccSAndroid Build Coastguard Worker int cm_mi_rows, int cm_mi_cols, 62*77c1e3ccSAndroid Build Coastguard Worker struct CommonTileParams *const tiles); 63*77c1e3ccSAndroid Build Coastguard Worker void av1_calculate_tile_rows(const struct SequenceHeader *const seq_params, 64*77c1e3ccSAndroid Build Coastguard Worker int cm_mi_rows, 65*77c1e3ccSAndroid Build Coastguard Worker struct CommonTileParams *const tiles); 66*77c1e3ccSAndroid Build Coastguard Worker 67*77c1e3ccSAndroid Build Coastguard Worker // Checks if the minimum tile_width requirement is satisfied 68*77c1e3ccSAndroid Build Coastguard Worker int av1_is_min_tile_width_satisfied(const struct AV1Common *cm); 69*77c1e3ccSAndroid Build Coastguard Worker 70*77c1e3ccSAndroid Build Coastguard Worker #ifdef __cplusplus 71*77c1e3ccSAndroid Build Coastguard Worker } // extern "C" 72*77c1e3ccSAndroid Build Coastguard Worker #endif 73*77c1e3ccSAndroid Build Coastguard Worker 74*77c1e3ccSAndroid Build Coastguard Worker #endif // AOM_AV1_COMMON_TILE_COMMON_H_ 75