summaryrefslogtreecommitdiff
path: root/drivers/mxc/vpu-malone/Malone_Firmware/Incl/mediaip_fw_types.h
blob: 98ff57773a27bfccd9be953ab3aadef86cfb83b9 (plain)
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
/***************************************************
  Copyright (c) 2015 Amphion Semiconductor Ltd
                All rights reserved.
 ***************************************************
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 ****************************************************

  Filename:        mediaip_fw_types.h
  Description:     Contains structure definitions common
                   to multiple modules / layers
  Author:          Media IP FW team - Belfast / Shanghai

 ****************************************************/

#ifndef _MEDIAIP_FW_TYPES_H_
#define _MEDIAIP_FW_TYPES_H_

#include "basetype.h"
#include "mediaip_fw_defines.h"

//////////////////////////////////////////////////////////////
// Generic Stream format

typedef enum
{
  MEDIA_IP_FMT_NULL        = 0x0,
  MEDIA_IP_FMT_AVC         = 0x1,
  MEDIA_IP_FMT_VC1         = 0x2,
  MEDIA_IP_FMT_MP2         = 0x3,
  MEDIA_IP_FMT_AVS         = 0x4,
  MEDIA_IP_FMT_ASP         = 0x5,
  MEDIA_IP_FMT_JPG         = 0x6,
  MEDIA_IP_FMT_RV          = 0x7,
  MEDIA_IP_FMT_VP6         = 0x8,
  MEDIA_IP_FMT_SPK         = 0x9,
  MEDIA_IP_FMT_VP8         = 0xA,
  MEDIA_IP_FMT_MVC         = 0xB,
  MEDIA_IP_FMT_VP3         = 0xC,
  MEDIA_IP_FMT_HEVC        = 0xD,
  MEDIA_IP_FMT_AUTO_DETECT = 0xAD00,
  MEDIA_IP_FMT_ALL         = (int)0xAAAAAAAA,
  MEDIA_IP_FMT_UNSUPPORTED = (int)0xFFFFFFFF,
  MEDIA_IP_FMT_LAST = MEDIA_IP_FMT_UNSUPPORTED

} MEDIA_IP_FORMAT;

//////////////////////////////////////////////////////////////
// Generic picture Structure

typedef enum
{
  MEDIAIP_TOP_FIELD,
  MEDIAIP_BOT_FIELD,
  MEDIAIP_TWO_FIELDS,
  MEDIAIP_FRAME_PICTURE

} MEDIAIP_PIC_STRUCT;

//////////////////////////////////////////////////////////////
// Generic picture type

typedef enum
{
  MEDIAIP_I_PICTYPE = 1,
  MEDIAIP_P_PICTYPE,
  MEDIAIP_B_PICTYPE,
  MEDIAIP_UNDEF_PICTYPE

} MEDIAIP_PIC_TYPE;

//////////////////////////////////////////////////////////////
// Stream Layer

typedef enum
{
  MEDIAIP_BASE_LAYER = 0,
  MEDIAIP_ENHANCEMENT_LAYER

} MEDIAIP_LAYER;

//////////////////////////////////////////////////////////////
// Display module - sync state

typedef enum
{
  DISP_SYNC_UNINITIALISED = 0,
  DISP_SYNC_ACQUIRING,
  DISP_SYNC_ACQUIRED,
  DISP_SYNC_LOST,
  DISP_SYNC_LOST_INVALID,
  DISP_SYNC_LOST_INSANE

} MEDIAIP_DISP_SYNC_STATE;

//////////////////////////////////////////////////////////////
// PES HW state

typedef enum
{
  PES_STATE_NORMAL = 0,
  PES_STATE_PTS_BACKTOBACK,
  PES_STATE_PTS_WITH_SLICE,
  PES_STATE_PTS_WITH_PIC

} MEDIAIP_PES_STATE;

//////////////////////////////////////////////////////////////
// Playback mode

typedef enum
{
  MEDIAIP_PLAYMODE_CONNECTIVITY = 0,
  MEDIAIP_PLAYMODE_BROADCAST,
  MEDIAIP_PLAYMODE_BROADCAST_DSS,
  MEDIAIP_PLAYMODE_LAST = MEDIAIP_PLAYMODE_BROADCAST_DSS

} MEDIA_IP_PLAYMODE;

//////////////////////////////////////////////////////////////
// System mode

typedef enum
{
  MEDIAIP_SYSMODE_DTV = 0,
  MEDIAIP_SYSMODE_STB,
  MEDIAIP_SYSMODE_LAST = MEDIAIP_SYSMODE_STB

} MEDIA_IP_SYSMODE;

//////////////////////////////////////////////////////////////
// Encoder Output Info
typedef struct
{
  u_int32    uStrIndex;
  BOOL       bLastFrame;
  BOOL       bEndOfGOP;
  u_int32    uEsStruct;
  u_int32    uMsbPTS;
  u_int32    uPTS;
  u_int32    uVesSize;
  u_int32    uCbFrmStartAddr;

} MEDIAIP_ENCODER_OUTPUT_INFO;

//////////////////////////////////////////////////////////////
// YUV Output Info

#ifndef HOST_BUILD
#ifndef _MSC_VER
typedef enum
{
  YUV420 = 0x0,
  YUV422,
  YUV400

} MEDIAIP_FW_FRAME_FMT;
#endif // _MSC_VER
#endif

//////////////////////////////////////////////////////////////
// Frame Display info

typedef struct
{
  u_int32 top_field_first;
  u_int32 repeat_first_field;
  u_int32 disp_vert_res;
  u_int32 disp_horiz_res;
  u_int32 centre_vert_offset;
  u_int32 centre_horiz_offset;

} MEDIAIP_PIC_DISP_INFO;

//////////////////////////////////////////////////////////////
// Frame info

typedef struct
{
  MEDIAIP_PIC_TYPE pic_type;
  u_int32          pic_struct;
  u_int32          pic_st_addr;
  u_int32          last_pic_npf;
  u_int32          user_data_avail;
  u_int32          frame_store_id;
  u_int32          uPercentInErr;
  u_int32          view_id;         /* H264 MVC */
  u_int32          uVOIdx;          /* H264 MVC */
#if MVC_SUPPORT == MVC_ENABLED
  u_int32          uViewId;
#endif
  u_int32          uSkipInProg;

} MEDIAIP_PIC_INFO;

//////////////////////////////////////////////////////////////
// Memory request type enum

typedef enum
{
  MEDIAIP_FRAME_REQ = 0,
  MEDIAIP_MBI_REQ,
  MEDIAIP_DCP_REQ,
  MEDIAIP_REQ_LAST = MEDIAIP_DCP_REQ

} MEDIAIP_MEM_REQ;

//////////////////////////////////////////////////////////////
// Memory request ctrl

typedef struct
{
  u_int32          uLayerIdx;
  MEDIAIP_MEM_REQ  eType;

} MEDIAIP_MEM_REQ_CTRL, *pMEDIAIP_MEM_REQ_CTRL;

//////////////////////////////////////////////////////////////
// Memory release ctrl

typedef struct
{
  u_int32          uLayerIdx;
  u_int32          uFSIdx;
  MEDIAIP_MEM_REQ  eType;

} MEDIAIP_MEM_REL_CTRL, *pMEDIAIP_MEM_REL_CTRL;

////////////////////////////////////////////////////////
// Media IP mem alloc struct

typedef struct
{
  MEDIAIP_MEM_REQ  eType;
  u_int32          uLayerIdx;

  u_int32          uFSHandle;
  u_int32          uBaseAddr;
  u_int32          uStride;
  u_int32          uChromaOffset;

} MEDIAIP_MEM_ALLOC_CTRL, *pMEDIAIP_MEM_ALLOC_CTRL;

//////////////////////////////////////////////////////////////
// Decoder metrics info

typedef struct
{
  u_int32 uDpbmcCrc;
  u_int32 uFrameActiveCount;
  u_int32 uSliceActiveCount;
  u_int32 uRbspBytesCount;
  u_int32 uSibWaitCount;
  u_int32 uDpbReadCount;
  u_int32 uMprWaitCount;
  u_int32 uBBBCrc;
  u_int32 uAccQP;
  u_int32 uCacheStat;
  u_int32 uCRCSkip;
  u_int32 uCRCDrop;
  BOOL    bCRCValid;

  u_int32 uBaseDpbMcCrc;
  u_int32 uByteStreamCrc;

  u_int32 uCRC0;
  u_int32 uCRC1;
  u_int32 uCRC2;
  u_int32 uCRC3;
  u_int32 uCRC4;
  u_int32 uCRC5;
  u_int32 uCRC6;
  u_int32 uCRC7;
  u_int32 uCRC8;
  u_int32 uCRC9;
  u_int32 uCRC10;
  u_int32 uCRC11;
  u_int32 uCRC12;
  u_int32 uCRC13;
  u_int32 uCRC14;

  u_int32 mbq_full;
  u_int32 mbq_empty;
  u_int32 slice_cnt;
  u_int32 mb_count;

  u_int32 uTotalTime_us;
  u_int32 uTotalFwTime_us;

  u_int32 uSTCAtFrameDone;

  u_int32 uProcIaccTotRdCnt;
  u_int32 uProcDaccTotRdCnt;
  u_int32 uProcDaccTotWrCnt;
  u_int32 uProcDaccRegRdCnt;
  u_int32 uProcDaccRegWrCnt;
  u_int32 uProcDaccRngRdCnt;
  u_int32 uProcDaccRngWrCnt;

} MEDIAIP_DEC_METRICS_INFO, *pMEDIAIP_DEC_METRICS_INFO;

