1 /*
2  * Copyright (c) 2017, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license.
10  */
11 #ifndef AOM_INSPECTION_H_
12 #define AOM_INSPECTION_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif  // __cplusplus
17 
18 #ifndef AOM_AOMDX_H_
19 typedef void (*aom_inspect_cb)(void *decoder, void *data);
20 #endif
21 
22 #define MAX_SEGMENTS 8
23 
24 typedef struct insp_mv insp_mv;
25 
26 struct insp_mv {
27   int16_t row;
28   int16_t col;
29 };
30 
31 typedef struct insp_mi_data insp_mi_data;
32 
33 struct insp_mi_data {
34   insp_mv mv[2];
35   int16_t ref_frame[2];
36   int16_t mode;
37   int16_t uv_mode;
38   int16_t sb_type;
39   int16_t skip;
40   int16_t segment_id;
41   int16_t dual_filter_type;
42   int16_t filter[2];
43   int16_t tx_type;
44   int16_t tx_size;
45   int16_t cdef_level;
46   int16_t cdef_strength;
47   int16_t cfl_alpha_idx;
48   int16_t cfl_alpha_sign;
49   int16_t current_qindex;
50 };
51 
52 typedef struct insp_frame_data insp_frame_data;
53 
54 struct insp_frame_data {
55 #if CONFIG_ACCOUNTING
56   Accounting *accounting;
57 #endif
58   insp_mi_data *mi_grid;
59   int show_frame;
60   int frame_type;
61   int base_qindex;
62   int mi_rows;
63   int mi_cols;
64   int tile_mi_rows;
65   int tile_mi_cols;
66   int16_t y_dequant[MAX_SEGMENTS][2];
67   int16_t u_dequant[MAX_SEGMENTS][2];
68   int16_t v_dequant[MAX_SEGMENTS][2];
69   // TODO(negge): add per frame CDEF data
70   int delta_q_present_flag;
71   int delta_q_res;
72 };
73 
74 void ifd_init(insp_frame_data *fd, int frame_width, int frame_height);
75 void ifd_clear(insp_frame_data *fd);
76 int ifd_inspect(insp_frame_data *fd, void *decoder);
77 
78 #ifdef __cplusplus
79 }  // extern "C"
80 #endif  // __cplusplus
81 #endif  // AOM_INSPECTION_H_
82