tile_common.h 3.01 KB
Newer Older
Jingning Han's avatar
Jingning Han committed
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Jingning Han's avatar
Jingning Han committed
3
 *
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Jingning Han's avatar
Jingning Han committed
10 11
 */

12 13
#ifndef AV1_COMMON_TILE_COMMON_H_
#define AV1_COMMON_TILE_COMMON_H_
Jingning Han's avatar
Jingning Han committed
14 15 16 17 18

#ifdef __cplusplus
extern "C" {
#endif

19 20
#include "./aom_config.h"

21
struct AV1Common;
Jingning Han's avatar
Jingning Han committed
22

23
#define DEFAULT_MAX_NUM_TG 1
24

Jingning Han's avatar
Jingning Han committed
25 26 27
typedef struct TileInfo {
  int mi_row_start, mi_row_end;
  int mi_col_start, mi_col_end;
28
  int tg_horz_boundary;
Jingning Han's avatar
Jingning Han committed
29 30 31 32
} TileInfo;

// initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on
// 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)'
33 34
void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row,
                   int col);
Jingning Han's avatar
Jingning Han committed
35

36 37
void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row);
void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col);
38
#if CONFIG_DEPENDENT_HORZTILES
Ryan's avatar
Ryan committed
39
void av1_tile_set_tg_boundary(TileInfo *tile, const struct AV1Common *const cm,
40 41
                              int row, int col);
#endif
42
void av1_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols,
43
                         int *max_log2_tile_cols);
Jingning Han's avatar
Jingning Han committed
44

45
void av1_setup_frame_boundary_info(const struct AV1Common *const cm);
46

47 48
// Calculate the correct tile size (width or height) for (1 << log2_tile_num)
// tiles horizontally or vertically in the frame.
49
int get_tile_size(int mi_frame_size, int log2_tile_num, int *ntiles);
50

51 52 53
typedef struct {
  int left, top, right, bottom;
} AV1PixelRect;
54 55 56 57 58

// Return the pixel extents of the given tile
AV1PixelRect av1_get_tile_rect(const TileInfo *tile_info,
                               const struct AV1Common *cm, int is_uv);

59
#if CONFIG_LOOPFILTERING_ACROSS_TILES || CONFIG_LOOPFILTERING_ACROSS_TILES_EXT
David Barker's avatar
David Barker committed
60 61
void av1_setup_across_tile_boundary_info(const struct AV1Common *const cm,
                                         const TileInfo *const tile_info);
62
int av1_disable_loopfilter_on_tile_boundary(const struct AV1Common *cm);
63
#endif  // CONFIG_LOOPFILTERING_ACROSS_TILES
64

65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
#if CONFIG_MAX_TILE

// Define tile maximum width and area
// There is no maximum height since height is limited by area and width limits
// The minimum tile width or height is fixed at one superblock
#define MAX_TILE_WIDTH (4096)  // Max Tile width in pixels
#define MAX_TILE_WIDTH_SB (MAX_TILE_WIDTH >> MAX_SB_SIZE_LOG2)
#define MAX_TILE_AREA (4096 * 2304)  // Maximum tile area in pixels
#define MAX_TILE_AREA_SB (MAX_TILE_AREA >> (2 * MAX_SB_SIZE_LOG2))

void av1_get_tile_limits(struct AV1Common *const cm);
void av1_calculate_tile_cols(struct AV1Common *const cm);
void av1_calculate_tile_rows(struct AV1Common *const cm);
#endif

Jingning Han's avatar
Jingning Han committed
80 81 82 83
#ifdef __cplusplus
}  // extern "C"
#endif

84
#endif  // AV1_COMMON_TILE_COMMON_H_