//////////////////////////////////////////////////////////////
// GOP info

typedef struct
{
  u_int32 closed_gop;
  u_int32 broken_link;

} MEDIAIP_GOP_INFO;

//////////////////////////////////////////////////////////////
// Stream frequency

typedef enum
{
  MEDIAIP_FR_UNKNOWN  = 0,
  MEDIAIP_FR_23_97_HZ = 1,
  MEDIAIP_FR_24_HZ    = 2,
  MEDIAIP_FR_25_HZ    = 3,
  MEDIAIP_FR_29_97_HZ = 4,
  MEDIAIP_FR_30_HZ    = 5,
  MEDIAIP_FR_50_HZ    = 6,
  MEDIAIP_FR_59_94_HZ = 7,
  MEDIAIP_FR_60_HZ    = 8,
  MEDIAIP_FR_7P992_HZ = 9,
  MEDIAIP_FR_8_HZ     = 10,
  MEDIAIP_FR_8P33_HZ  = 11,
  MEDIAIP_FR_9P99_HZ  = 12,
  MEDIAIP_FR_10_HZ    = 13,
  MEDIAIP_FR_11P988_HZ= 14,
  MEDIAIP_FR_12_HZ    = 15,
  MEDIAIP_FR_12P5_HZ  = 16,
  MEDIAIP_FR_14P985_HZ= 17,
  MEDIAIP_FR_15_HZ    = 18

} MEDIAIP_OUTPUT_FREQ;

//////////////////////////////////////////////////////////////
// Scan info

typedef enum
{
  MEDIAIP_PROGRESSIVE,
  MEDIAIP_INTERLACE

} MEDIAIP_SCAN_INFO;

//////////////////////////////////////////////////////////////
// Pipeline type enumeration

typedef enum
{
  MEDIAIP_VIDEO_DECODE_PIPELINE = 0x0,
  MEDIAIP_VIDEO_ENCODE_PIPELINE,
  MEDIAIP_VIDEO_TRANSCODE_PIPELINE,
  MEDIAIP_VIDEO_TRANSDISP_PIPELINE,
  MEDIAIP_VIDEO_NULL_PIPELINE

} MEDIAIP_VIDEO_PIPELINE_TYPE;

//////////////////////////////////////////////////////////////
// Decode info

/* TODO-KMC */
/* Why do these structures break the protocol in case used for naming ? */

typedef enum
{
   MediaIPFW_DEC_CodingTypeI = 1,
   MediaIPFW_DEC_CodingTypeP,
   MediaIPFW_DEC_CodingTypeAny,
   MediaIPFW_DEC_CodingTypeIP,
   MediaIPFW_DEC_CodingTypeSkip,
   MediaIPFW_DEC_CodingTypeLast

} MediaIPFW_DEC_CodingType;

//////////////////////////////////////////////////////////////
// Decode Command Mode

typedef enum
{
  MediaIPFW_DEC_ModeSplit = 0,
  MediaIPFW_DEC_ModeNoSplit

} MediaIPFW_DEC_Mode;

//////////////////////////////////////////////////////////////
// Tag structures

typedef enum
{
  TAG_FREE = 0,
  TAG_IN_USE

} TAG_STATUS;

typedef struct
{

  u_int32 pts;             //  TSP aspect of the structure
  u_int32 dts;
  u_int32 pts_flags;
#ifdef PES_INPUT_ENABLE
#else
  u_int32 maturity_address;
#endif
  u_int32 scode_loc;      // Possibly this variable could be combined with maturity_address
                          // They are the same thing, but come from very different places
  BOOL    bValid;

} DEMUX_INFO, *pDEMUX_INFO;

// This struct is AVC specific - needs to be generic or at least cast as generic
typedef struct
{

  u_int32 sei_flags;        // Display aspect
  u_int32 sei_pic_struct;

} DISP_INFO, *pDISP_INFO;

typedef struct
{
  u_int32 fs_idc;
  u_int32 uUseFrameCRC;
  u_int32 uBotFirst;
  u_int32 uTopData[2];
  u_int32 uBotData[2];
  u_int32 uReported;

  u_int32 uDpbmcCRC;    // Internal MC interface CRC
  u_int32 uBsCRC;       // Byte Stream CRC

  u_int32 uDPBLevel;   // DPB Level at frame start

  u_int16 fs_is_used;
  u_int16 Monochrome;

  u_int32 control;

} CRC_INFO, *pCRC_INFO;

typedef struct
{
  u_int32 frame_size_inmbs;   // {Size[15:0],Height[7:0],Width[7:0]}
  u_int32 bs_ib_empty;
  u_int32 frm_dec_active;
  u_int32 slc_dec_active;
  u_int32 stc_at_decode;
  u_int32 stc_at_display;
  u_int32 num_slc_overlapped;
  u_int32 num_mb_overlapped;
  u_int32 luma_address;
  u_int32 cpb_min_level;
  u_int32 rbsp_byte_count;
  u_int32 dpb_read_count;
  u_int32 mpr_wait_count;
  u_int32 slice_count;
  u_int16 drm_pull_count;
  u_int16 drm_pap_pts_cnt;
  u_int16 drm_pap_skip_cnt;
  u_int16 drm_pap_dang_cnt;

} PERF_INFO, *pPERF_INFO;

typedef struct
{
  u_int32 uNumSlices;
  u_int32 uSumQP;

}QMETER_INFO, *pQMETER_INFO;

typedef struct
{

  DEMUX_INFO  TspInfo;
  DISP_INFO   DispInfo;
  CRC_INFO    CRCInfo;
  TAG_STATUS  Status;          // General info on the structure - free or taken...
  QMETER_INFO QMeterInfo;
  u_int32     uPercentMBInErr;
#ifdef PERF_DEBUG
  PERF_INFO   PerfInfo;
#endif

} TAG, *pTAG;

typedef struct
{

  u_int32 uLastTSP;
  u_int32 uLastNonTSP;
  u_int32 uInUse;

} TAG_CTRL, *pTAG_CTRL;


// Film Grain technology support
typedef struct
{
  BOOL    bFGS_Flag;
  u_int32 log2_scale_factor;
  u_int32 pic_order_count;
  u_int32 pic_order_offset;
  u_int16 fgs_lut[3][256];

}USERDATA_FILMGRAIN_CONTROL;

#define DIAG_ARRAY_SIZE 26

typedef struct
{

  int32    nAvcDiagState;
  int32    nTSPDiagState;
  u_int32  uFailurePt;
  u_int32  uFailData[4];
  int32    nLastCall;
  int32    nDecodeBegan;
  int32    nEngStart;
  u_int32  uLastStart;
  int32    DPBCount;
  int32    DPBAnomaly;
  int32    DPBAnomalyCnt;
  int32    nEntryIndex;
  int32    nEntryArray[DIAG_ARRAY_SIZE];
  int32    nExitIndex;
  int32    nExitArray[DIAG_ARRAY_SIZE];

} DiagInfo, *pDiagInfo;


////////////////////////////////////////////////////////
// Frame store structure -
// Common to multiple modules will hold all information
// which needs to be transferred between any two modules
// in relation to a picture buffer

typedef struct mediaip_fw_frame_store
{
  struct mediaip_fw_frame_store * pNext;     // Not entirely sure I need this - we will see as the architecture evolves...

  /* Frame store description */
  u_int32 uBaseAddr;                         // Base Address - Luma base for a image store, address for MBI or BLI
  u_int32 uChromaOffset;
  u_int32 uPitch;
  u_int32 uDimsMBs;

  // Module usage
  u_int32 uModUsage;                         // 1 bit set for each module that considers this frame store to be in use by it
                                             // For a real time display / transcode situation this could be more than 2

  // Last Frame flag
  BOOL bLastFrame;                           // Flag to indicate whether this is the last frame store decoded by the decoder.
                                             // Important when stopping a transcode pipeline or reaching the last frame of a bitstream
                                             // so that we can tell the encoder not to expect any more frames and hence empty it's
                                             // pipeline.

  // Display params
  u_int32 uDispData;                         // Bottom field first etc - normally to be filled in by decode module

  // Frame store
  u_int32 uFSID;                             // An ID used to cross reference with a local structure - filled in by the capture unit, decoder or
                                             // image capture unit, etc

  pTAG    pFSTag;                            // A pointer to a tag for the frame store - normally allocated by the decoder so that unit should
                                             // set the pointer

  USERDATA_FILMGRAIN_CONTROL ud_filmgrain;   // Filmgrain support structure

  // Want to give anything that may be managed by the resource layer a generic resource tag!
  // Until I can be bothered working out how to do this I will go with the 3 below...

  u_int8  uDynBuffType;                      // What is the buffer type of the currently allocayted frame store
                                             // Could be worked out from uFSInternBufNum - Remember if we have to
                                             // hold a frames over a channel change not all uDynBuffType members
                                             // will be the same in each stream's group of frame stores

  u_int8  uFSInternBufStart;
  u_int8  uFSInternBufNum;

} MEDIAIP_FW_FRAME_STORE;

