xref: /aosp_15_r20/external/libvpx/vpx/vpx_tpl.h (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
1 /*
2  *  Copyright (c) 2023 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 /*!\file
12  * \brief Describes the TPL stats descriptor and associated operations
13  *
14  */
15 #ifndef VPX_VPX_VPX_TPL_H_
16 #define VPX_VPX_VPX_TPL_H_
17 
18 #include "./vpx_integer.h"
19 #include "./vpx_codec.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /*!\brief Current ABI version number
26  *
27  * \internal
28  * If this file is altered in any way that changes the ABI, this value
29  * must be bumped.  Examples include, but are not limited to, changing
30  * types, removing or reassigning enums, adding/removing/rearranging
31  * fields to structures
32  */
33 #define VPX_TPL_ABI_VERSION 4 /**<\hideinitializer*/
34 
35 /*!\brief Temporal dependency model stats for each block before propagation */
36 typedef struct VpxTplBlockStats {
37   int16_t row;            /**< Pixel row of the top left corner */
38   int16_t col;            /**< Pixel col of the top left corner */
39   int64_t intra_cost;     /**< Intra cost */
40   int64_t inter_cost;     /**< Inter cost */
41   int16_t mv_r;           /**< Motion vector row */
42   int16_t mv_c;           /**< Motion vector col */
43   int64_t srcrf_rate;     /**< Rate from source ref frame */
44   int64_t srcrf_dist;     /**< Distortion from source ref frame */
45   int64_t inter_pred_err; /**< Inter prediction error */
46   int64_t intra_pred_err; /**< Intra prediction error */
47   int ref_frame_index;    /**< Ref frame index in the ref frame buffer */
48 } VpxTplBlockStats;
49 
50 /*!\brief Temporal dependency model stats for each frame before propagation */
51 typedef struct VpxTplFrameStats {
52   int frame_width;  /**< Frame width */
53   int frame_height; /**< Frame height */
54   int num_blocks;   /**< Number of blocks. Size of block_stats_list */
55   VpxTplBlockStats *block_stats_list; /**< List of tpl stats for each block */
56 } VpxTplFrameStats;
57 
58 /*!\brief Temporal dependency model stats for each GOP before propagation */
59 typedef struct VpxTplGopStats {
60   int size; /**< GOP size, also the size of frame_stats_list. */
61   VpxTplFrameStats *frame_stats_list; /**< List of tpl stats for each frame */
62 } VpxTplGopStats;
63 
64 #ifdef __cplusplus
65 }  // extern "C"
66 #endif
67 
68 #endif  // VPX_VPX_VPX_TPL_H_
69