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 extern declarations of routines that could be helpful 28 * for 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 /* Extern 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 /* Extern Function Declarations */ 121 /*****************************************************************************/ 122 123 124 /** 125 ****************************************************************************** 126 * 127 * @brief Dummy trace init when trace is disabled in encoder 128 * 129 * @par Description 130 * This routine needs to be called at start of trace 131 * 132 * @param[in] pu1_file_name 133 * Name of file where trace outputs need to be stores (handle) 134 * 135 * @return success or failure error code 136 * 137 ****************************************************************************** 138 */ 139 extern WORD32 ih264e_trace_init 140 ( 141 const char *pu1_file_name 142 ); 143 144 /** 145 ****************************************************************************** 146 * 147 * @brief Dummy trace de-init function when trace is disabled 148 * 149 * @par Description 150 * This routine needs to be called at end of trace 151 * 152 * @return success or failure error code 153 * 154 ****************************************************************************** 155 */ 156 extern WORD32 ih264e_trace_deinit 157 ( 158 void 159 ); 160 161 #endif // IH264E_TRACE_H_ 162