typedef MEDIAIP_FW_FRAME_STORE  MEDIAIP_FW_ENCODER_REF_FRAME_STORE;
typedef MEDIAIP_FW_FRAME_STORE  MEDIAIP_FW_ENCODER_FRAME_ACT_STORE;


////////////////////////////////////////////////////////
// MetaData store structure -
// Defines an area which may be passed to a base module for its own internal use

typedef struct
{
  u_int32 uMetadataBase;
  u_int32 uMetadataSize;

} MEDIAIP_FW_METADATA_STORE, *pMEDIAIP_FW_METADATA_STORE;

////////////////////////////////////////////////////////
// Stream Frequency enumeration -


typedef enum {

                STREAM_FR_UNKNOWN  = 0,
                STREAM_FR_23_97_HZ = 1,
                STREAM_FR_24_HZ    = 2,
                STREAM_FR_25_HZ    = 3,
                STREAM_FR_29_97_HZ = 4,
                STREAM_FR_30_HZ    = 5,
                STREAM_FR_50_HZ    = 6,
                STREAM_FR_59_94_HZ = 7,
                STREAM_FR_60_HZ    = 8

             } STREAM_SCAN_FREQ;

////////////////////////////////////////////////////////
// Digital Encode Mode ( at the tv encoder)

typedef enum {
                MODE_240p        = 0x0,
                MODE_240i        = 0x1,
                MODE_480p        = 0x2,
                MODE_NTSC        = 0x3,
                MODE_PALp        = 0x4,
                MODE_PAL         = 0x5,
                MODE_720p        = 0x6,
                MODE_720p_50Hz   = 0x7,
                MODE_720i        = 0x8,
                MODE_720i_25Hz   = 0x9,
                MODE_720i_50Hz   = 0xa,
                MODE_720i_60Hz   = 0xb,
                MODE_1080p       = 0xc,
                MODE_1080p_25Hz  = 0xd,
                MODE_1080i       = 0xe,
                MODE_1080i_25Hz  = 0xf,
                MODE_2Kp         = 0x10,
                MODE_1080p_24Hz  = 0x11,
                MODE_UNKNOWN     = 0xff

             } TV_ENC_MODE;

////////////////////////////////////////////////////////
// Stream Display parameters

typedef struct
{
  u_int32              uTargetLevel;
  u_int32              uHorDecodeRes;
  u_int32              uVerDecodeRes;
  u_int32              uHorDispRes;
  u_int32              uVerDispRes;
  u_int32              uDispWidthMBs;
  u_int32              uDispHeightMBs;
  u_int32              uBufWidthMBs;
  u_int32              uBufHeightMBs;
  u_int32              uAspectRatio;
  u_int32              uSizeMBs;
  u_int32              uYUVFmt;
  u_int32              uScanFormat;
  STREAM_SCAN_FREQ     sFreq;
  u_int32              uNumRefFrms;
  u_int32              uNumDPBFrms;
  u_int32              uNumDFEAreas;
  u_int32              uProfLevelIDC;
  MEDIAIP_OUTPUT_FREQ  eOutputFreq;
  MEDIAIP_SCAN_INFO    eScanInfo;
  u_int32              uAR;
  u_int32              uColorDesc;
  u_int32              uBitDepthLuma;
  u_int32              uBitDepthChroma;
  u_int32              uNumViews;
  u_int32              uViewList;

} MEDIAIP_FW_STREAM_DISPLAY_PARAMS;


////////////////////////////////////////////////////////
// Frame decoded parameters

typedef struct
{
  BOOL                 bTopFieldFirst;
  BOOL                 bRepeatFirstField;
  MEDIAIP_PIC_TYPE     ePicType;
  MEDIAIP_PIC_STRUCT   ePicStruct;

  u_int32              uFSHandle;

  u_int32              uPicStartAddr;
  u_int32              uPercentMBsInErr;

  u_int32              uPTSLo;
  u_int32              uPTSHi;
  BOOL                 bPTSValid;

  BOOL                 bQMeterValid;
  u_int32              uQMeter;
  BOOL                 bGopBitRateAvail;
  u_int32              uGopBitRate;

  u_int32              bTemporalRef;

  u_int32              uBbdHorActive;
  u_int32              uBbdVerActive;
  u_int32              uBbdLogoActive;
  u_int32              uBbdBotPrev;
  u_int32              uBbdMinColPrj;
  u_int32              uBbdMinRowPrj;

  u_int32              uFSBaseAddr;
  BOOL                 bDangling;
  BOOL                 bTopFieldPresent;

  /* Only for RealVideo RPR */
  u_int32              uRprPicWidth;
  u_int32              uRprPicHeight;

  /* Only for DivX3         */
  u_int32              uFrameRate;

  /* For decode time yuv gathering */
  u_int32              ulTopLumBaseAddr;
  u_int32              ulTopChrBaseAddr;
  u_int32              ulBotLumBaseAddr;
  u_int32              ulBotChrBaseAddr;

  u_int32              ulStride;

  void *               pAltView;
  u_int32              uMVCTargetViewIdx;
} MEDIAIP_FW_FRAME_DEC_PARAMS , *pMEDIAIP_FW_FRAME_DEC_PARAMS;

////////////////////////////////////////////////////////
// SVC Seq parameters

typedef struct
{
  u_int32                          uNumValidLayers;
  MEDIAIP_FW_STREAM_DISPLAY_PARAMS tLayerParams[MEDIAIP_MAX_SVC_DID];

} MEDIAIP_FW_SVC_STREAM_PARAMS;

//////////////////////////////////////////////////////////////
// IRQ Event data

typedef struct
{
  void *  pMVDHw;
  u_int32 uIrqStatus[0x3];

} MEDIAIP_FW_IRQ_DATA, *pMEDIAIP_FW_IRQ_DATA;


//////////////////////////////////////////////////////////////
// CMD Event data

typedef struct
{
  u_int32 uCmdData;

}MEDIAIP_FW_CMD_DATA, *pMEDIAIP_FW_CMD_DATA;

//////////////////////////////////////////////////////////////
// Callback Request Data

typedef struct
{
  u_int32 uReason;

}MEDIAIP_FW_CBACK_DATA, *pMEDIAIP_FW_CBACK_DATA;

////////////////////////////////////////////////////////
// Interface descriptor
// Generic descriptor type as initially defined by Tempest
// module

typedef struct
{

  volatile u_int32 address;
  volatile u_int32 parameters;

} INTERFACE_DESCRIPTOR_TYPE, *pINTERFACE_DESCRIPTOR_TYPE;

////////////////////////////////////////////////////////
// Buffer descriptor
// Generic buffer descriptor as initially defined by Tempest
// module

typedef struct
{
  u_int32 descriptor_number;
  u_int32 descriptor_size;
  u_int32 descriptor_ptr;

} BUFFER_TBL_DESCRIPTOR, *BUFFER_TBL_DESCRIPTOR_PTR;

////////////////////////////////////////////////////////
// Buffer descriptor
// Generic buffer descriptor as initially defined by Tempest
// module

typedef struct
{
  u_int32 wptr;
  u_int32 rptr;
  u_int32 start;
  u_int32 end;

} BUFFER_DESCRIPTOR_TYPE, *pBUFFER_DESCRIPTOR_TYPE;

////////////////////////////////////////////////////////
// Stream Buffer descriptor
// Specific buffer descriptor for stream data

typedef struct
{
  volatile u_int32 wptr;
  volatile u_int32 rptr;
  volatile u_int32 start;
  volatile u_int32 end;
  volatile u_int32 LWM;

} STREAM_BUFFER_DESCRIPTOR_TYPE, *pSTREAM_BUFFER_DESCRIPTOR_TYPE;

#ifdef TCODE_API_TEST
// Defined specific for PCI ,for its access unit is 64 bits
typedef struct
{
  volatile u_int32 wptr;
  volatile u_int32 wptr_res;
  volatile u_int32 rptr;
  volatile u_int32 rptr_res;
  volatile u_int32 start;
  volatile u_int32 end;

} BUF_DES_PCI_SHARE_TYPE, BUF_DES_PCI_SHARE_TYPE_PTR;

#endif
////////////////////////////////////////////////////////
// Stream Buffer descriptor
// Buffer descriptor as used by the encoder
// module

typedef struct
{

  u_int32 stream_index;
  u_int32 stream_buffer_size;
  u_int32 stream_buffer_base;

} STREAM_BUFFER_DESCRIPTOR, *STREAM_BUFFER_DESCRIPTOR_PTR;

typedef STREAM_BUFFER_DESCRIPTOR MEDIAIP_FW_ENCODER_STREAM_BUFFER_DESC;

////////////////////////////////////////////////////////
// PTS debug descriptor
// This descriptor is as initially defined by Tempest
// module

typedef struct
{
  volatile u_int32 pts_lo;
  volatile u_int32 stc_lo;
  volatile   int32 error;
  volatile u_int32 flags;

} PTS_DEBUG_DESCRIPTOR_TYPE, *pPTS_DEBUG_DESCRIPTOR_TYPE;

