Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavcodec / av1_levels.h
1 /*
2  * Copyright (c) 2023 Intel Corporation
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef AVCODEC_AV1_LEVELS_H
22 #define AVCODEC_AV1_LEVELS_H
23
24 #include <stdint.h>
25
26 typedef struct AV1LevelDescriptor {
27     char     name[4];
28     uint8_t  level_idx;
29
30     uint32_t max_pic_size;
31     uint32_t max_h_size;
32     uint32_t max_v_size;
33     uint64_t max_display_rate;
34     uint64_t max_decode_rate;
35
36     uint32_t max_header_rate;
37     float    main_mbps;
38     float    high_mbps;
39     uint32_t main_cr;
40     uint32_t high_cr;
41     uint32_t max_tiles;
42     uint32_t max_tile_cols;
43 } AV1LevelDescriptor;
44
45 /**
46  * Guess the level of a stream from some parameters.
47  *
48  * Unknown parameters may be zero, in which case they will be ignored.
49  */
50 const AV1LevelDescriptor *ff_av1_guess_level(int64_t bitrate,
51                                              int tier,
52                                              int width,
53                                              int height,
54                                              int tile_rows,
55                                              int tile_cols,
56                                              float fps);
57
58 #endif /* AVCODEC_AV1_LEVELS_H */