1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
/*
* debug.h: A program for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#ifndef __debug_h_
#define __debug_h_
#include "global.h"
#ifdef POSIX
#include <syslog.h> // only part of posix systems.
#endif
#define LOG_TRACE 8
// write full picture from recording
// from <framenumber> - DEBUG_LOGO_DETECT_FRAME_CORNER_RANGE to <framenumber> + DEBUG_LOGO_DETECT_FRAME_CORNER_RANGE
// #define DEBUG_PICTURE <framenumber>
// #define DEBUG_PICTURE_RANGE <count frames>
// write full picture from recording and all sobel pictures from logo corner to recording directory
// from <framenumber> - DEBUG_LOGO_DETECT_FRAME_CORNER_RANGE to <framenumber> + DEBUG_LOGO_DETECT_FRAME_CORNER_RANGE
// #define DEBUG_LOGO_DETECT_FRAME_CORNER <framenumber>
// #define DEBUG_LOGO_DETECT_FRAME_CORNER_RANGE <count frames>
// write logo detection information in log file
// #define DEBUG_LOGO_DETECTION
// debug sobel transformation
// #define DEBUG_SOBEL
// debug overlap detection
// #define DEBUG_OVERLAP
// write overlap frame pairs
// #define DEBUG_OVERLAP_FRAME_RANGE 2
// #define DEBUG_OVERLAP_FRAME_BEFORE <framenumber>
// #define DEBUG_OVERLAP_FRAME_AFTER <framenumber>
// debug logo extraction of logo.cpp
// #define DEBUG_LOGO_CORNER TOP_LEFT
// #define DEBUG_LOGO_CORNER TOP_RIGHT
// #define DEBUG_LOGO_CORNER BOTTOM_LEFT
// #define DEBUG_LOGO_CORNER BOTTOM_RIGHT
// save logos from search logo function (only works if corner is defined by DEBUG_LOGO_CORNER
// #define DEBUG_LOGO_SAVE 0 // save all logos before CheckValid to recording directory
// #define DEBUG_LOGO_SAVE 1 // save valid logos after before and after RemovePixelDefects to recording directory
// debug logo resize function
// #define DEBUG_LOGO_RESIZE
// debug compare frame range
// #define DEBUG_COMPARE_FRAME_RANGE TOP_LEFT
// #define DEBUG_COMPARE_FRAME_RANGE TOP_RIGHT
// #define DEBUG_COMPARE_FRAME_RANGE BOTTOM_LEFT
// #define DEBUG_COMPARE_FRAME_RANGE BOTTOM_RIGHT
// debug vborder detection
// #define DEBUG_VBORDER
// debug hborder detection
// #define DEBUG_HBORDER
// show all weak marks
// #define DEBUG_WEAK_MARKS
// debug scene change detection
// #define DEBUG_SCENE_CHANGE
// debug blackscreen detection
// #define DEBUG_BLACKSCREEN
// debug lower border detection
// #define DEBUG_LOWERBORDER
// debug volume detection
// #define DEBUG_VOLUME
// debug marks frames, write mark frame picture (and some before and after) to recording directory
// #define DEBUG_MARK_FRAMES <count frames before and after>
// #define DEBUG_MARK_FRAMES 2
// debug framenumber pts index build
// #define DEBUG_INDEX
// debug input packet PTS
// #define DEBUG_PACKET_PTS
// debug PTS ring buffer build
// #define DEBUG_RING_PTS_ADD
// debug PTS ring buffer PTS lookup
// #define DEBUG_RING_PTS_LOOKUP
// debug video cut position, write <count> frames after start mark to recording directory
// #define DEBUG_CUT 5
// debug cut offset
// #define DEBUG_CUT_OFFSET
// debug cut write
// #define DEBUG_CUT_WRITE <stream number> (-1 for all streams)
// #define DEBUG_CUT_WRITE 0
// debug PTS and DTS of video cut
// #define DEBUG_PTS_DTS_CUT <stream number> (-1 for all streams)
// #define DEBUG_PTS_DTS_CUT 0
// debug decoder send/receive
// #define DEBUG_DECODER <stream index>
// #define DEBUG_DECODER 0
// debug DecodeNextFrame()
// #define DEBUG_DECODE_NEXT_FRAME
// debug seek from decoder
// #define DEBUG_DECODER_SEEK
// debug encoder
// #define DEBUG_ENCODER
// debug mark optimization
// #define DEBUG_MARK_OPTIMIZATION
// debug info logo detection
// #define DEBUG_INFOLOGO
// debug ad in frame detection
// #define DEBUG_ADINFRAME
// debug introduction logo detection
// #define DEBUG_INTRODUCTION
// debug closing credits detection
// #define DEBUG_CLOSINGCREDITS
// debug frame detection for closing credits or ad in frame
// #define DEBUG_FRAME_DETECTION
// write sobel transformed pictures from frame detection to recording directory
// writes 10 picture before to 10 picture after frame number
// #define DEBUG_FRAME_DETECTION_PICTURE <frame number>
// debug timestamps from final marks to save
// #define DEBUG_SAVEMARKS
// debug channel name compare
// #define DEBUG_CHANNEL_NAME
// debug hw_device_ctx reference count
// #define DEBUG_HW_DEVICE_CTX_REF
extern int SysLogLevel;
extern void syslog_with_tid(int priority, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
#ifdef POSIX
#define esyslog(a...) void( (SysLogLevel > 0) ? syslog_with_tid(LOG_ERR, a) : void() )
#define isyslog(a...) void( (SysLogLevel > 1) ? syslog_with_tid(LOG_INFO, a) : void() )
#define dsyslog(a...) void( (SysLogLevel > 2) ? syslog_with_tid(LOG_DEBUG, a) : void() )
#define tsyslog(a...) void( (SysLogLevel > 3) ? syslog_with_tid(LOG_TRACE, a) : void() )
#else
/* no POSIX, no syslog */
#include <cstdio>
#define esyslog(a...) if (SysLogLevel > 0) fprintf(stderr, a)
#define isyslog(a...) if (SysLogLevel > 1) fprintf(stdout, a)
#define dsyslog(a...) if (SysLogLevel > 2) fprintf(stdout, a)
#define tsyslog(a...) if (SysLogLevel > 3) fprintf(stdout, a)
#endif
#if defined(DEBUG_PICTURE)
void SaveVideoPicture(const char *baseName, const sVideoPicture *picture);
#endif
#if defined(DEBUG_MARK_FRAMES) || defined(DEBUG_LOGO_DETECT_FRAME_CORNER) || defined(DEBUG_DECODER_SEEK) || defined(DEBUG_CUT)
void SaveVideoPlane0(const char *fileName, const sVideoPicture *picture);
#endif
#ifdef DEBUG_MEM
#define ALLOC(size, var) memAlloc(size, __LINE__, const_cast<char *>(__FILE__), const_cast<char *>(var))
#define FREE(size, var) memFree(size, __LINE__, const_cast<char *>(__FILE__), const_cast<char *>(var))
void memAlloc(int size, int line, char *file, char *var);
void memFree(int size, int line, char *file, char *var);
void memList();
#else
#define ALLOC(size, var)
#define FREE(size, var)
#endif
#endif
|