////////////////////////////////////////////////////////
// PTS descriptor
// This descriptor is as initially defined by Tempest
// module

typedef struct
{
  volatile u_int32 pts_lo;
  volatile u_int32 dts_lo;
  volatile   int32 flags;
  volatile u_int32 maturity_addr;

} PTS_DESCRIPTOR_TYPE, *pPTS_DESCRIPTOR_TYPE;

//////////////////////////////////////////////////////////////
// Video Stream Status structure
//
// Note : I am putting this in the communal include file because we may wish to let
// module base FW update such a structure directly as opposed to sending messages
// back to the public FW level...
// We may also wish to lump all module's status into this one structure

// Why are these volatiles? Should consider removing their volatility!!...
typedef struct
{
  //////////////////////
  // Pipeline variables
  volatile u_int32 run;
  volatile u_int32 pause;

  //////////////////////
  // Decoder variables
  volatile u_int32 mpeg_format;
  volatile u_int32 DSS;
  volatile u_int32 native_sd;
  volatile u_int32 stop;
  volatile u_int32 stop_pending;
  volatile u_int32 stream_terminate_type;
  volatile u_int32 ES;
  volatile u_int32 PAL;
  volatile u_int32 CRC;
  volatile u_int32 update_offset;
  volatile u_int32 pcr_sent;
  volatile u_int32 PVRMode;
  volatile u_int32 malone_mp2_dbdrng_en;
  volatile u_int32 uWaitFlush;

  volatile u_int32 pvr_type;    /* These are new - need to be fixed */
  volatile u_int32 valid_frame_mask;

  //////////////////////
  // Display variables
  volatile u_int32 force_interlace;
  volatile u_int32 sync_stc;
  volatile int32   nTrinityDisc;
  volatile u_int32 uTrinityDiscPCRLo;
  volatile u_int32 display_mode_status;
  volatile u_int32 sync;

} MEDIAIP_FW_STREAM_STATUS, *MEDIAIP_FW_STREAM_STATUS_PTR;

//////////////////////////////////////////////////////////////
// Stream Descriptor Structure
//
// Currently this is basically the stream descriptor structure
// from the decoder FW interface with the host SW
// This needs to evolve to suit our needs better
#if ( TARGET_PLATFORM == GENTB_PLATFORM )

typedef struct
{
  volatile u_int32 Control;
  volatile u_int32 Buffer_Indices;
  volatile u_int32 Message_Filter;
  volatile u_int32 Extended_Message_Filter;
  volatile u_int32 Tempest_Command_Filter;
  volatile u_int32 Status;
  volatile u_int32 Bitstream_Error;
  volatile u_int32 Skip_Count;
  volatile u_int32 Repeat_Count;
  volatile u_int32 Frame_Count;
  volatile u_int32 Bitstream_Timeout;
  volatile u_int32 Max_Frame_Dpb_Size;                     // For dynamic frame allocation this actually means the start of the allocated memory
  volatile u_int32 Decode_Buffer_Count;                    // For dynamic frame allocation this actually means the size of allocated memory
  volatile u_int32 Buffer_Pitch;                           // For dynamic frame allocation this actually means the memory controller tile width
  volatile INTERFACE_DESCRIPTOR_TYPE DPB_Base_Address_dec; // For dynamic frame allocation this actually means the MB info address
  volatile u_int32 PTS_DTS_Offset;
  volatile u_int32 Internal_PTS_Delay;
  volatile u_int32 Sync_Window_Start;
  volatile u_int32 Sync_Window_End;
  volatile u_int32 Sync_Sanity_Limit;
  volatile u_int32 trick_speed;
  INTERFACE_DESCRIPTOR_TYPE user_data_desc;

  INTERFACE_DESCRIPTOR_TYPE  FrameStoreDesc;
  INTERFACE_DESCRIPTOR_TYPE  frame_buffer_control_desc;

  INTERFACE_DESCRIPTOR_TYPE  pvr_command_list_desc;
  volatile u_int32           Pad[2];

  pPTS_DESCRIPTOR_TYPE       pts_table_desc;
  pPTS_DEBUG_DESCRIPTOR_TYPE pts_debug_table_desc;

  volatile u_int32           PVR_Control;
  volatile u_int32           RAI;

  // For PecosB onwards this is the security control word
  volatile u_int32           security_control;
  // Status variables for a stream
  volatile u_int32           sd_changed_control;
  volatile u_int32           ud_type_mask;
  MEDIAIP_FW_STREAM_STATUS   stream_status;

#if TARGET_APP == VIDEO_TRANS
  volatile u_int32 FrameStoreCount;
  // Second set of image buffers ( only required in a dual MC situation )
  volatile u_int32 FrameStoreCount2;
  volatile INTERFACE_DESCRIPTOR_TYPE  FrameStoreDesc2;

  // Encoder Reference buffers
  volatile u_int32 EncRefCount;
  volatile INTERFACE_DESCRIPTOR_TYPE  EncRefDesc;

  // Encoder Image Activity buffers
  volatile u_int32 EncActCount;
  volatile INTERFACE_DESCRIPTOR_TYPE  EncActDesc;

  // Stream buffer descriptor index - for encoder and decoder
  volatile u_int32                    uDecStrmBufIdx;          // Current decode FW expects that the buffer used will match the SDIndex
  volatile u_int32                    uEncOutBufIdx;

  // Only enc, vamux interDesc used at present to pass params
  volatile INTERFACE_DESCRIPTOR_TYPE  uDecParamSet;
  volatile INTERFACE_DESCRIPTOR_TYPE  uEncParamSet;
  volatile INTERFACE_DESCRIPTOR_TYPE  uVamuxParamSet;

  // Hardware Interface to system layer
  INTERFACE_DESCRIPTOR_TYPE           system_config_desc;

#ifdef TCODE_API_TEST
  volatile INTERFACE_DESCRIPTOR_TYPE  uBitRateDispSet;
#endif

  volatile u_int32                    streamdes_id;

#else

#if PLAYMODE == STB
  volatile u_int32                    streamdes_id;
#endif
#endif

} STREAM_DESCRIPTOR, *STREAM_DESCRIPTOR_PTR;

#else

typedef struct
{
  volatile u_int32 Control;                   // 0
  volatile u_int32 Buffer_Indices;
  volatile u_int32 Message_Filter;
  volatile u_int32 Extended_Message_Filter;
  volatile u_int32 Tempest_Command_Filter;
  volatile u_int32 Status;
  volatile u_int32 Bitstream_Error;
  volatile u_int32 Skip_Count;
  volatile u_int32 Repeat_Count;
  volatile u_int32 Frame_Count;
  volatile u_int32 Bitstream_Timeout;
  volatile u_int32 Max_Frame_Dpb_Size;
  volatile u_int32 Buffer_Pitch;
  volatile u_int32 Decode_Buffer_Count;
  volatile u_int32 PTS_DTS_Offset;
  volatile u_int32 Internal_PTS_Delay;
  volatile u_int32 Sync_Window_Start;
  volatile u_int32 Sync_Window_End;
  volatile u_int32 Sync_Sanity_Limit;
  volatile u_int32 trick_speed;                 // 20

  // Image buffers
  volatile u_int32 FrameStoreCount;
  volatile INTERFACE_DESCRIPTOR_TYPE  FrameStoreDesc;

  // Second set of image buffers ( only required in a dual MC situation )
  volatile u_int32 FrameStoreCount2;
  volatile INTERFACE_DESCRIPTOR_TYPE  FrameStoreDesc2;

  // Encoder Reference buffers
  volatile u_int32 EncRefCount;
  volatile INTERFACE_DESCRIPTOR_TYPE  EncRefDesc;

  // Encoder Image Activity buffers
  volatile u_int32 EncActCount;                       // 30
  volatile INTERFACE_DESCRIPTOR_TYPE  EncActDesc;

  // Stream buffer descriptor index - for encoder and decoder
  volatile u_int32                    uDecStrmBufIdx;          // Current decode FW expects that the buffer used will match the SDIndex
  volatile u_int32                    uEncOutBufIdx;

  // Only enc, vamux interDesc used at present to pass params
  volatile INTERFACE_DESCRIPTOR_TYPE  uDecParamSet;
  volatile INTERFACE_DESCRIPTOR_TYPE  uEncParamSet;
  volatile INTERFACE_DESCRIPTOR_TYPE  uVamuxParamSet;

  INTERFACE_DESCRIPTOR_TYPE           user_data_desc;
  INTERFACE_DESCRIPTOR_TYPE           frame_buffer_attribute_desc;     // Address of the attribute table used by the display process
                                                                       // Who fills this in?? Do I give a shite in module architecture?
  INTERFACE_DESCRIPTOR_TYPE           frame_buffer_control_desc;
  BUFFER_DESCRIPTOR_TYPE              pvr_command_list_desc;
  pPTS_DESCRIPTOR_TYPE                pts_table_desc;
  pPTS_DEBUG_DESCRIPTOR_TYPE          pts_debug_table_desc;

  // Hardware Interface to system layer
  INTERFACE_DESCRIPTOR_TYPE           system_config_desc;

  // Status variables for a stream
  volatile u_int32                    sd_changed_control;
  MEDIAIP_FW_STREAM_STATUS            stream_status;

  volatile u_int32                    RAI;


#ifdef DRM_AV_SYNC_DEBUG
  volatile u_int32 DRMPath_Take_Snapshot;                                // Only used when DRM_AV_SYNC_DEBUG defined but included
  volatile u_int32 DRMPath_Snapshot_Addr;                                // in all builds to enable more transparent api
  volatile u_int32 DRMPath_Snapshot_Index;                               // operations
#endif

#ifdef TCODE_API_TEST
  volatile INTERFACE_DESCRIPTOR_TYPE  uBitRateDispSet;
#endif

  volatile u_int32                    streamdes_id;

  /* Following have been removed from official descriptor area
  INTERFACE_DESCRIPTOR_TYPE  sps_td;
  INTERFACE_DESCRIPTOR_TYPE  pps_td;
  INTERFACE_DESCRIPTOR_TYPE  spds_td;
  */

} STREAM_DESCRIPTOR, *STREAM_DESCRIPTOR_PTR;

