| 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: bxdm_decoder.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 12 | * $brcm_Date: 3/16/12 11:56a $ |
|---|
| 13 | * |
|---|
| 14 | * [File Description:] |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/xdm/bxdm_decoder.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/5 3/16/12 11:56a btosi |
|---|
| 21 | * SW7425-2536: added support for displayInterruptStatus_isr |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/4 6/7/10 10:18a delkert |
|---|
| 24 | * SW7405-3925: Modify RequestPictureDrop_isr API to allow request count |
|---|
| 25 | * to be updated with actual request made to decoder |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/3 2/22/10 11:36a nilesh |
|---|
| 28 | * SW7405-2993: Added BXDM_Decoder_ReleasePictureInfo pointer to |
|---|
| 29 | * BXDM_Decoder_ReleasePicture call |
|---|
| 30 | * |
|---|
| 31 | * Hydra_Software_Devel/2 2/16/10 2:36p nilesh |
|---|
| 32 | * SW7405-2993: Added documentation |
|---|
| 33 | * |
|---|
| 34 | * Hydra_Software_Devel/1 2/16/10 10:50a nilesh |
|---|
| 35 | * SW7405-2993: Initial XDM version |
|---|
| 36 | * |
|---|
| 37 | ***************************************************************************/ |
|---|
| 38 | |
|---|
| 39 | #ifndef BXDM_DECODER_H_ |
|---|
| 40 | #define BXDM_DECODER_H_ |
|---|
| 41 | |
|---|
| 42 | #include "bxdm_picture.h" |
|---|
| 43 | #include "bxdm_pp_types.h" |
|---|
| 44 | |
|---|
| 45 | #ifdef __cplusplus |
|---|
| 46 | extern "C" { |
|---|
| 47 | #endif |
|---|
| 48 | #if 0 |
|---|
| 49 | } |
|---|
| 50 | #endif |
|---|
| 51 | |
|---|
| 52 | /* |
|---|
| 53 | * SW7425-2536: structure returned by displayInterruptStatus_isr. |
|---|
| 54 | */ |
|---|
| 55 | typedef struct BXDM_PictureProvider_Status |
|---|
| 56 | { |
|---|
| 57 | /* The count of vsync interrupts since BXDM_PictureProvider_StartDecode_isr() |
|---|
| 58 | * was called. Intended for debug, perhaps will be useful in other ways. |
|---|
| 59 | */ |
|---|
| 60 | uint32_t uiVsyncCount; |
|---|
| 61 | |
|---|
| 62 | /* The picture delivery queue was empty on this vsync. */ |
|---|
| 63 | bool bPictureQueueIsEmpty; |
|---|
| 64 | |
|---|
| 65 | /* Status for the picture being delivered to VDC on this vsync. */ |
|---|
| 66 | BXDM_PictureProvider_PictureInfo stCurrentPicture; |
|---|
| 67 | |
|---|
| 68 | } BXDM_PictureProvider_Status; |
|---|
| 69 | |
|---|
| 70 | /* BXDM_Decoder_GetPictureCount_isr - |
|---|
| 71 | * |
|---|
| 72 | * BXDM_Decoder_GetPictureCount_isr returns the total number of unified pictures available on the |
|---|
| 73 | * decoder's picture delivery queue. During a decode, it must be a non-decreasing number as long as |
|---|
| 74 | * BXDM_Decoder_GetNextPicture_isr is not called. |
|---|
| 75 | * |
|---|
| 76 | * See: BXDM_Decoder_PeekAtPicture_isr |
|---|
| 77 | */ |
|---|
| 78 | typedef BERR_Code |
|---|
| 79 | (*BXDM_Decoder_GetPictureCount_isr)(void *pvHandle, uint32_t *puiPictureCount); |
|---|
| 80 | |
|---|
| 81 | /* BXDM_Decoder_PeekAtPicture_isr - |
|---|
| 82 | * |
|---|
| 83 | * BXDM_Decoder_PeekAtPicture_isr returns a pointer to the indexed unified picture. |
|---|
| 84 | * The picture remains in the decoder's picture delivery queue. The valid index range |
|---|
| 85 | * is [0, (BXDM_Decoder_GetPictureCount_isr() - 1)]. |
|---|
| 86 | * |
|---|
| 87 | * Calling BXDM_Decoder_PeekAtPicture_isr with the same index repeatedly should return |
|---|
| 88 | * the same unified picture, until BXDM_Decoder_GetNextPicture_isr is called. |
|---|
| 89 | * |
|---|
| 90 | * See: BXDM_Decoder_GetPictureCount_isr |
|---|
| 91 | * See: BXDM_Decoder_GetNextPicture_isr |
|---|
| 92 | */ |
|---|
| 93 | typedef BERR_Code |
|---|
| 94 | (*BXDM_Decoder_PeekAtPicture_isr)(void *pvHandle, uint32_t uiIndex, const BXDM_Picture **pUnifiedPicture); |
|---|
| 95 | |
|---|
| 96 | /* BXDM_Decoder_GetNextPicture_isr - |
|---|
| 97 | * |
|---|
| 98 | * BXDM_Decoder_GetNextPicture_isr is called by XDM when it wants the next picture off of |
|---|
| 99 | * the decoder's picture delivery queue. The decoder cannot modify data associated with the |
|---|
| 100 | * unified picture that is returned by this function until the same picture is returned |
|---|
| 101 | * via BXDM_Decoder_ReleasePicture_isr. |
|---|
| 102 | * |
|---|
| 103 | * See: BXDM_Decoder_ReleasePicture_isr |
|---|
| 104 | */ |
|---|
| 105 | typedef BERR_Code |
|---|
| 106 | (*BXDM_Decoder_GetNextPicture_isr)(void *pvHandle, const BXDM_Picture **pUnifiedPicture); |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | typedef struct BXDM_Decoder_ReleasePictureInfo |
|---|
| 110 | { |
|---|
| 111 | bool bValid; |
|---|
| 112 | } BXDM_Decoder_ReleasePictureInfo; |
|---|
| 113 | |
|---|
| 114 | /* BXDM_Decoder_ReleasePicture_isr - |
|---|
| 115 | * |
|---|
| 116 | * BXDM_Decoder_ReleasePicture_isr is called when XDM is done with the unified picture. |
|---|
| 117 | * The unified picture may still be in use (e.g. currently being scanned to the display) |
|---|
| 118 | * so it is important that the decoder wait until the NEXT display interrupt event |
|---|
| 119 | * before fully re-using the memory associated with the released picture. |
|---|
| 120 | * |
|---|
| 121 | * BXDM_Decoder_ReleasePicture_isr could be called multiple times before the next display |
|---|
| 122 | * interrupt event, so the decoder may want to implement a pending released queue that is |
|---|
| 123 | * purged on the next display interrupt event. |
|---|
| 124 | * |
|---|
| 125 | * BXDM_Decoder_ReleasePicture_isr should be passed a unified pictures that was obtained |
|---|
| 126 | * via a BXDM_Decoder_GetNextPicture_isr from the SAME decoder channel. However, it is |
|---|
| 127 | * not necessary for the picture to be released during the same decode. I.e. it is possible |
|---|
| 128 | * for the XDM to retain the same picture(s) across multiple start/stop decode sequences. |
|---|
| 129 | * E.g. hold last picture during a channel change. |
|---|
| 130 | * |
|---|
| 131 | * The pReleasePictureInfo could be NULL. |
|---|
| 132 | * |
|---|
| 133 | * See: BXDM_Decoder_DisplayInterruptEvent_isr |
|---|
| 134 | * See: BXDM_Decoder_GetNextPicture_isr |
|---|
| 135 | */ |
|---|
| 136 | typedef BERR_Code |
|---|
| 137 | (*BXDM_Decoder_ReleasePicture_isr)(void *pvHandle, const BXDM_Picture *pUnifiedPicture, const BXDM_Decoder_ReleasePictureInfo *pReleasePictureInfo); |
|---|
| 138 | |
|---|
| 139 | /* BXDM_Decoder_GetPictureDropPendingCount_isr - |
|---|
| 140 | * |
|---|
| 141 | * BXDM_Decoder_GetPictureDropPendingCount_isr returns the total number of fields that are |
|---|
| 142 | * pending to be dropped by the decoder. The picture drop pending count MUST be relative |
|---|
| 143 | * to the first (0th) picture on the picture delivery queue. E.g. |
|---|
| 144 | * |
|---|
| 145 | * | Pic | Request | Pending | Dropped | |
|---|
| 146 | * | 0 | 0 | 0 | 0 | |
|---|
| 147 | * | 1 | 6 | 6 | 0 | |
|---|
| 148 | * | 2 | 6 | 4 | 2 | |
|---|
| 149 | * | 3 | 6 | 2 | 4 | |
|---|
| 150 | * | 4 | 6 | 0 | 6 | |
|---|
| 151 | * |
|---|
| 152 | * To further clarify, if we have the following call sequence: |
|---|
| 153 | * |
|---|
| 154 | * 1) BXDM_Decoder_GetPictureDropPendingCount_isr --> 6 |
|---|
| 155 | * 2) BXDM_Decoder_GetNextPicture_isr |
|---|
| 156 | * 3) BXDM_Decoder_GetPictureDropPendingCount_isr --> 4 |
|---|
| 157 | * 4) BXDM_Decoder_GetNextPicture_isr |
|---|
| 158 | * 5) BXDM_Decoder_GetPictureDropPendingCount_isr --> 0 |
|---|
| 159 | * |
|---|
| 160 | * XDM knows that 2 fields were dropped before the picture returned in #2 was |
|---|
| 161 | * decoded. XDM also knows that 4 fields were dropped before the picture returned |
|---|
| 162 | * in #4 was decoded. |
|---|
| 163 | * |
|---|
| 164 | * If the decoder is unable to drop the requested |
|---|
| 165 | * |
|---|
| 166 | * See: BXDM_Decoder_RequestPictureDrop_isr |
|---|
| 167 | */ |
|---|
| 168 | typedef BERR_Code |
|---|
| 169 | (*BXDM_Decoder_GetPictureDropPendingCount_isr)(void *pvHandle, uint32_t *puiPictureDropPendingCount); |
|---|
| 170 | |
|---|
| 171 | /* BXDM_Decoder_RequestPictureDrop_isr - |
|---|
| 172 | * |
|---|
| 173 | * BXDM_Decoder_RequestPictureDrop_isr is called by XDM when it wants the decoder to drop a certain |
|---|
| 174 | * number of fields. The count is ALWAYS in the number of fields, even if the content is progressive. |
|---|
| 175 | * |
|---|
| 176 | * | pulldown | fields | |
|---|
| 177 | * | TB,BT | 2 | |
|---|
| 178 | * | F,X2,X3,X4 | 2 | |
|---|
| 179 | * | TBT,BTB | 3 | |
|---|
| 180 | * |
|---|
| 181 | * Updates the argument with the actual number of fields requested to be dropped from the decoder. |
|---|
| 182 | * May differ from the original number requested due to capping of the request, truncating the request |
|---|
| 183 | * to an even number of fields, or zero if a request is currently pending. |
|---|
| 184 | * |
|---|
| 185 | * See: BXDM_Decoder_GetPictureDropPendingCount_isr |
|---|
| 186 | */ |
|---|
| 187 | typedef BERR_Code |
|---|
| 188 | (*BXDM_Decoder_RequestPictureDrop_isr)(void *pvHandle, uint32_t *puiPictureDropRequestCount); |
|---|
| 189 | |
|---|
| 190 | /* BXDM_Decoder_DisplayInterruptEvent_isr - |
|---|
| 191 | * |
|---|
| 192 | * BXDM_Decoder_DisplayInterruptEvent_isr is called once per display interrupt BEFORE any XDM processing |
|---|
| 193 | * is done for the display interrupt. This callback is the ideal place for the decoder to reclaim any |
|---|
| 194 | * released pictures, update it's queue state, etc. |
|---|
| 195 | */ |
|---|
| 196 | typedef BERR_Code |
|---|
| 197 | (*BXDM_Decoder_DisplayInterruptEvent_isr)(void *pvHandle); |
|---|
| 198 | |
|---|
| 199 | /* BXDM_Decoder_DisplayInterruptStatus_isr |
|---|
| 200 | * |
|---|
| 201 | * SW7425-2536: added to support "drop at decode" for non-AVD decoders, perhaps it will prove useful in |
|---|
| 202 | * other situations. This routine is called once per display interrupt, at the end of XDM's execution. |
|---|
| 203 | */ |
|---|
| 204 | typedef void |
|---|
| 205 | (*BXDM_Decoder_DisplayInterruptStatus_isr)( void *pvHandle, const BXDM_PictureProvider_Status *pstPictureInfo ); |
|---|
| 206 | |
|---|
| 207 | typedef struct BXDM_Decoder_Interface |
|---|
| 208 | { |
|---|
| 209 | /* Returns the number of unique base pictures available in the decoder's picture delivery queue */ |
|---|
| 210 | BXDM_Decoder_GetPictureCount_isr getPictureCount_isr; |
|---|
| 211 | |
|---|
| 212 | /* Returns a pointer to the specified unified picture on the decoder's picture delivery queue, |
|---|
| 213 | * but DOES NOT remove it from the queue */ |
|---|
| 214 | BXDM_Decoder_PeekAtPicture_isr peekAtPicture_isr; |
|---|
| 215 | |
|---|
| 216 | /* Returns a pointer to the next unified picture on the decoder's picture delivery queue |
|---|
| 217 | * and DOES remove it from the queue */ |
|---|
| 218 | BXDM_Decoder_GetNextPicture_isr getNextPicture_isr; |
|---|
| 219 | |
|---|
| 220 | /* Adds unified picture to the decoder's release queue */ |
|---|
| 221 | BXDM_Decoder_ReleasePicture_isr releasePicture_isr; |
|---|
| 222 | |
|---|
| 223 | /* (optional) Returns the decoder's current pending drop request count */ |
|---|
| 224 | BXDM_Decoder_GetPictureDropPendingCount_isr getPictureDropPendingCount_isr; |
|---|
| 225 | |
|---|
| 226 | /* (optional) Specifies how many fields the decoder should try to drop */ |
|---|
| 227 | BXDM_Decoder_RequestPictureDrop_isr requestPictureDrop_isr; |
|---|
| 228 | |
|---|
| 229 | /* (optional) Will be called once at the beginning of each display interrupt |
|---|
| 230 | * before the Picture Provider processes pictures */ |
|---|
| 231 | BXDM_Decoder_DisplayInterruptEvent_isr displayInterruptEvent_isr; |
|---|
| 232 | |
|---|
| 233 | /* (optional) Will be called once at the end of the display interrupt, |
|---|
| 234 | * after the Picture Provider (XDM) has finished execution. */ |
|---|
| 235 | BXDM_Decoder_DisplayInterruptStatus_isr displayInterruptStatus_isr; |
|---|
| 236 | |
|---|
| 237 | } BXDM_Decoder_Interface; |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | #ifdef __cplusplus |
|---|
| 241 | } |
|---|
| 242 | #endif |
|---|
| 243 | |
|---|
| 244 | #endif /* BXDM_DECODER_H_ */ |
|---|