| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bxvd_decoder_dbg.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/10 $ |
|---|
| 12 | * $brcm_Date: 1/12/12 3:23p $ |
|---|
| 13 | * |
|---|
| 14 | * [File Description:] |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/xvd/7401/bxvd_decoder_dbg.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/10 1/12/12 3:23p btosi |
|---|
| 21 | * SW7405-4736: added debug support for new PPB field flags_ext0 |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/9 11/30/11 3:06p btosi |
|---|
| 24 | * SW7405-4736: shortened the BXVD_UP message |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/8 7/28/11 11:38a btosi |
|---|
| 27 | * SW7405-4736: added the PPB flags to the BXVD_UP message |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/7 7/27/11 2:02p btosi |
|---|
| 30 | * SWDTV-7795: added new protocols to the debug messages |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/6 7/20/11 3:20p davidp |
|---|
| 33 | * SW7420-2001: Reorder header-file includes. |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/5 4/15/11 10:50a btosi |
|---|
| 36 | * SW7405-4736: added support to print the SEI messages |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/4 4/12/11 2:19p btosi |
|---|
| 39 | * SW7405-4736: added support for MFD debug messages |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/3 4/4/11 2:32p btosi |
|---|
| 42 | * SW7405-4763: added newline at end of file |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/2 4/4/11 2:21p btosi |
|---|
| 45 | * SW7405-4736: added BDBG_DEBUG_BUILD |
|---|
| 46 | * |
|---|
| 47 | * Hydra_Software_Devel/1 4/4/11 11:26a btosi |
|---|
| 48 | * SW7405-4736: initial check in |
|---|
| 49 | * |
|---|
| 50 | ***************************************************************************/ |
|---|
| 51 | |
|---|
| 52 | #include "bstd.h" |
|---|
| 53 | #include "bkni.h" |
|---|
| 54 | #include "bdbg.h" |
|---|
| 55 | |
|---|
| 56 | #include "bxvd_platform.h" |
|---|
| 57 | #include "bxvd_priv.h" |
|---|
| 58 | #include "bxvd_decoder.h" |
|---|
| 59 | #include "bxvd_decoder_timer.h" |
|---|
| 60 | |
|---|
| 61 | #include "bxvd_vdec_info.h" |
|---|
| 62 | |
|---|
| 63 | BDBG_MODULE(BXVD_DECODER_DBG); |
|---|
| 64 | BDBG_FILE_MODULE(BXVD_UP); |
|---|
| 65 | BDBG_FILE_MODULE(BXVD_SEI); |
|---|
| 66 | |
|---|
| 67 | #if BDBG_DEBUG_BUILD |
|---|
| 68 | |
|---|
| 69 | /* |
|---|
| 70 | * Lookup tables for mapping variables to strings. |
|---|
| 71 | */ |
|---|
| 72 | static const char * s_aPictureCodingToStrLUT[BXDM_Picture_Coding_eMax] = |
|---|
| 73 | { |
|---|
| 74 | "u", /* BXDM_Picture_Coding_eUnknown */ |
|---|
| 75 | "I", /* BXDM_Picture_Coding_eI */ |
|---|
| 76 | "P", /* BXDM_Picture_Coding_eP */ |
|---|
| 77 | "B" /* BXDM_Picture_Coding_eB */ |
|---|
| 78 | }; |
|---|
| 79 | |
|---|
| 80 | static const char * s_aPulldownToStrLUT[BXDM_Picture_PullDown_eMax] = |
|---|
| 81 | { |
|---|
| 82 | "err", /* invalid */ |
|---|
| 83 | "T ", /* BXDM_Picture_PullDown_eTop = 1 */ |
|---|
| 84 | "B ", /* BXDM_Picture_PullDown_eBottom = 2 */ |
|---|
| 85 | "TB ", /* BXDM_Picture_PullDown_eTopBottom = 3 */ |
|---|
| 86 | "BT ", /* BXDM_Picture_PullDown_eBottomTop = 4 */ |
|---|
| 87 | "TBT", /* BXDM_Picture_PullDown_eTopBottomTop = 5 */ |
|---|
| 88 | "BTB", /* BXDM_Picture_PullDown_eBottomTopBottom = 6 */ |
|---|
| 89 | "X2 ", /* BXDM_Picture_PullDown_eFrameX2 = 7 */ |
|---|
| 90 | "X3 ", /* BXDM_Picture_PullDown_eFrameX3 = 8 */ |
|---|
| 91 | "X1 ", /* BXDM_Picture_PullDown_eFrameX1 = 9 */ |
|---|
| 92 | "X4 " /* BXDM_Picture_PullDown_eFrameX4 = 10 */ |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | #define BXVD_DECODER_S_MAX_VIDEO_PROTOCOL 19 |
|---|
| 96 | |
|---|
| 97 | static const char * s_aProtocolToStrLUT[BXVD_DECODER_S_MAX_VIDEO_PROTOCOL] = |
|---|
| 98 | { |
|---|
| 99 | "H264 ", /* H.264 */ |
|---|
| 100 | "MPEG2", /* MPEG-2 */ |
|---|
| 101 | "H261 ", /* H.261 */ |
|---|
| 102 | "H263 ", /* H.263 */ |
|---|
| 103 | "VC1 ", /* VC1 Advanced profile */ |
|---|
| 104 | "MPEG1", /* MPEG-1 */ |
|---|
| 105 | "MPEG2DTV", /* MPEG-2 DirecTV DSS ES */ |
|---|
| 106 | "VC1SimpleMain", /* VC1 Simple & Main profile */ |
|---|
| 107 | "MPEG4Part2", /* MPEG 4, Part 2. */ |
|---|
| 108 | "AVS ", /* AVS Jinzhun profile. */ |
|---|
| 109 | "MPEG2_DSS_PES", /* MPEG-2 DirecTV DSS PES */ |
|---|
| 110 | "SVC ", /* Scalable Video Codec */ |
|---|
| 111 | "SVC_BL", /* Scalable Video Codec Base Layer */ |
|---|
| 112 | "MVC ", /* MVC Multi View Coding */ |
|---|
| 113 | "VP6 ", /* VP6 */ |
|---|
| 114 | "VP7 ", /* VP7 */ |
|---|
| 115 | "VP8 ", /* VP8 */ |
|---|
| 116 | "RV9 ", /* Real Video 9 */ |
|---|
| 117 | "SPARK" /* Sorenson Spark */ |
|---|
| 118 | }; |
|---|
| 119 | |
|---|
| 120 | static const char * s_aOrientationToStrLUT[BXDM_Picture_Orientation_eMax] = |
|---|
| 121 | { |
|---|
| 122 | "2D ", /* BXDM_Picture_Orientation_e2D */ |
|---|
| 123 | "Chk", /* BXDM_Picture_Orientation_e3D_Checker */ |
|---|
| 124 | "Col", /* BXDM_Picture_Orientation_e3D_Column */ |
|---|
| 125 | "Row", /* BXDM_Picture_Orientation_e3D_Row */ |
|---|
| 126 | "SbS", /* BXDM_Picture_Orientation_e3D_SideBySide */ |
|---|
| 127 | "ToB", /* BXDM_Picture_Orientation_e3D_TopBottom */ |
|---|
| 128 | "Ful" /* BXDM_Picture_Orientation_e3D_FullFrame */ |
|---|
| 129 | }; |
|---|
| 130 | |
|---|
| 131 | static const char * s_aFrameRelationShipLUT[BXDM_Picture_FrameRelationship_eMax] = |
|---|
| 132 | { |
|---|
| 133 | "-ukn", /* BXDM_Picture_FrameRelationship_eUnknown */ |
|---|
| 134 | "-LR ", /* BXDM_Picture_FrameRelationship_eFrame0Left */ |
|---|
| 135 | "-RL!" /* BXDM_Picture_FrameRelationship_eFrame0Right */ |
|---|
| 136 | }; |
|---|
| 137 | |
|---|
| 138 | static const char * s_aPictureSetTypeToStrLUT[BXVD_Decoder_P_PictureSet_eMax] = |
|---|
| 139 | { |
|---|
| 140 | "S", /* BXVD_Decoder_P_PictureSet_eSingle */ |
|---|
| 141 | "B", /* BXVD_Decoder_P_PictureSet_eBase */ |
|---|
| 142 | "e" /* BXVD_Decoder_P_PictureSet_eDependent */ |
|---|
| 143 | }; |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | /* |
|---|
| 147 | * Print routines. |
|---|
| 148 | */ |
|---|
| 149 | |
|---|
| 150 | void BXVD_DecoderDbg_P_PrintUnifiedPicture( |
|---|
| 151 | BXVD_ChannelHandle hXvdCh, |
|---|
| 152 | uint32_t uiPPBFlags, |
|---|
| 153 | uint32_t uiPPBFlagsExt0, |
|---|
| 154 | BXVD_Decoder_P_UnifiedPictureContext * pstContext, |
|---|
| 155 | bool bDropped |
|---|
| 156 | ) |
|---|
| 157 | { |
|---|
| 158 | BXDM_Picture * pstPicture; |
|---|
| 159 | bool bProtocolValid; |
|---|
| 160 | |
|---|
| 161 | BDBG_ENTER( BXVD_DecoderDbg_P_PrintUnifiedPicture ); |
|---|
| 162 | |
|---|
| 163 | BDBG_ASSERT( pstContext ); |
|---|
| 164 | |
|---|
| 165 | pstPicture = &(pstContext->stUnifiedPicture); |
|---|
| 166 | |
|---|
| 167 | bProtocolValid = ( pstPicture->stProtocol.eProtocol < BXVD_DECODER_S_MAX_VIDEO_PROTOCOL ) ? true : false ; |
|---|
| 168 | |
|---|
| 169 | BDBG_ASSERT( pstPicture ); |
|---|
| 170 | |
|---|
| 171 | BDBG_MODULE_MSG( BXVD_UP, ("%c%03x:[%01x.%03x] pts:%08x(%d) flg:%08x ext0:%08x %s,%s %s %s %s%s %c", |
|---|
| 172 | ( bDropped ) ? 'D' : ' ', |
|---|
| 173 | hXvdCh->stDecoderContext.stCounters.uiVsyncCount & 0xFFF, |
|---|
| 174 | hXvdCh->ulChannelNum & 0xF, |
|---|
| 175 | pstPicture->uiSerialNumber & 0xFFF, |
|---|
| 176 | pstPicture->stPTS.uiValue, |
|---|
| 177 | pstPicture->stPTS.bValid, |
|---|
| 178 | uiPPBFlags, |
|---|
| 179 | uiPPBFlagsExt0, |
|---|
| 180 | s_aPictureCodingToStrLUT[ pstPicture->stPictureType.eCoding ], |
|---|
| 181 | s_aPictureSetTypeToStrLUT[ pstContext->eSetType ], |
|---|
| 182 | s_aPulldownToStrLUT[ pstPicture->stBufferInfo.ePulldown ], |
|---|
| 183 | ( bProtocolValid ) ? s_aProtocolToStrLUT[ pstPicture->stProtocol.eProtocol ] : "ukn" , |
|---|
| 184 | s_aOrientationToStrLUT[ pstPicture->st3D.eOrientation ], |
|---|
| 185 | ( BXDM_Picture_Orientation_e2D == pstPicture->st3D.eOrientation ) ? |
|---|
| 186 | " " : s_aFrameRelationShipLUT[ pstPicture->st3D.eFrameRelationship ], |
|---|
| 187 | ( pstPicture->stError.bThisPicture ) ? 'E' : ' ' |
|---|
| 188 | )); |
|---|
| 189 | |
|---|
| 190 | BDBG_LEAVE( BXVD_DecoderDbg_P_PrintUnifiedPicture ); |
|---|
| 191 | |
|---|
| 192 | return; |
|---|
| 193 | |
|---|
| 194 | } /* end of BXVD_DecoderDbg_P_PrintUnifiedPicture() */ |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | void BXVD_DecoderDbg_P_PrintSeiMessage( |
|---|
| 199 | BXVD_ChannelHandle hXvdCh, |
|---|
| 200 | BXVD_P_SEI_Message * pSEIMessage, |
|---|
| 201 | uint32_t uiSerialNumber |
|---|
| 202 | ) |
|---|
| 203 | { |
|---|
| 204 | BDBG_ENTER( BXVD_DecoderDbg_P_PrintSeiMessage ); |
|---|
| 205 | |
|---|
| 206 | BDBG_ASSERT( hXvdCh ); |
|---|
| 207 | BDBG_ASSERT( pSEIMessage ); |
|---|
| 208 | |
|---|
| 209 | switch( pSEIMessage->uiMsgType ) |
|---|
| 210 | { |
|---|
| 211 | case BXVD_P_PPB_SEI_MSG_MVC_GRAPHICS_OFFSET: |
|---|
| 212 | { |
|---|
| 213 | BXVD_P_MVC_Offset_Meta * pMetaData = (BXVD_P_MVC_Offset_Meta *)&(pSEIMessage->data.stOffsetMeta); |
|---|
| 214 | |
|---|
| 215 | BDBG_MODULE_MSG( BXVD_SEI, (" %04x:[%01x.%03x] GraphicsOffset: num values %d: %02x %02x %02x %02x ...", |
|---|
| 216 | hXvdCh->stDecoderContext.stCounters.uiVsyncCount & 0xFFFF, |
|---|
| 217 | hXvdCh->ulChannelNum & 0xF, |
|---|
| 218 | uiSerialNumber & 0xFFF, |
|---|
| 219 | pMetaData->size, |
|---|
| 220 | pMetaData->offset[0], |
|---|
| 221 | pMetaData->offset[1], |
|---|
| 222 | pMetaData->offset[2], |
|---|
| 223 | pMetaData->offset[3] |
|---|
| 224 | )); |
|---|
| 225 | |
|---|
| 226 | break; |
|---|
| 227 | } |
|---|
| 228 | |
|---|
| 229 | case BXVD_P_PPB_SEI_MSG_FRAMEPACKING: |
|---|
| 230 | { |
|---|
| 231 | BXVD_P_SEI_FramePacking * pstAvdSEIData = (BXVD_P_SEI_FramePacking *)&(pSEIMessage->data.stSEIFramePacking); |
|---|
| 232 | |
|---|
| 233 | BDBG_MODULE_MSG( BXVD_SEI, (" %04x:[%01x.%03x] FramePacking: flags:%08x arrange:%08x interp:%08x", |
|---|
| 234 | hXvdCh->stDecoderContext.stCounters.uiVsyncCount & 0xFFFF, |
|---|
| 235 | hXvdCh->ulChannelNum & 0xF, |
|---|
| 236 | uiSerialNumber & 0xFFF, |
|---|
| 237 | pstAvdSEIData->flags, |
|---|
| 238 | pstAvdSEIData->frame_packing_arrangement_type, |
|---|
| 239 | pstAvdSEIData->content_interpretation_type |
|---|
| 240 | )); |
|---|
| 241 | break; |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| 244 | default: |
|---|
| 245 | BDBG_MODULE_MSG( BXVD_SEI, (" %04x:[%01x.%03x] invalid SEI uiMsgType: %d", |
|---|
| 246 | hXvdCh->stDecoderContext.stCounters.uiVsyncCount & 0xFFFF, |
|---|
| 247 | hXvdCh->ulChannelNum & 0xF, |
|---|
| 248 | uiSerialNumber & 0xFFF, |
|---|
| 249 | pSEIMessage->uiMsgType |
|---|
| 250 | )); |
|---|
| 251 | break; |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | BDBG_LEAVE( BXVD_DecoderDbg_P_PrintSeiMessage ); |
|---|
| 256 | |
|---|
| 257 | return; |
|---|
| 258 | |
|---|
| 259 | } /* end of BXVD_DecoderDbg_P_PrintSeiMessage() */ |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | #endif /* if debug build */ |
|---|