#endif

#define  CRC_DEBUG_NUM  1024
#define  PERF_DEBUG_NUM 2048  // 68secs
#define  CRC_FRAME      0
#define  CRC_FIELD_TOP  1
#define  CRC_FIELD_BOT  3

typedef struct
{

  u_int32 abort_type;
  u_int32 mode;
  u_int32 link_reg;
  u_int32 stack_pointer;

}ExceptionDesc, pExceptionDesc;

#ifndef VIDEO_SOFTWARE
/* Structure below needs to be in shared memory header file for SW apps */
typedef enum
{
  MVDDecoderOK = 0x0,
  MVDDecoderServiceIrq,
  MVDDecoderCmdPending,
  MVDDecoderFWLoop,
  MVDDecoderHWActive,
  MVDDecoderHWActiveStreamStall,
  MVDDecoderHWActiveMemStall,
  MVDDecoderFWHWDeadlock,
  MVDDecoderFWHWAutoRec,
  MVDDecoderHWBSDMAIssue,
  MVDDecoderUnknown,
  MVDDecoderLast = MVDDecoderUnknown

} MEDIAIP_FW_DECODER_STATUS;

#endif

typedef struct

{

  u_int32 size;               // Size of this structure
  u_int32 index;              // Current index into array
  u_int32 loops;              // Number of times we looped
  u_int32 num_frames;         // Number of frames in a loop
  u_int32 frame_size_inmbs;   // {Size[15:0],Height[7:0],Width[7:0]}

  u_int32 not_first_time;
  u_int32 prev_vsync_count;
  u_int32 worst_frame;
  u_int32 loop_key;           // Value used to decide when stream has looped
  u_int32 skip_start;


  u_int32 luma_mismatches;    //
  u_int32 chroma_mismatches;  //
  u_int32 dpbmc_mismatches;   //
  u_int32 bs_mismatches;      //
  u_int32 skip_count;         //
  u_int32 repeat_count;       //
  u_int32 loop_lu_crc;        // Merge of CRCs
  u_int32 loop_ch_crc;        // Merge of CRCs

  // Most recent captured Info
  u_int32 crc_type[PERF_DEBUG_NUM];
  u_int32 idr_pic[PERF_DEBUG_NUM];
  u_int32 poc[PERF_DEBUG_NUM];
  u_int32 luma_crc[PERF_DEBUG_NUM];
  u_int32 chroma_crc[PERF_DEBUG_NUM];
  u_int32 dpbmc_crc[PERF_DEBUG_NUM];          // Only valid for BBV & above
  u_int32 bs_crc[PERF_DEBUG_NUM];             // Only valid for BBV & above

  // Mismatches & skips
  u_int32 luma_mismatch[PERF_DEBUG_NUM];
  u_int32 chroma_mismatch[PERF_DEBUG_NUM];
  u_int32 dpbmc_mismatch[PERF_DEBUG_NUM];     // Only valid for BBV & above
  u_int32 bs_mismatch[PERF_DEBUG_NUM];        // Only valid for BBV & above

  u_int32 mismatch_fs_idc[32];
  u_int32 skip[PERF_DEBUG_NUM];
  u_int32 repeat[PERF_DEBUG_NUM];


  // Performance metrics & the associated CRCs for first loop
  u_int32 crc_type_l0[PERF_DEBUG_NUM];
  u_int32 idr_pic_l0[PERF_DEBUG_NUM];
  u_int32 poc_l0[PERF_DEBUG_NUM];
  u_int32 luma_crc_l0[PERF_DEBUG_NUM];
  u_int32 chroma_crc_l0[PERF_DEBUG_NUM];
  u_int32 dpbmc_crc_l0[PERF_DEBUG_NUM];       // Only valid for BBV & above
  u_int32 bs_crc_l0[PERF_DEBUG_NUM];          // Only valid for BBV & above

  // Max of metrics
  u_int32 max_slc_dec_active;
  u_int32 max_dpb_read_count;
  u_int32 max_mpr_wait_count;
  u_int32 max_rbsp_byte_count;
  u_int32 max_bs_ib_empty;
  u_int32 max_slice_count;
  u_int32 max_mb_overlapped;
  u_int32 min_stc_diff;
  u_int32 max_frm_dec_active;
  u_int32 max_frm_dec_active_2;
  u_int32 max_frm_dec_active_4;
  u_int32 max_frm_dec_active_8;

  // Max of metrics assiciated with worst frame
  u_int32 mfda_bs_ib_empty;
  u_int32 mfda_mpr_wait_count;
  u_int32 mfda_dpb_read_count;
  u_int32 mfda_rbsp_byte_count;
  u_int32 mfda_slice_count;
  u_int32 mfda_slc_dec_active;
  u_int32 mfda_mb_overlapped;

  // Will effectively be averages
  u_int32 Av_frm_dec_active;
  u_int32 Av_slc_dec_active;
  u_int32 Av_mpr_wait_count;
  u_int32 Av_dpb_read_count;
  u_int32 Av_rbsp_byte_count;
  u_int32 Av_bs_ib_empty;
  u_int32 Av_slice_count;
  u_int32 Av_mb_overlapped;

  u_int32 stc_diff[PERF_DEBUG_NUM];
  u_int32 frm_dec_active[PERF_DEBUG_NUM];
  u_int32 bs_ib_empty[PERF_DEBUG_NUM];
  u_int32 slc_dec_active[PERF_DEBUG_NUM];
  u_int32 num_slc_overlapped[PERF_DEBUG_NUM]; // Only valid for BBV & above
  u_int32 num_mb_overlapped[PERF_DEBUG_NUM];  // Only valid for BBV & above
  u_int32 cpb_min_level[PERF_DEBUG_NUM];
  u_int32 rbsp_byte_count[PERF_DEBUG_NUM];
  u_int32 dpb_read_count[PERF_DEBUG_NUM];
  u_int32 mpr_wait_count[PERF_DEBUG_NUM];
  u_int16 drm_pull_count[PERF_DEBUG_NUM];
  u_int16 drm_pap_pts_cnt[PERF_DEBUG_NUM];
  u_int16 drm_pap_skip_cnt[PERF_DEBUG_NUM];
  u_int16 drm_pap_dang_cnt[PERF_DEBUG_NUM];

  u_int32 initial_dpb_level[PERF_DEBUG_NUM];  // DPB level at frame start

} PerfDebug;

typedef struct

{

  u_int32 loops;              // Number of times we looped
  u_int32 loop_frames;        // Number of frames in a loop
  u_int32 num_frames;         // Position in current loop
  u_int32 loop_dpbmc_crc;     // Merge of CRCs
  u_int32 loop_stream_crc;    // Merge of CRCs
  u_int32 LoopCyCntD1024;     // Sum of frm_dec_active/1024
  u_int32 MaxDecActive;       // Max frm_dec_active
  u_int32 not_first_time;
  u_int32 first_crc;
  u_int32 WorstFrame;

} DecDebug;


///////////////////////////////////////////
// System Configuration structure

typedef struct
{
  u_int32 uCfgCookie;

  u_int32 uNumMalones;
  u_int32 uMaloneBaseAddress[MEDIAIP_MAX_NUM_MALONES];
  u_int32 uHifOffset[MEDIAIP_MAX_NUM_MALONES];
  u_int32 uMaloneIrqPin[MEDIAIP_MAX_NUM_MALONES][MEDIAIP_MAX_NUM_MALONE_IRQ_PINS];
  u_int32 uMaloneIrqTarget[MEDIAIP_MAX_NUM_MALONES][MEDIAIP_MAX_NUM_MALONE_IRQ_PINS];

  u_int32 uNumWindsors;
  u_int32 uWindsorBaseAddress[MEDIAIP_MAX_NUM_WINDSORS];
  u_int32 uWindsorIrqPin[MEDIAIP_MAX_NUM_WINDSORS][MEDIAIP_MAX_NUM_WINDSOR_IRQ_PINS];
  u_int32 uWindsorIrqTarget[MEDIAIP_MAX_NUM_WINDSORS][MEDIAIP_MAX_NUM_WINDSOR_IRQ_PINS];

  u_int32 uCmdIrqPin[MEDIAIP_MAX_NUM_CMD_IRQ_PINS];
  u_int32 uCmdIrqTarget[MEDIAIP_MAX_NUM_CMD_IRQ_PINS];

  u_int32 uMsgIrqPin[MEDIAIP_MAX_NUM_MSG_IRQ_PINS];
  u_int32 uMsgIrqTarget[MEDIAIP_MAX_NUM_MSG_IRQ_PINS];

  u_int32 uSysClkFreq;
  u_int32 uNumTimers;
  u_int32 uTimerBaseAddr;
  u_int32 uTimerIrqPin[MEDIAIP_MAX_NUM_TIMER_IRQ_PINS];
  u_int32 uTimerIrqTarget[MEDIAIP_MAX_NUM_TIMER_IRQ_PINS];
  u_int32 uTimerSlots[MEDIAIP_MAX_NUM_TIMER_IRQ_SLOTS];

  u_int32 uGICBaseAddr;
  u_int32 uUartBaseAddr;

  u_int32 uDPVBaseAddr;
  u_int32 uDPVIrqPin;
  u_int32 uDPVIrqTarget;

  u_int32 uPixIfBaseAddr;

  u_int32 pal_trace_level;
  u_int32 pal_trace_destination;

  u_int32 pal_trace_level1;
  u_int32 pal_trace_destination1;

  u_int32 uHeapBase;
  u_int32 uHeapSize;

  u_int32 uFSLCacheBaseAddr;

} MEDIAIP_FW_SYSTEM_CONFIG, *pMEDIAIP_FW_SYSTEM_CONFIG;


