xref: /aosp_15_r20/external/libavc/encoder/ih264e_trace.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /**
22 ******************************************************************************
23 * @file
24 *  ih264e_trace.h
25 *
26 * @brief
27 *  This file contains declarations of routines that could be helpful for
28 *  debugging purposes.
29 *
30 * @author
31 *  ittiam
32 *
33 * @remarks
34 *  none
35 *
36 *******************************************************************************
37 */
38 
39 #ifndef _IH264E_TRACE_H_
40 #define _IH264E_TRACE_H_
41 
42 #if ENABLE_TRACE
43 /*****************************************************************************/
44 /* Structures                                                                */
45 /*****************************************************************************/
46 
47 /**
48 ******************************************************************************
49  *  @brief      Data for the trace functionality
50 ******************************************************************************
51  */
52 typedef struct
53 {
54     /**
55      * fp
56      */
57     FILE    *fp;
58 }enc_trace_t;
59 
60 /*****************************************************************************/
61 /* Global variable declarations                                              */
62 /*****************************************************************************/
63 extern enc_trace_t g_enc_trace;
64 
65 /*****************************************************************************/
66 /* Constant Macros                                                           */
67 /*****************************************************************************/
68 
69 /**
70 ******************************************************************************
71  *  @brief      defines flag used for enabling trace
72 ******************************************************************************
73  */
74 
75 
76 /*****************************************************************************/
77 /* Function Macros                                                           */
78 /*****************************************************************************/
79 
80 /**
81 ******************************************************************************
82  *  @brief   Macro to print trace messages
83 ******************************************************************************
84  */
85 
86 #define ENTROPY_TRACE(syntax_string, value)                                    \
87     {                                                                          \
88         if(g_enc_trace.fp)                                                     \
89         {                                                                      \
90             fprintf( g_enc_trace.fp, "%-40s : %d\n", syntax_string, value );   \
91             fflush ( g_enc_trace.fp);                                          \
92         }                                                                      \
93     }
94 
95 
96 /**
97 ******************************************************************************
98  *  @brief   Macro to print CABAC trace messages
99 ******************************************************************************
100  */
101 
102 #define AEV_TRACE(string, value, range)                                      \
103     if(range && g_enc_trace.fp)                                              \
104     {                                                                        \
105         fprintf( g_enc_trace.fp, "%-40s:%8d R:%d\n", string, value, range);  \
106         fflush ( g_enc_trace.fp);                                            \
107     }
108 
109 #else
110 
111 /* Dummy macros when trace is disabled */
112 #define ENTROPY_TRACE(syntax_string, value)
113 
114 #define AEV_TRACE(string, value, range)
115 
116 #endif
117 
118 
119 /*****************************************************************************/
120 /* Function Declarations                                                     */
121 /*****************************************************************************/
122 
123 WORD32 ih264e_trace_init(const char *pu1_file_name);
124 
125 WORD32 ih264e_trace_deinit(void);
126 
127 #endif /* _IH264E_TRACE_H_ */
128