| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2010, 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: bsynclib_video_format.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/10 $ |
|---|
| 12 | * $brcm_Date: 6/30/10 2:25p $ |
|---|
| 13 | * |
|---|
| 14 | * Revision History: |
|---|
| 15 | * |
|---|
| 16 | * $brcm_Log: /magnum/syslib/synclib/noarch/bsynclib_video_format.c $ |
|---|
| 17 | * |
|---|
| 18 | * Hydra_Software_Devel/10 6/30/10 2:25p bandrews |
|---|
| 19 | * SW7335-781: added up and down conversion |
|---|
| 20 | * |
|---|
| 21 | * Hydra_Software_Devel/9 2/12/10 8:46p bandrews |
|---|
| 22 | * SW7405-3912: assert all inputs are not null |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/8 9/9/09 7:42p bandrews |
|---|
| 25 | * SW7405-3001: declare array size using eMax |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/7 8/4/09 5:01p bandrews |
|---|
| 28 | * PR57256: synclib support for 7.493 |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/6 8/4/09 4:56p bandrews |
|---|
| 31 | * PR52812: added improved rmd for dmv2 |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/5 7/29/09 3:42p bandrews |
|---|
| 34 | * PR50988: Add support for 7 and 14 DIVX rates |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/4 6/2/08 10:33p bandrews |
|---|
| 37 | * PR42731: fixed |
|---|
| 38 | * |
|---|
| 39 | * Hydra_Software_Devel/3 6/2/08 10:31p bandrews |
|---|
| 40 | * PR42730: fixed |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/2 6/2/08 10:29p bandrews |
|---|
| 43 | * PR42729: Added bounds checking |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/1 3/24/08 3:09p bandrews |
|---|
| 46 | * PR40865: Fixed |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/2 2/26/08 10:21p bandrews |
|---|
| 49 | * PR37951: Fixed units. Implemented static rate mismatch detection. |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/1 1/3/08 6:02p bandrews |
|---|
| 52 | * PR37951: Updated based on initial feedback |
|---|
| 53 | ***************************************************************************/ |
|---|
| 54 | |
|---|
| 55 | #include "bstd.h" |
|---|
| 56 | #include "bkni.h" |
|---|
| 57 | #include "bsynclib_video_format.h" |
|---|
| 58 | |
|---|
| 59 | BDBG_MODULE(synclib); |
|---|
| 60 | |
|---|
| 61 | void BSYNClib_VideoFormat_Init(BSYNClib_VideoFormat * psFormat) |
|---|
| 62 | { |
|---|
| 63 | BDBG_ENTER(BSYNClib_VideoFormat_Reset_isr); |
|---|
| 64 | |
|---|
| 65 | BDBG_ASSERT(psFormat); |
|---|
| 66 | |
|---|
| 67 | BKNI_Memset(psFormat, 0, sizeof(BSYNClib_VideoFormat)); |
|---|
| 68 | psFormat->sData.eFrameRate = BAVC_FrameRateCode_eUnknown; |
|---|
| 69 | |
|---|
| 70 | BDBG_LEAVE(BSYNClib_VideoFormat_Reset_isr); |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | void BSYNClib_VideoFormat_Reset_isr(BSYNClib_VideoFormat * psFormat) |
|---|
| 74 | { |
|---|
| 75 | BDBG_ENTER(BSYNClib_VideoFormat_Reset_isr); |
|---|
| 76 | |
|---|
| 77 | BDBG_ASSERT(psFormat); |
|---|
| 78 | |
|---|
| 79 | psFormat->sData.bValid = false; |
|---|
| 80 | psFormat->sData.eFrameRate = BAVC_FrameRateCode_eUnknown; |
|---|
| 81 | |
|---|
| 82 | BDBG_LEAVE(BSYNClib_VideoFormat_Reset_isr); |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | void BSYNClib_VideoFormat_Diff_isr( |
|---|
| 86 | BSYNClib_VideoFormat * psDesired, |
|---|
| 87 | BSYNClib_VideoFormat * psCurrent, |
|---|
| 88 | BSYNClib_VideoFormat_DiffResults * psResults |
|---|
| 89 | ) |
|---|
| 90 | { |
|---|
| 91 | BDBG_ENTER(BSYNClib_VideoFormat_Diff_isr); |
|---|
| 92 | |
|---|
| 93 | BDBG_ASSERT(psDesired); |
|---|
| 94 | BDBG_ASSERT(psCurrent); |
|---|
| 95 | BDBG_ASSERT(psResults); |
|---|
| 96 | |
|---|
| 97 | if |
|---|
| 98 | ( |
|---|
| 99 | (psDesired->sData.eFrameRate != psCurrent->sData.eFrameRate) |
|---|
| 100 | || (psDesired->sData.bInterlaced != psCurrent->sData.bInterlaced) |
|---|
| 101 | || (psDesired->sData.uiHeight != psCurrent->sData.uiHeight) |
|---|
| 102 | ) |
|---|
| 103 | { |
|---|
| 104 | psResults->bChanged = true; |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | BDBG_LEAVE(BSYNClib_VideoFormat_Diff_isr); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | void BSYNClib_VideoFormat_Patch_isr( |
|---|
| 111 | BSYNClib_VideoFormat * psDesired, |
|---|
| 112 | BSYNClib_VideoFormat * psCurrent, |
|---|
| 113 | BSYNClib_VideoFormat_DiffResults * psResults |
|---|
| 114 | ) |
|---|
| 115 | { |
|---|
| 116 | BDBG_ENTER(BSYNClib_VideoFormat_Patch_isr); |
|---|
| 117 | |
|---|
| 118 | BDBG_ASSERT(psDesired); |
|---|
| 119 | BDBG_ASSERT(psCurrent); |
|---|
| 120 | BDBG_ASSERT(psResults); |
|---|
| 121 | |
|---|
| 122 | if (psResults->bChanged) |
|---|
| 123 | { |
|---|
| 124 | psCurrent->sData = psDesired->sData; |
|---|
| 125 | psCurrent->sData.bValid = true; |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | BDBG_LEAVE(BSYNClib_VideoFormat_Patch_isr); |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | void BSYNClib_VideoFormat_Snapshot_isr(BSYNClib_VideoFormat * psFormat) |
|---|
| 132 | { |
|---|
| 133 | BDBG_ENTER(BSYNClib_VideoFormat_Snapshot_isr); |
|---|
| 134 | |
|---|
| 135 | BDBG_ASSERT(psFormat); |
|---|
| 136 | |
|---|
| 137 | psFormat->sSnapshot = psFormat->sData; |
|---|
| 138 | |
|---|
| 139 | BDBG_LEAVE(BSYNClib_VideoFormat_Snapshot_isr); |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | static const unsigned int gauiFramePeriods[BAVC_FrameRateCode_eMax + 1] = |
|---|
| 143 | { |
|---|
| 144 | 0, /* Unknown */ |
|---|
| 145 | 1126125, /* 23.976 */ |
|---|
| 146 | 1125000, /* 24 */ |
|---|
| 147 | 1080000, /* 25 */ |
|---|
| 148 | 900900, /* 29.97 */ |
|---|
| 149 | 900000, /* 30 */ |
|---|
| 150 | 540000, /* 50 */ |
|---|
| 151 | 450450, /* 59.94 */ |
|---|
| 152 | 450000, /* 60 */ |
|---|
| 153 | 1801800, /* 14.985 */ |
|---|
| 154 | 3603600, /* 7.493 */ |
|---|
| 155 | 0 /* max */ |
|---|
| 156 | }; |
|---|
| 157 | |
|---|
| 158 | /* table of native frame periods * 1001/1000 */ |
|---|
| 159 | static const unsigned int gauiUpconvertedFramePeriods[BAVC_FrameRateCode_eMax + 1] = |
|---|
| 160 | { |
|---|
| 161 | 0, /* Unknown */ |
|---|
| 162 | 1127251, /* 23.976 * 1000/1001 */ |
|---|
| 163 | 1126125, /* 24 -> 23.976 */ |
|---|
| 164 | 1081080, /* 25 * 1000/1001 */ |
|---|
| 165 | 901801, /* 29.97 * 1000/1001 */ |
|---|
| 166 | 900900, /* 30 -> 29.97 */ |
|---|
| 167 | 540540, /* 50 * 1000/1001 */ |
|---|
| 168 | 450900, /* 59.94 */ |
|---|
| 169 | 450450, /* 60 -> 59.94 */ |
|---|
| 170 | 1803602, /* 14.985 * 1000/1001 */ |
|---|
| 171 | 3607204, /* 7.493 * 1000/1001 */ |
|---|
| 172 | 0 /* max */ |
|---|
| 173 | }; |
|---|
| 174 | |
|---|
| 175 | /* table of native frame periods * 1000/1001 */ |
|---|
| 176 | static const unsigned int gauiDownconvertedFramePeriods[BAVC_FrameRateCode_eMax + 1] = |
|---|
| 177 | { |
|---|
| 178 | 0, /* Unknown */ |
|---|
| 179 | 1125000, /* 23.976 -> 24 */ |
|---|
| 180 | 1123876, /* 24 * 1001/1000 */ |
|---|
| 181 | 1078921, /* 25 * 1001/1000 */ |
|---|
| 182 | 900000, /* 29.97 -> 30 */ |
|---|
| 183 | 899101, /* 30 * 1001/1000 */ |
|---|
| 184 | 539461, /* 50 * 1001/1000 */ |
|---|
| 185 | 450000, /* 59.94 -> 60 */ |
|---|
| 186 | 449550, /* 60 * 1001/1000 */ |
|---|
| 187 | 1800000, /* 14.985 -> 15 */ |
|---|
| 188 | 3600000, /* 7.493 -> 7.5 */ |
|---|
| 189 | 0 /* max */ |
|---|
| 190 | }; |
|---|
| 191 | |
|---|
| 192 | unsigned int BSYNClib_VideoFormat_P_GetUpconvertedFramePeriod(BSYNClib_VideoFormat * psFormat) |
|---|
| 193 | { |
|---|
| 194 | unsigned int uiFramePeriod; |
|---|
| 195 | |
|---|
| 196 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetUpconvertedFramePeriod); |
|---|
| 197 | |
|---|
| 198 | BDBG_ASSERT(psFormat); |
|---|
| 199 | |
|---|
| 200 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported(psFormat->sSnapshot.eFrameRate)) |
|---|
| 201 | { |
|---|
| 202 | uiFramePeriod = gauiUpconvertedFramePeriods[psFormat->sSnapshot.eFrameRate]; |
|---|
| 203 | } |
|---|
| 204 | else |
|---|
| 205 | { |
|---|
| 206 | BDBG_WRN(("Unsupported sync frame rate; lipsync will suffer")); |
|---|
| 207 | uiFramePeriod = gauiUpconvertedFramePeriods[0]; |
|---|
| 208 | } |
|---|
| 209 | |
|---|
| 210 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetUpconvertedFramePeriod); |
|---|
| 211 | return uiFramePeriod; |
|---|
| 212 | } |
|---|
| 213 | |
|---|
| 214 | unsigned int BSYNClib_VideoFormat_P_GetUpconvertedFramePeriod_isr(BSYNClib_VideoFormat * psFormat) |
|---|
| 215 | { |
|---|
| 216 | unsigned int uiFramePeriod; |
|---|
| 217 | |
|---|
| 218 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetUpconvertedFramePeriod_isr); |
|---|
| 219 | |
|---|
| 220 | BDBG_ASSERT(psFormat); |
|---|
| 221 | |
|---|
| 222 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported_isr(psFormat->sData.eFrameRate)) |
|---|
| 223 | { |
|---|
| 224 | uiFramePeriod = gauiUpconvertedFramePeriods[psFormat->sData.eFrameRate]; |
|---|
| 225 | } |
|---|
| 226 | else |
|---|
| 227 | { |
|---|
| 228 | BDBG_WRN(("Unsupported sync frame rate; lipsync will suffer")); |
|---|
| 229 | uiFramePeriod = gauiUpconvertedFramePeriods[0]; |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetUpconvertedFramePeriod_isr); |
|---|
| 233 | return uiFramePeriod; |
|---|
| 234 | } |
|---|
| 235 | |
|---|
| 236 | unsigned int BSYNClib_VideoFormat_P_GetDownconvertedFramePeriod(BSYNClib_VideoFormat * psFormat) |
|---|
| 237 | { |
|---|
| 238 | unsigned int uiFramePeriod; |
|---|
| 239 | |
|---|
| 240 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetDownconvertedFramePeriod); |
|---|
| 241 | |
|---|
| 242 | BDBG_ASSERT(psFormat); |
|---|
| 243 | |
|---|
| 244 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported(psFormat->sSnapshot.eFrameRate)) |
|---|
| 245 | { |
|---|
| 246 | uiFramePeriod = gauiDownconvertedFramePeriods[psFormat->sSnapshot.eFrameRate]; |
|---|
| 247 | } |
|---|
| 248 | else |
|---|
| 249 | { |
|---|
| 250 | BDBG_WRN(("Unsupported sync frame rate; lipsync will suffer")); |
|---|
| 251 | uiFramePeriod = gauiDownconvertedFramePeriods[0]; |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetDownconvertedFramePeriod); |
|---|
| 255 | return uiFramePeriod; |
|---|
| 256 | } |
|---|
| 257 | |
|---|
| 258 | unsigned int BSYNClib_VideoFormat_P_GetDownconvertedFramePeriod_isr(BSYNClib_VideoFormat * psFormat) |
|---|
| 259 | { |
|---|
| 260 | unsigned int uiFramePeriod; |
|---|
| 261 | |
|---|
| 262 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetDownconvertedFramePeriod_isr); |
|---|
| 263 | |
|---|
| 264 | BDBG_ASSERT(psFormat); |
|---|
| 265 | |
|---|
| 266 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported_isr(psFormat->sData.eFrameRate)) |
|---|
| 267 | { |
|---|
| 268 | uiFramePeriod = gauiDownconvertedFramePeriods[psFormat->sData.eFrameRate]; |
|---|
| 269 | } |
|---|
| 270 | else |
|---|
| 271 | { |
|---|
| 272 | BDBG_WRN(("Unsupported sync frame rate; lipsync will suffer")); |
|---|
| 273 | uiFramePeriod = gauiDownconvertedFramePeriods[0]; |
|---|
| 274 | } |
|---|
| 275 | |
|---|
| 276 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetDownconvertedFramePeriod_isr); |
|---|
| 277 | return uiFramePeriod; |
|---|
| 278 | } |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | bool BSYNClib_VideoFormat_P_IsFrameRateSupported(BAVC_FrameRateCode eRate) |
|---|
| 282 | { |
|---|
| 283 | bool bResult = false; |
|---|
| 284 | |
|---|
| 285 | BDBG_ENTER(BSYNClib_VideoFormat_P_IsFrameRateSupported); |
|---|
| 286 | |
|---|
| 287 | BKNI_EnterCriticalSection(); |
|---|
| 288 | bResult = BSYNClib_VideoFormat_P_IsFrameRateSupported_isr(eRate); |
|---|
| 289 | BKNI_LeaveCriticalSection(); |
|---|
| 290 | |
|---|
| 291 | BDBG_LEAVE(BSYNClib_VideoFormat_P_IsFrameRateSupported); |
|---|
| 292 | |
|---|
| 293 | return bResult; |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | bool BSYNClib_VideoFormat_P_IsFrameRateSupported_isr(BAVC_FrameRateCode eRate) |
|---|
| 297 | { |
|---|
| 298 | bool bResult = false; |
|---|
| 299 | |
|---|
| 300 | BDBG_ENTER(BSYNClib_VideoFormat_P_IsFrameRateSupported_isr); |
|---|
| 301 | |
|---|
| 302 | switch (eRate) |
|---|
| 303 | { |
|---|
| 304 | case BAVC_FrameRateCode_e7_493: |
|---|
| 305 | case BAVC_FrameRateCode_e14_985: |
|---|
| 306 | case BAVC_FrameRateCode_e23_976: |
|---|
| 307 | case BAVC_FrameRateCode_e24: |
|---|
| 308 | case BAVC_FrameRateCode_e25: |
|---|
| 309 | case BAVC_FrameRateCode_e29_97: |
|---|
| 310 | case BAVC_FrameRateCode_e30: |
|---|
| 311 | case BAVC_FrameRateCode_e50: |
|---|
| 312 | case BAVC_FrameRateCode_e59_94: |
|---|
| 313 | case BAVC_FrameRateCode_e60: |
|---|
| 314 | case BAVC_FrameRateCode_eUnknown: |
|---|
| 315 | bResult = true; |
|---|
| 316 | break; |
|---|
| 317 | default: |
|---|
| 318 | bResult = false; |
|---|
| 319 | break; |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | BDBG_LEAVE(BSYNClib_VideoFormat_P_IsFrameRateSupported_isr); |
|---|
| 323 | |
|---|
| 324 | return bResult; |
|---|
| 325 | } |
|---|
| 326 | |
|---|
| 327 | unsigned int BSYNClib_VideoFormat_P_GetFramePeriod(BSYNClib_VideoFormat * psFormat) |
|---|
| 328 | { |
|---|
| 329 | unsigned int uiFramePeriod; |
|---|
| 330 | |
|---|
| 331 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetFramePeriod); |
|---|
| 332 | |
|---|
| 333 | BDBG_ASSERT(psFormat); |
|---|
| 334 | |
|---|
| 335 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported(psFormat->sSnapshot.eFrameRate)) |
|---|
| 336 | { |
|---|
| 337 | uiFramePeriod = gauiFramePeriods[psFormat->sSnapshot.eFrameRate]; |
|---|
| 338 | } |
|---|
| 339 | else |
|---|
| 340 | { |
|---|
| 341 | BDBG_WRN(("Unsupported sync frame rate; lipsync may suffer")); |
|---|
| 342 | uiFramePeriod = gauiFramePeriods[0]; |
|---|
| 343 | } |
|---|
| 344 | |
|---|
| 345 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetFramePeriod); |
|---|
| 346 | return uiFramePeriod; |
|---|
| 347 | } |
|---|
| 348 | |
|---|
| 349 | unsigned int BSYNClib_VideoFormat_P_GetFramePeriod_isr(BSYNClib_VideoFormat * psFormat) |
|---|
| 350 | { |
|---|
| 351 | unsigned int uiFramePeriod; |
|---|
| 352 | |
|---|
| 353 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetFramePeriod_isr); |
|---|
| 354 | |
|---|
| 355 | BDBG_ASSERT(psFormat); |
|---|
| 356 | |
|---|
| 357 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported_isr(psFormat->sData.eFrameRate)) |
|---|
| 358 | { |
|---|
| 359 | uiFramePeriod = gauiFramePeriods[psFormat->sData.eFrameRate]; |
|---|
| 360 | } |
|---|
| 361 | else |
|---|
| 362 | { |
|---|
| 363 | BDBG_WRN(("Unsupported sync frame rate; lipsync may suffer")); |
|---|
| 364 | uiFramePeriod = gauiFramePeriods[0]; |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetFramePeriod_isr); |
|---|
| 368 | return uiFramePeriod; |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | unsigned int BSYNClib_VideoFormat_P_GetVsyncPeriod(BSYNClib_VideoFormat * psFormat) |
|---|
| 372 | { |
|---|
| 373 | unsigned int uiFieldPeriod; |
|---|
| 374 | |
|---|
| 375 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetVsyncPeriod); |
|---|
| 376 | |
|---|
| 377 | BDBG_ASSERT(psFormat); |
|---|
| 378 | |
|---|
| 379 | uiFieldPeriod = BSYNClib_VideoFormat_P_GetFramePeriod(psFormat); |
|---|
| 380 | |
|---|
| 381 | if (psFormat->sSnapshot.bInterlaced) |
|---|
| 382 | { |
|---|
| 383 | uiFieldPeriod /= 2; |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetVsyncPeriod); |
|---|
| 387 | return uiFieldPeriod; |
|---|
| 388 | } |
|---|
| 389 | |
|---|
| 390 | unsigned int BSYNClib_VideoFormat_P_GetVsyncPeriod_isr(BSYNClib_VideoFormat * psFormat) |
|---|
| 391 | { |
|---|
| 392 | unsigned int uiFieldPeriod; |
|---|
| 393 | |
|---|
| 394 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetVsyncPeriod_isr); |
|---|
| 395 | |
|---|
| 396 | BDBG_ASSERT(psFormat); |
|---|
| 397 | |
|---|
| 398 | uiFieldPeriod = BSYNClib_VideoFormat_P_GetFramePeriod_isr(psFormat); |
|---|
| 399 | |
|---|
| 400 | if (psFormat->sData.bInterlaced) |
|---|
| 401 | { |
|---|
| 402 | uiFieldPeriod /= 2; |
|---|
| 403 | } |
|---|
| 404 | |
|---|
| 405 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetVsyncPeriod_isr); |
|---|
| 406 | return uiFieldPeriod; |
|---|
| 407 | } |
|---|
| 408 | |
|---|
| 409 | #ifdef BDBG_DEBUG_BUILD |
|---|
| 410 | static const char * gapcFrameRateNames[BAVC_FrameRateCode_eMax + 1] = |
|---|
| 411 | { |
|---|
| 412 | "Unknown", |
|---|
| 413 | "23.976", |
|---|
| 414 | "24", |
|---|
| 415 | "25", |
|---|
| 416 | "29.97", |
|---|
| 417 | "30", |
|---|
| 418 | "50", |
|---|
| 419 | "59.94", |
|---|
| 420 | "60", |
|---|
| 421 | "14.985", |
|---|
| 422 | "7.493", |
|---|
| 423 | NULL |
|---|
| 424 | }; |
|---|
| 425 | |
|---|
| 426 | static const char * gapcUnsupportedFrameRateName = "Unsupported"; |
|---|
| 427 | |
|---|
| 428 | const char * BSYNClib_VideoFormat_P_GetFrameRateName(BAVC_FrameRateCode eRate) |
|---|
| 429 | { |
|---|
| 430 | const char * pcName = NULL; |
|---|
| 431 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetFrameRateName); |
|---|
| 432 | |
|---|
| 433 | BKNI_EnterCriticalSection(); |
|---|
| 434 | pcName = BSYNClib_VideoFormat_P_GetFrameRateName_isr(eRate); |
|---|
| 435 | BKNI_LeaveCriticalSection(); |
|---|
| 436 | |
|---|
| 437 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetFrameRateName); |
|---|
| 438 | return pcName; |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | const char * BSYNClib_VideoFormat_P_GetFrameRateName_isr(BAVC_FrameRateCode eRate) |
|---|
| 442 | { |
|---|
| 443 | const char * pcName = NULL; |
|---|
| 444 | BDBG_ENTER(BSYNClib_VideoFormat_P_GetFrameRateName_isr); |
|---|
| 445 | |
|---|
| 446 | if (BSYNClib_VideoFormat_P_IsFrameRateSupported_isr(eRate)) |
|---|
| 447 | { |
|---|
| 448 | pcName = gapcFrameRateNames[eRate]; |
|---|
| 449 | } |
|---|
| 450 | else |
|---|
| 451 | { |
|---|
| 452 | BDBG_WRN(("Unsupported sync frame rate; lipsync will suffer")); |
|---|
| 453 | pcName = gapcUnsupportedFrameRateName; |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | BDBG_LEAVE(BSYNClib_VideoFormat_P_GetFrameRateName_isr); |
|---|
| 457 | return pcName; |
|---|
| 458 | } |
|---|
| 459 | #endif |
|---|
| 460 | |
|---|