///////////////////////////////////////////
// Encoder types to be globally used across
// all encode / transcode apps and components

///////////////////////////////////////////
// MEDIAIP_ENC_FMT

typedef  enum
{
  MEDIAIP_ENC_FMT_H264 = 0,
  MEDIAIP_ENC_FMT_VC1,
  MEDIAIP_ENC_FMT_MPEG2,
  MEDIAIP_ENC_FMT_MPEG4SP,
  MEDIAIP_ENC_FMT_H263,
  MEDIAIP_ENC_FMT_MPEG1,
  MEDIAIP_ENC_FMT_SHORT_HEADER,
  MEDIAIP_ENC_FMT_NULL

} MEDIAIP_ENC_FMT;

///////////////////////////////////////////
// MEDIAIP_ENC_PROFILE

typedef enum
{
  MEDIAIP_ENC_PROF_MPEG2_SP = 0,
  MEDIAIP_ENC_PROF_MPEG2_MP,
  MEDIAIP_ENC_PROF_MPEG2_HP,
  MEDIAIP_ENC_PROF_H264_BP,
  MEDIAIP_ENC_PROF_H264_MP,
  MEDIAIP_ENC_PROF_H264_HP,
  MEDIAIP_ENC_PROF_MPEG4_SP,
  MEDIAIP_ENC_PROF_MPEG4_ASP,
  MEDIAIP_ENC_PROF_VC1_SP,
  MEDIAIP_ENC_PROF_VC1_MP,
  MEDIAIP_ENC_PROF_VC1_AP

} MEDIAIP_ENC_PROFILE;

///////////////////////////////////////////
// MEDIAIP_ENC_CONFIG_CODEC_PARAMETER

typedef struct
{
  MEDIAIP_ENC_FMT      eCodecMode;
  MEDIAIP_ENC_PROFILE  eProfile;
  u_int32              uReserved[2];

} MEDIAIP_ENC_CONFIG_CODEC_PARAMETER, *pMEDIAIP_ENC_CONFIG_CODEC_PARAMETER;  //8 words

///////////////////////////////////////////
// MEDIAIP_ENC_PIXEL_FORMAT

typedef enum
{
  MEDIAIP_ENC_PLANAR = 0,
  MEDIAIP_ENC_SEMIPLANAR

} MEDIAIP_ENC_PIXEL_FORMAT;

///////////////////////////////////////////
// MEDIAIP_ENC_CHROMA_FMT

typedef  enum
{
  MODE_420=0,
  MODE_422,
  MODE_444

} MEDIAIP_ENC_CHROMA_FMT;

///////////////////////////////////////////
// MEDIAIP_ENC_FRAME_STRUCT

typedef struct
{
  u_int32  uSrcFieldModeForDsa;
  u_int32  uDstFieldModeForEnc;
  u_int32  uReserved[2];

} MEDIAIP_ENC_FRAME_STRUCT, *pMEDIAIP_ENC_FRAME_STRUCT;

///////////////////////////////////////////
// MEDIAIP_ENC_FRAME_DIMENSIONS

typedef struct
{
  /* Input picture features */
  u_int32    uSrcWidth;
  u_int32    uSrcHeight;
  u_int32    uYStride;
  u_int32    uUVStride;

  /* Clipping information   */
  u_int32    uClipFlag;     /*Note: 0: don't clip, 1: clip.   encode only a part of input frame      */
  u_int32    uOffset_x;
  u_int32    uOffset_y;
  u_int32    uClipPicWidth;
  u_int32    uClipPicHeight;

  /* Output picture features */
  u_int32    uDstWidth;
  u_int32    uDstHeight;
  u_int32    uTileMode;     /* 0: scan raster mode  1: tile mode.                                     */
  u_int32    uTileWidth;    /* Note: In tile mode, uYStride should be calculated depend on uTileWidth */
  u_int32    uTileHeight;

} MEDIAIP_ENC_FRAME_DIMENSIONS, *pMEDIAIP_ENC_FRAME_DIMENSIONS;

///////////////////////////////////////////
// MEDIAIP_ENC_BITRATE_MODE

typedef enum
{
  MEDIAIP_ENC_BITRATECONTROLMODE_VBR          = 0x00000001,
  MEDIAIP_ENC_BITRATECONTROLMODE_CBR          = 0x00000002,
  MEDIAIP_ENC_BITRATECONTROLMODE_CONSTANT_QP  = 0x00000004   /* Only in debug mode */

} MEDIAIP_ENC_BITRATE_MODE, *pMEDIAIP_ENC_BITRATE_MODE;

///////////////////////////////////////////
// MEDIAIP_ENC_BITRATE_CONTROL

typedef struct
{
  MEDIAIP_ENC_BITRATE_MODE  eBitRateMode;
  u_int32                   uTargetBitrate;
  u_int32                   uMaxBitRate;
  u_int32                   uMinBitRate;      /* Requested by Windsor, for soft encoder, it is useless */
  u_int32                   uSliceQP;

} MEDIAIP_ENC_BITRATE_CONTROL, *pMEDIAIP_ENC_BITRATE_CONTROL;

///////////////////////////////////////////
// MEDIAIP_ENC_GOP_STRUCTURE

typedef struct
{
  u_int32 uFrameRateNum;
  u_int32 uFrameRateDen;
  u_int32 uIFrameInterval;
  u_int32 uGopBLength;       /* How many B frames between I or P frames,  max is 4 for Windsor */
  u_int32 uLowLatencyMode;   /* Switch off scene change mode, no B frame, only in VBR Mode     */
  /* TODO-KMC */
  /* Remove the crap below */
  u_int32 reserved[3];

} MEDIAIP_ENC_GOP_STRUCTURE, *pMEDIAIP_ENC_GOP_STRUCTURE;

///////////////////////////////////////////
// MEDIAIP_ENC_STREAM_PARAMETER

typedef struct
{
  MEDIAIP_ENC_CHROMA_FMT        eVideoFormat;
  MEDIAIP_ENC_PIXEL_FORMAT      ePixelFormat;

  MEDIAIP_ENC_GOP_STRUCTURE     mGOPStructure;
  MEDIAIP_ENC_FRAME_STRUCT      mFrameStructure;
  MEDIAIP_ENC_FRAME_DIMENSIONS  mFrameSize;
  MEDIAIP_ENC_BITRATE_CONTROL   mBitRateControl;
  u_int32                       uExpertModeEnable;    /* Enable expert mode            */
  u_int32                       uMemChunkAddr;        /* Start address of memory chunk */
  u_int32                       uMemChunkSize;        /* Size of memory chunk          */
  u_int32                       uStreamFinish;
  /* TODO-KMC */
  /* Remove the crap below */
  u_int32                       reserved[64 - 40];

} MEDIAIP_ENC_STREAM_PARAMETER, *pMEDIAIP_ENC_STREAM_PARAMETER;


///////////////////////////////////////////
// MEDIAIP_ENC_YUV_BUFFER_DESC

typedef struct
{
  u_int32   uFrameID;
  u_int32   uLumaBase;
  u_int32   uChromaBase;
  u_int32   uParamIdx;

} MEDIAIP_ENC_YUV_BUFFER_DESC, *pMEDIAIP_ENC_YUV_BUFFER_DESC;

///////////////////////////////////////////
// eMEDIAIP_ENC_PIC_TYPE

typedef  enum
{
  MEDIAIP_ENC_PIC_TYPE_B_FRAME = 0,
  MEDIAIP_ENC_PIC_TYPE_P_FRAME,
  MEDIAIP_ENC_PIC_TYPE_I_FRAME,
  MEDIAIP_ENC_PIC_TYPE_IDR_FRAME,
  MEDIAIP_ENC_PIC_TYPE_BI_FRAME

} MEDIAIP_ENC_PIC_TYPE, *pMEDIAIP_ENC_PIC_TYPE;

///////////////////////////////////////////
// MEDIAIP_ENC_PIC_TYPE

