aom: Add comments about the size of tiles in tile list

From 390e280830fc5e270b094cc919181f970825083a Mon Sep 17 00:00:00 2001
From: Wan-Teh Chang <[EMAIL REDACTED]>
Date: Mon, 4 Mar 2024 14:16:24 -0800
Subject: [PATCH] Add comments about the size of tiles in tile list

Change-Id: Idf5f19bf073d019e35270d267e402274b9329f52
---
 aom/aomdx.h              | 7 +++++--
 av1/common/tile_common.c | 9 +++++++++
 av1/common/tile_common.h | 1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/aom/aomdx.h b/aom/aomdx.h
index 02ea19597c..2dd7bb3375 100644
--- a/aom/aomdx.h
+++ b/aom/aomdx.h
@@ -234,8 +234,11 @@ enum aom_dec_control_id {
    */
   AV1D_GET_IMG_FORMAT,
 
-  /*!\brief Codec control function to get the size of the tile, unsigned int*
-   * parameter
+  /*!\brief Codec control function to get the width and height (in pixels) of
+   * the tiles in a tile list, unsigned int* parameter
+   *
+   * Tile width is in the high 16 bits of the output value, and tile height is
+   * in the low 16 bits of the output value.
    */
   AV1D_GET_TILE_SIZE,
 
diff --git a/av1/common/tile_common.c b/av1/common/tile_common.c
index b073759f3c..45a189d69a 100644
--- a/av1/common/tile_common.c
+++ b/av1/common/tile_common.c
@@ -177,6 +177,15 @@ int av1_get_sb_cols_in_tile(const AV1_COMMON *cm, const TileInfo *tile) {
                            cm->seq_params->mib_size_log2);
 }
 
+// Section 7.3.1 of the AV1 spec says, on pages 200-201:
+//   It is a requirement of bitstream conformance that the following conditions
+//   are met:
+//     ...
+//     * TileHeight is equal to (use_128x128_superblock ? 128 : 64) for all
+//       tiles (i.e. the tile is exactly one superblock high)
+//     * TileWidth is identical for all tiles and is an integer multiple of
+//       TileHeight (i.e. the tile is an integer number of superblocks wide)
+//     ...
 bool av1_get_uniform_tile_size(const AV1_COMMON *cm, int *w, int *h) {
   const CommonTileParams *const tiles = &cm->tiles;
   if (tiles->uniform_spacing) {
diff --git a/av1/common/tile_common.h b/av1/common/tile_common.h
index 203c354525..12228c9e94 100644
--- a/av1/common/tile_common.h
+++ b/av1/common/tile_common.h
@@ -53,6 +53,7 @@ int av1_get_sb_cols_in_tile(const struct AV1Common *cm, const TileInfo *tile);
 #define MAX_TILE_AREA_LEVEL_7_AND_ABOVE (4096 * 4608)
 #endif
 
+// Gets the width and height (in units of MI_SIZE) of the tiles in a tile list.
 // Returns true on success, false on failure.
 bool av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h);
 void av1_get_tile_limits(struct AV1Common *const cm);