typedef struct
{
  u_int32              uFrameID;
  u_int32              uPicEncodDone;
  MEDIAIP_ENC_PIC_TYPE ePicType;
  u_int32              uSkippedFrame;
  u_int32              uErrorFlag;
  u_int32              uPSNR;
  u_int32              uFlushDone;
  u_int32              uMBy;
  u_int32              uMBx;
  u_int32              uFrameSize;
  u_int32              uFrameEncTtlFrmCycles;
  u_int32              uFrameEncTtlSlcCycles;
  u_int32              uFrameEncTtlEncCycles;
  u_int32              uFrameEncTtlHmeCycles;
  u_int32              uFrameEncTtlDsaCycles;
  u_int32              uFrameEncFwCycles;
  u_int32              uFrameCrc;
  u_int32              uNumInterrupts_1;
  u_int32              uNumInterrupts_2;
  u_int32              uH264POC;
  u_int32              uRefInfo;
  u_int32              uPicNum;
  u_int32              uPicActivity;
  u_int32              uSceneChange;
  u_int32              uMBStats;
  u_int32              uEncCacheCount0;
  u_int32              uEncCacheCount1;
  u_int32              uMtlWrStrbCnt;
  u_int32              uMtlRdStrbCnt;
  u_int32              uStrBuffWrPtr;
  u_int32              uDiagnosticEvents;
  u_int32              uProcIaccTotRdCnt;
  u_int32              uProcDaccTotRdCnt;
  u_int32              uProcDaccTotWrCnt;
  u_int32              uProcDaccRegRdCnt;
  u_int32              uProcDaccRegWrCnt;
  u_int32              uProcDaccRngRdCnt;
  u_int32              uProcDaccRngWrCnt;

} MEDIAIP_ENC_PIC_INFO, *pMEDIAIP_ENC_PIC_INFO;

///////////////////////////////////////////
// MEDIAIP_ENC_DSA_INFO

typedef struct
{
  u_int32  uHeight;
  u_int32  uWidth;
  u_int32  uCropWidth;
  u_int32  uCropHeight;
  u_int32  uCropPixelXOffset;
  u_int8 * pImgBuffer;
  u_int32  uStride;
  u_int32  uOffset2Chroma;
  u_int32  uOffset2Decimate;

} MEDIAIP_ENC_DSA_INFO, *pMEDIAIP_ENC_DSA_INFO;

///////////////////////////////////////////
// MEDIAIP_ENC_PIC_PARAM_UPD

typedef struct
{
  /* Each bit indicate corresponding parameter should be updated */
  u_int32    uMaskflag;

  /* ENC_GOP_STRUCTURE variables            */
  u_int32    uFrameRateNum;
  u_int32    uFrameRateDen;

  /* MEDIAIP_ENC_FRAME_STRUCT variables     */
  u_int32    uSrcFieldModeForDsa;
  u_int32    uDstFieldModeForEnc;

  /* MEDIAIP_ENC_FRAME_DIMENSIONS variables */
  u_int32    uSrcWidth;
  u_int32    uSrcHeight;
  u_int32    uYStride;
  u_int32    uUVStride;
  u_int32    uOffset_x;
  u_int32    uOffset_y;
  u_int32    uClipPicWidth;
  u_int32    uClipPicHeight;
  u_int32    uDstWidth;
  u_int32    uDstHeight;
  u_int32    uIFrameInterval;
  u_int32    uGopBLength;
  u_int32    uLowLatencyMode;

  /* MEDIAIP_ENC_BITRATE_CONTROL  variables */
  MEDIAIP_ENC_BITRATE_MODE  eBitRateMode;
  u_int32                   uTargetBitrate;
  u_int32                   uMaxBitRate;
  u_int32                   uMinBitRate;
  u_int32                   uSliceQP;
  u_int32                   uReserved[32-23];

} MEDIAIP_ENC_PIC_PARAM_UPD, *pMEDIAIP_ENC_PIC_PARAM_UPD;


///////////////////////////////////////////
// MEDIAIP_ENC_CALIB_PARAMS
//
// Encoder Hardware calibration parameters

typedef struct
{
  u_int32 use_ame;

  u_int32 cme_mvx_max;
  u_int32 cme_mvy_max;
  u_int32 ame_prefresh_y0;
  u_int32 ame_prefresh_y1;
  u_int32 fme_min_sad;
  u_int32 cme_min_sad;

  u_int32 fme_pred_int_weight;
  u_int32 fme_pred_hp_weight;
  u_int32 fme_pred_qp_weight;
  u_int32 fme_cost_weight;
  u_int32 fme_act_thold;
  u_int32 fme_sad_thold;
  u_int32 fme_zero_sad_thold;

  u_int32 fme_lrg_mvx_lmt;
  u_int32 fme_lrg_mvy_lmt;
  u_int32 fme_force_mode;
  u_int32 fme_force4mvcost;
  u_int32 fme_force2mvcost;

  u_int32 h264_inter_thrd;

  u_int32 i16x16_mode_cost;
  u_int32 i4x4_mode_lambda;
  u_int32 i8x8_mode_lambda;

  u_int32 inter_mod_mult;
  u_int32 inter_sel_mult;
  u_int32 inter_bid_cost;
  u_int32 inter_bwd_cost;
  u_int32 inter_4mv_cost;
  int32   one_mv_i16_cost;
  int32   one_mv_i4x4_cost;
  int32   one_mv_i8x8_cost;
  int32   two_mv_i16_cost;
  int32   two_mv_i4x4_cost;
  int32   two_mv_i8x8_cost;
  int32   four_mv_i16_cost;
  int32   four_mv_i4x4_cost;
  int32   four_mv_i8x8_cost;

  u_int32 intra_pred_enab;
  u_int32 intra_chr_pred;
  u_int32 intra16_pred;
  u_int32 intra4x4_pred;
  u_int32 intra8x8_pred;

  u_int32 cb_base;
  u_int32 cb_size;
  u_int32 cb_head_room;

  u_int32 mem_page_width;
  u_int32 mem_page_height;
  u_int32 mem_total_size;
  u_int32 mem_chunk_addr;
  u_int32 mem_chunk_size;
  u_int32 mem_y_stride;
  u_int32 mem_uv_stride;

  u_int32 split_wr_enab;
  u_int32 split_wr_req_size;
  u_int32 split_rd_enab;
  u_int32 split_rd_req_size;

} MEDIAIP_ENC_CALIB_PARAMS, *pMEDIAIP_ENC_CALIB_PARAMS;

///////////////////////////////////////////
// MEDIAIP_ENC_CONFIG_PARAMS
//
// Stream-specific configuration parameters

typedef struct
{
  u_int32 ParamChange;

  u_int32 start_frame;                // These variables are for debugging purposes only
  u_int32 end_frame;

  u_int32 userdata_enable;
  u_int32 userdata_id[4];
  u_int32 userdata_message[MEDIAIP_ENC_USER_DATA_WORDS];
  u_int32 userdata_length;

  u_int32 h264_profile_idc;
  u_int32 h264_level_idc;
  u_int32 h264_au_delimiter;          // Enable the use of Access Unit Delimiters
  u_int32 h264_seq_end_code;          // Enable the use of Sequence End Codes
  u_int32 h264_recovery_points;       // Enable the use of Recovery Points (must be with a fixed GOP structure)
  u_int32 h264_vui_parameters;        // Enable the use of VUI parameters (for rate control purposes)
  u_int32 h264_aspect_ratio_present;
  u_int32 h264_aspect_ratio_sar_width;
  u_int32 h264_aspect_ratio_sar_height;
  u_int32 h264_overscan_present;
  u_int32 h264_video_type_present;
  u_int32 h264_video_format;
  u_int32 h264_video_full_range;
  u_int32 h264_video_colour_descriptor;
  u_int32 h264_video_colour_primaries;
  u_int32 h264_video_transfer_char;
  u_int32 h264_video_matrix_coeff;
  u_int32 h264_chroma_loc_info_present;
  u_int32 h264_chroma_loc_type_top;
  u_int32 h264_chroma_loc_type_bot;
  u_int32 h264_timing_info_present;
  u_int32 h264_buffering_period_present;
  u_int32 h264_low_delay_hrd_flag;

  u_int32 aspect_ratio;
  u_int32 test_mode;                  // Automated firmware test mode
  u_int32 dsa_test_mode;              // Automated test mode for the DSA.
  u_int32 fme_test_mode;              // Automated test mode for the fme

  u_int32 cbr_row_mode;               //0: FW mode; 1: HW mode
  u_int32 windsor_mode;               //0: normal mode; 1: intra only mode; 2: intra+0MV mode
  u_int32 encode_mode;                // H264, VC1, MPEG2, DIVX
  u_int32 frame_width;                // display width
  u_int32 frame_height;               // display height
  u_int32 enc_frame_width;            // encoding width, should be 16-pix align
  u_int32 enc_frame_height;           // encoding height, should be 16-pix aligned for progressive and 32-pix aligned for interlace
  u_int32 frame_rate_num;
  u_int32 frame_rate_den;

  u_int32 vi_field_source;              // vi input source is frame or field
  u_int32 vi_frame_width;
  u_int32 vi_frame_height;
  u_int32 crop_frame_width;
  u_int32 crop_frame_height;
  u_int32 crop_x_start_posn;
  u_int32 crop_y_start_posn;
  u_int32 mode422;
  u_int32 mode_yuy2;
  u_int32 dsa_luma_en;
  u_int32 dsa_chroma_en;
  u_int32 dsa_ext_hfilt_en;
  u_int32 dsa_di_en;
  u_int32 dsa_di_top_ref;
  u_int32 dsa_vertf_disable;   // disable the vertical filter.
  u_int32 dsa_disable_pwb;
  u_int32 dsa_hor_phase;
  u_int32 dsa_ver_phase;

  u_int32 dsa_iac_enable;      // IAC / DSA cannot operate independently in FW so this variable controls
  u_int32 iac_sc_threshold;
  u_int32 iac_vm_threshold;
  u_int32 iac_skip_mode;
  u_int32 iac_grp_width;
  u_int32 iac_grp_height;

  u_int32 rate_control_mode;
  u_int32 rate_control_resolution;
  u_int32 buffer_size;
  u_int32 buffer_level_init;
  u_int32 buffer_I_bit_budget;

  u_int32 top_field_first;

  u_int32 intra_lum_qoffset;
  u_int32 intra_chr_qoffset;
  u_int32 inter_lum_qoffset;
  u_int32 inter_chr_qoffset;
  u_int32 use_def_scaling_mtx;

  u_int32 inter_8x8_enab;
  u_int32 inter_4x4_enab;

  u_int32 fme_enable_qpel;
  u_int32 fme_enable_hpel;
  u_int32 fme_nozeromv;               // can force the FME not to do the (0,0) search.
  u_int32 fme_predmv_en;
  u_int32 fme_pred_2mv4mv;
  u_int32 fme_smallsadthresh;

  u_int32 ame_en_lmvc;
  u_int32 ame_x_mult;
  u_int32 cme_enable_4mv;             // Enable the use of 4MV partitioning
  u_int32 cme_enable_1mv;
  u_int32 hme_enable_16x8mv;
  u_int32 hme_enable_8x16mv;
  u_int32 cme_mv_weight;              // CME motion vector decisions are made by combining these
  u_int32 cme_mv_cost;                // cost and weight variables
  u_int32 ame_mult_mv;
  u_int32 ame_shift_mv;

  u_int32 hme_forceto1mv_en;
  u_int32 hme_2mv_cost;               // the cost of choosing a 2MV mode over 1MV.
  u_int32 hme_pred_mode;
  u_int32 hme_sc_rnge;
  u_int32 hme_sw_rnge;

  // for windsor pes , add by fulin
  u_int32 output_format;     // 0: output ES; 1: output PES
  u_int32 timestamp_enab;    // 0: have timestamps in all frame; 1: have timestamps in I and P frame; 2: have timestamps only in I frame
  u_int32 initial_PTS_enab;  // if enabled , use following value,else compute by fw
  u_int32 initial_PTS;       // the initial value of PTS in the first frame (ms)

} MEDIAIP_ENC_CONFIG_PARAMS, *pMEDIAIP_ENC_CONFIG_PARAMS;


///////////////////////////////////////////
// MEDIAIP_ENC_STATIC_PARAMS
//
// Static parameters ( may change at the GOP level )

typedef struct
{
  u_int32 ParamChange;

  u_int32 gop_length;

  u_int32 rate_control_bitrate;
  u_int32 rate_control_bitrate_min;
  u_int32 rate_control_bitrate_max;
  u_int32 rate_control_content_models;
  u_int32 rate_control_iframe_maxsize; // Maximum size of I frame generated by BPM in comparison to ideal (/4)
  u_int32 rate_control_qp_init;
  u_int32 rate_control_islice_qp;
  u_int32 rate_control_pslice_qp;
  u_int32 rate_control_bslice_qp;

  u_int32 adaptive_quantization;      // Enable the use of activity measures from VIPP in QP assignment
  u_int32 aq_variance;
  u_int32 cost_optimization;          // Enable picture/frame level adjustments of the cost parameters by FW.
  u_int32 fdlp_mode;                  // Frequency-domain low-pass filter control, 0: off, 1-4: specific, 5: adaptive
  u_int32 enable_isegbframes;         // Enable the use of B frames in the first segment of a GOP
  u_int32 enable_adaptive_keyratio;   // Enable the use of an adaptive I to P/B ratio (aims to reduce distortion)
  u_int32 keyratio_imin;              // Clamps applied to picture size ratios
  u_int32 keyratio_imax;
  u_int32 keyratio_pmin;
  u_int32 keyratio_pmax;
  u_int32 keyratio_bmin;
  u_int32 keyratio_bmax;
  int32   keyratio_istep;
  int32   keyratio_pstep;
  int32   keyratio_bstep;

  u_int32 enable_paff;                // Enable Picture Adaptive Frame/Field
  u_int32 enable_b_frame_ref;         // Enable B frame as references
  u_int32 enable_adaptive_gop;        // Enable an adaptive GOP structure
  u_int32 enable_closed_gop;          // Enable a closed GOP structure
                                      // i.e. if enabled, the first consecutive B frames following
                                      // an I frame in each GOP will be intra or backwards only coded
                                      // and do not rely on previous reference pictures.
  u_int32 open_gop_refresh_freq;      // Controls the insertion of closed GOP's (or IDR GOP's in H.264)
  u_int32 enable_adaptive_sc;         // Enable adaptive scene change GOP structure (0:off, 1:adaptive, 2:IDR)
  u_int32 enable_fade_detection;      // Enable fade detection and associated motion estimation restrictions
  int32   fade_detection_threshold;   // Threshold at which the activity slope indicates a possible fading event
  u_int32 enable_repeat_b;            // Enalbe the repeated B frame mode at CBR

} MEDIAIP_ENC_STATIC_PARAMS, *pMEDIAIP_ENC_STATIC_PARAMS;

///////////////////////////////////////////
// MEDIAIP_ENC_DYN_PARAMS
//
// Dynamic parameters (may change at the frame level)

typedef struct
{
  u_int32 ParamChange;

  u_int32 rows_per_slice;

  u_int32 mbaff_enable;                // Macroblock adaptive frame/field enable
  u_int32 dbf_enable;                  // Enable the deblocking filter

  u_int32 field_source;                // progressive/interlaced control
  u_int32 gop_b_length;                // Number of B frames between anchor frames
                                      //  (only to be changed at a GOP segment boundary)
  u_int32 mb_group_size;               // Number of macroblocks normally assigned to a group
                                      // (implications for performance, interrupts and rate control)

  u_int32 cbr_rows_per_group;

  u_int32 skip_enable;                 // Enable the use of skipped macroblocks

  u_int32 pts_bits_0_to_31;            // TO BE REMOVED...
  u_int32 pts_bit_32;

  u_int32 rm_expsv_cff;
  u_int32 const_ipred;
  int32 chr_qp_offset;
  u_int32 intra_mb_qp_offset;

  u_int32 h264_cabac_init_method;
  u_int32 h264_cabac_init_idc;
  u_int32 h264_cabac_enable;                 // Main and stream

  int32 alpha_c0_offset_div2;
  int32 beta_offset_div2;

  u_int32 intra_prefresh_y0; // for setting intra limits for prog refresh.
  u_int32 intra_prefresh_y1;

  u_int32 dbg_dump_rec_src;

} MEDIAIP_ENC_DYN_PARAMS, *pMEDIAIP_ENC_DYN_PARAMS;

///////////////////////////////////////////
// MEDIAIP_ENC_EXPERT_MODE_PARAM

typedef struct
{
  MEDIAIP_ENC_CALIB_PARAMS   Calib;
  MEDIAIP_ENC_CONFIG_PARAMS  Config;
  MEDIAIP_ENC_STATIC_PARAMS  Static;
  MEDIAIP_ENC_DYN_PARAMS     Dynamic;
} MEDIAIP_ENC_EXPERT_MODE_PARAM, *pMEDIAIP_ENC_EXPERT_MODE_PARAM;

///////////////////////////////////////////
// MEDIAIP_ENC_PARAM

typedef struct
{
  MEDIAIP_ENC_FMT           eCodecMode;
  MEDIAIP_ENC_PROFILE       eProfile;

  u_int32                   uMemChunkAddr;
  u_int32                   uMemChunkSize;

  u_int32                   uFrameRate;
  u_int32                   uSrcStride;
  u_int32                   uSrcWidth;
  u_int32                   uSrcHeight;
  u_int32                   uSrcOffset_x;
  u_int32                   uSrcOffset_y;
  u_int32                   uSrcCropWidth;
  u_int32                   uSrcCropHeight;
  u_int32                   uOutWidth;
  u_int32                   uOutHeight;
  u_int32                   uIFrameInterval;
  u_int32                   uGopBLength;
  u_int32                   uLowLatencyMode;

  MEDIAIP_ENC_BITRATE_MODE  eBitRateMode;
  u_int32                   uTargetBitrate;
  u_int32                   uMaxBitRate;
  u_int32                   uMinBitRate;
  u_int32                   uInitSliceQP;

} MEDIAIP_ENC_PARAM, *pMEDIAIP_ENC_PARAM;

#endif /* _MEDIAIP_FW_TYPES_H_ */

/* End of File */