summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/on2/h264dec/omxdl/arm_neon/vc/api/omxVC.h
blob: 7b3cc7289554a10744eacffc0d0af5ef39d61e8c (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
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
/**
 * File: omxVC.h
 * Brief: OpenMAX DL v1.0.2 - Video Coding library
 *
 * Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved. 
 *
 * These materials are protected by copyright laws and contain material 
 * proprietary to the Khronos Group, Inc.  You may use these materials 
 * for implementing Khronos specifications, without altering or removing 
 * any trademark, copyright or other notice from the specification.
 * 
 * Khronos Group makes no, and expressly disclaims any, representations 
 * or warranties, express or implied, regarding these materials, including, 
 * without limitation, any implied warranties of merchantability or fitness 
 * for a particular purpose or non-infringement of any intellectual property. 
 * Khronos Group makes no, and expressly disclaims any, warranties, express 
 * or implied, regarding the correctness, accuracy, completeness, timeliness, 
 * and reliability of these materials. 
 *
 * Under no circumstances will the Khronos Group, or any of its Promoters, 
 * Contributors or Members or their respective partners, officers, directors, 
 * employees, agents or representatives be liable for any damages, whether 
 * direct, indirect, special or consequential damages for lost revenues, 
 * lost profits, or otherwise, arising from or in connection with these 
 * materials.
 * 
 * Khronos and OpenMAX are trademarks of the Khronos Group Inc. 
 *
 */

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

#ifndef _OMXVC_H_
#define _OMXVC_H_

#include "omxtypes.h"

#ifdef __cplusplus
extern "C" {
#endif


/* 6.1.1.1 Motion Vectors  */
/* In omxVC, motion vectors are represented as follows:  */

typedef struct {
    OMX_S16 dx;
    OMX_S16 dy;
} OMXVCMotionVector;



/**
 * Function:  omxVCCOMM_Average_8x   (6.1.3.1.1)
 *
 * Description:
 * This function calculates the average of two 8x4, 8x8, or 8x16 blocks.  The 
 * result is rounded according to (a+b+1)/2.  The block average function can 
 * be used in conjunction with half-pixel interpolation to obtain quarter 
 * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1. 
 *
 * Input Arguments:
 *   
 *   pPred0     - Pointer to the top-left corner of reference block 0 
 *   pPred1     - Pointer to the top-left corner of reference block 1 
 *   iPredStep0 - Step of reference block 0 
 *   iPredStep1 - Step of reference block 1 
 *   iDstStep   - Step of the destination buffer. 
 *   iHeight    - Height of the blocks 
 *
 * Output Arguments:
 *   
 *   pDstPred - Pointer to the destination buffer. 8-byte aligned. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -   one or more of the following pointers is NULL: pPred0, pPred1, or 
 *              pDstPred. 
 *    -   pDstPred is not aligned on an 8-byte boundary. 
 *    -   iPredStep0 <= 0 or iPredStep0 is not a multiple of 8. 
 *    -   iPredStep1 <= 0 or iPredStep1 is not a multiple of 8. 
 *    -   iDstStep   <= 0 or iDstStep is not a multiple of 8. 
 *    -   iHeight is not 4, 8, or 16. 
 *
 */
OMXResult omxVCCOMM_Average_8x (
    const OMX_U8 *pPred0,
    const OMX_U8 *pPred1,
    OMX_U32 iPredStep0,
    OMX_U32 iPredStep1,
    OMX_U8 *pDstPred,
    OMX_U32 iDstStep,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCCOMM_Average_16x   (6.1.3.1.2)
 *
 * Description:
 * This function calculates the average of two 16x16 or 16x8 blocks.  The 
 * result is rounded according to (a+b+1)/2.  The block average function can 
 * be used in conjunction with half-pixel interpolation to obtain quarter 
 * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1. 
 *
 * Input Arguments:
 *   
 *   pPred0 - Pointer to the top-left corner of reference block 0 
 *   pPred1 - Pointer to the top-left corner of reference block 1 
 *   iPredStep0 - Step of reference block 0 
 *   iPredStep1 - Step of reference block 1 
 *   iDstStep - Step of the destination buffer 
 *   iHeight - Height of the blocks 
 *
 * Output Arguments:
 *   
 *   pDstPred - Pointer to the destination buffer. 16-byte aligned. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -   one or more of the following pointers is NULL: pPred0, pPred1, or 
 *              pDstPred. 
 *    -   pDstPred is not aligned on a 16-byte boundary. 
 *    -   iPredStep0 <= 0 or iPredStep0 is not a multiple of 16. 
 *    -   iPredStep1 <= 0 or iPredStep1 is not a multiple of 16. 
 *    -   iDstStep <= 0 or iDstStep is not a multiple of 16. 
 *    -   iHeight is not 8 or 16. 
 *
 */
OMXResult omxVCCOMM_Average_16x (
    const OMX_U8 *pPred0,
    const OMX_U8 *pPred1,
    OMX_U32 iPredStep0,
    OMX_U32 iPredStep1,
    OMX_U8 *pDstPred,
    OMX_U32 iDstStep,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCCOMM_ExpandFrame_I   (6.1.3.2.1)
 *
 * Description:
 * This function expands a reconstructed frame in-place.  The unexpanded 
 * source frame should be stored in a plane buffer with sufficient space 
 * pre-allocated for edge expansion, and the input frame should be located in 
 * the plane buffer center.  This function executes the pixel expansion by 
 * replicating source frame edge pixel intensities in the empty pixel 
 * locations (expansion region) between the source frame edge and the plane 
 * buffer edge.  The width/height of the expansion regions on the 
 * horizontal/vertical edges is controlled by the parameter iExpandPels. 
 *
 * Input Arguments:
 *   
 *   pSrcDstPlane - pointer to the top-left corner of the frame to be 
 *            expanded; must be aligned on an 8-byte boundary. 
 *   iFrameWidth - frame width; must be a multiple of 8. 
 *   iFrameHeight -frame height; must be a multiple of 8. 
 *   iExpandPels - number of pixels to be expanded in the horizontal and 
 *            vertical directions; must be a multiple of 8. 
 *   iPlaneStep - distance, in bytes, between the start of consecutive lines 
 *            in the plane buffer; must be larger than or equal to 
 *            (iFrameWidth + 2 * iExpandPels). 
 *
 * Output Arguments:
 *   
 *   pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the 
 *            top-left corner of the plane); must be aligned on an 8-byte 
 *            boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -    pSrcDstPlane is NULL. 
 *    -    pSrcDstPlane is not aligned on an 8-byte boundary. 
 *    -    one of the following parameters is either equal to zero or is a 
 *              non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or 
 *              iExpandPels. 
 *    -    iPlaneStep < (iFrameWidth + 2 * iExpandPels). 
 *
 */
OMXResult omxVCCOMM_ExpandFrame_I (
    OMX_U8 *pSrcDstPlane,
    OMX_U32 iFrameWidth,
    OMX_U32 iFrameHeight,
    OMX_U32 iExpandPels,
    OMX_U32 iPlaneStep
);



/**
 * Function:  omxVCCOMM_Copy8x8   (6.1.3.3.1)
 *
 * Description:
 * Copies the reference 8x8 block to the current block. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the reference block in the source frame; must be 
 *            aligned on an 8-byte boundary. 
 *   step - distance between the starts of consecutive lines in the reference 
 *            frame, in bytes; must be a multiple of 8 and must be larger than 
 *            or equal to 8. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the destination block; must be aligned on an 8-byte 
 *            boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -   one or more of the following pointers is NULL: pSrc, pDst 
 *    -   one or more of the following pointers is not aligned on an 8-byte 
 *              boundary: pSrc, pDst 
 *    -    step <8 or step is not a multiple of 8. 
 *
 */
OMXResult omxVCCOMM_Copy8x8 (
    const OMX_U8 *pSrc,
    OMX_U8 *pDst,
    OMX_INT step
);



/**
 * Function:  omxVCCOMM_Copy16x16   (6.1.3.3.2)
 *
 * Description:
 * Copies the reference 16x16 macroblock to the current macroblock. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the reference macroblock in the source frame; must be 
 *            aligned on a 16-byte boundary. 
 *   step - distance between the starts of consecutive lines in the reference 
 *            frame, in bytes; must be a multiple of 16 and must be larger 
 *            than or equal to 16. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the destination macroblock; must be aligned on a 
 *            16-byte boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -   one or more of the following pointers is NULL: pSrc, pDst 
 *    -   one or more of the following pointers is not aligned on a 16-byte 
 *              boundary: pSrc, pDst 
 *    -    step <16 or step is not a multiple of 16. 
 *
 */
OMXResult omxVCCOMM_Copy16x16 (
    const OMX_U8 *pSrc,
    OMX_U8 *pDst,
    OMX_INT step
);



/**
 * Function:  omxVCCOMM_ComputeTextureErrorBlock_SAD   (6.1.4.1.1)
 *
 * Description:
 * Computes texture error of the block; also returns SAD. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the source plane; must be aligned on an 8-byte 
 *            boundary. 
 *   srcStep - step of the source plane 
 *   pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned 
 *            on an 8-byte boundary. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the destination buffer, an 8x8 block; must be aligned 
 *            on an 8-byte boundary. 
 *   pDstSAD - pointer to the Sum of Absolute Differences (SAD) value 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments 
 *    -    At least one of the following 
 *         pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD. 
 *    -    pSrc is not 8-byte aligned. 
 *    -    SrcStep <= 0 or srcStep is not a multiple of 8. 
 *    -    pSrcRef is not 8-byte aligned. 
 *    -    pDst is not 8-byte aligned. 
 *
 */
OMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD (
    const OMX_U8 *pSrc,
    OMX_INT srcStep,
    const OMX_U8 *pSrcRef,
    OMX_S16 *pDst,
    OMX_INT *pDstSAD
);



/**
 * Function:  omxVCCOMM_ComputeTextureErrorBlock   (6.1.4.1.2)
 *
 * Description:
 * Computes the texture error of the block. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the source plane. This should be aligned on an 8-byte 
 *            boundary. 
 *   srcStep - step of the source plane 
 *   pSrcRef - pointer to the reference buffer, an 8x8 block. This should be 
 *            aligned on an 8-byte boundary. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the destination buffer, an 8x8 block. This should be 
 *            aligned on an 8-byte boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    At least one of the following pointers is NULL: 
 *         pSrc, pSrcRef, pDst. 
 *    -    pSrc is not 8-byte aligned. 
 *    -    SrcStep <= 0 or srcStep is not a multiple of 8. 
 *    -    pSrcRef is not 8-byte aligned. 
 *    -    pDst is not 8-byte aligned 
 *
 */
OMXResult omxVCCOMM_ComputeTextureErrorBlock (
    const OMX_U8 *pSrc,
    OMX_INT srcStep,
    const OMX_U8 *pSrcRef,
    OMX_S16 *pDst
);



/**
 * Function:  omxVCCOMM_LimitMVToRect   (6.1.4.1.3)
 *
 * Description:
 * Limits the motion vector associated with the current block/macroblock to 
 * prevent the motion compensated block/macroblock from moving outside a 
 * bounding rectangle as shown in Figure 6-1. 
 *
 * Input Arguments:
 *   
 *   pSrcMV - pointer to the motion vector associated with the current block 
 *            or macroblock 
 *   pRectVOPRef - pointer to the bounding rectangle 
 *   Xcoord, Ycoord  - coordinates of the current block or macroblock 
 *   size - size of the current block or macroblock; must be equal to 8 or 
 *            16. 
 *
 * Output Arguments:
 *   
 *   pDstMV - pointer to the limited motion vector 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the 
 *              following conditions is true: 
 *    -    at least one of the following pointers is NULL: 
 *         pSrcMV, pDstMV, or pRectVOPRef. 
 *    -    size is not equal to either 8 or 16. 
 *    -    the width or height of the bounding rectangle is less than 
 *         twice the block size.
 */
OMXResult omxVCCOMM_LimitMVToRect (
    const OMXVCMotionVector *pSrcMV,
    OMXVCMotionVector *pDstMV,
    const OMXRect *pRectVOPRef,
    OMX_INT Xcoord,
    OMX_INT Ycoord,
    OMX_INT size
);



/**
 * Function:  omxVCCOMM_SAD_16x   (6.1.4.1.4)
 *
 * Description:
 * This function calculates the SAD for 16x16 and 16x8 blocks. 
 *
 * Input Arguments:
 *   
 *   pSrcOrg - Pointer to the original block; must be aligned on a 16-byte 
 *             boundary. 
 *   iStepOrg - Step of the original block buffer 
 *   pSrcRef  - Pointer to the reference block 
 *   iStepRef - Step of the reference block buffer 
 *   iHeight  - Height of the block 
 *
 * Output Arguments:
 *   
 *   pDstSAD - Pointer of result SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the 
 *              following conditions is true: 
 *    -    at least one of the following pointers is NULL: 
 *         pSrcOrg, pDstSAD, or pSrcRef 
 *    -    pSrcOrg is not 16-byte aligned. 
 *    -    iStepOrg  <= 0 or iStepOrg is not a multiple of 16 
 *    -    iStepRef <= 0 or iStepRef is not a multiple of 16 
 *    -    iHeight is not 8 or 16 
 *
 */
OMXResult omxVCCOMM_SAD_16x (
    const OMX_U8 *pSrcOrg,
    OMX_U32 iStepOrg,
    const OMX_U8 *pSrcRef,
    OMX_U32 iStepRef,
    OMX_S32 *pDstSAD,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCCOMM_SAD_8x   (6.1.4.1.5)
 *
 * Description:
 * This function calculates the SAD for 8x16, 8x8, 8x4 blocks. 
 *
 * Input Arguments:
 *   
 *   pSrcOrg  - Pointer to the original block; must be aligned on a 8-byte 
 *              boundary. 
 *   iStepOrg - Step of the original block buffer 
 *   pSrcRef  - Pointer to the reference block 
 *   iStepRef - Step of the reference block buffer 
 *   iHeight  - Height of the block 
 *
 * Output Arguments:
 *   
 *   pDstSAD -Pointer of result SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the 
 *              following conditions is true: 
 *    -    at least one of the following pointers is NULL: 
 *         pSrcOrg, pDstSAD, or pSrcRef 
 *    -    pSrcOrg is not 8-byte aligned. 
 *    -    iStepOrg  <= 0 or iStepOrg is not a multiple of 8 
 *    -    iStepRef <= 0 or iStepRef is not a multiple of 8 
 *    -    iHeight is not 4, 8 or 16 
 *
 */
OMXResult omxVCCOMM_SAD_8x (
    const OMX_U8 *pSrcOrg,
    OMX_U32 iStepOrg,
    const OMX_U8 *pSrcRef,
    OMX_U32 iStepRef,
    OMX_S32*pDstSAD,
    OMX_U32 iHeight
);



/* 6.2.1.1 Direction  */
/* The direction enumerator is used with functions that perform AC/DC prediction and zig-zag scan.  */

enum {
    OMX_VC_NONE       = 0,
    OMX_VC_HORIZONTAL = 1,
    OMX_VC_VERTICAL   = 2 
};



/* 6.2.1.2 Bilinear Interpolation  */
/* The bilinear interpolation enumerator is used with motion estimation, motion compensation, and reconstruction functions.  */

enum {
    OMX_VC_INTEGER_PIXEL = 0, /* case a */
    OMX_VC_HALF_PIXEL_X  = 1, /* case b */
    OMX_VC_HALF_PIXEL_Y  = 2, /* case c */
    OMX_VC_HALF_PIXEL_XY = 3  /* case d */ 
};



/* 6.2.1.3 Neighboring Macroblock Availability  */
/* Neighboring macroblock availability is indicated using the following flags:   */

enum {
    OMX_VC_UPPER = 1,        /** above macroblock is available */
    OMX_VC_LEFT = 2,         /** left macroblock is available */
    OMX_VC_CENTER = 4,
    OMX_VC_RIGHT = 8,
    OMX_VC_LOWER = 16,
    OMX_VC_UPPER_LEFT = 32,  /** above-left macroblock is available */
    OMX_VC_UPPER_RIGHT = 64, /** above-right macroblock is available */
    OMX_VC_LOWER_LEFT = 128,
    OMX_VC_LOWER_RIGHT = 256 
};



/* 6.2.1.4 Video Components  */
/* A data type that enumerates video components is defined as follows:  */

typedef enum {
    OMX_VC_LUMINANCE,    /** Luminance component */
    OMX_VC_CHROMINANCE   /** chrominance component */ 
} OMXVCM4P2VideoComponent;



/* 6.2.1.5 MacroblockTypes  */
/* A data type that enumerates macroblock types is defined as follows:  */

typedef enum {
    OMX_VC_INTER     = 0, /** P picture or P-VOP */
    OMX_VC_INTER_Q   = 1, /** P picture or P-VOP */
    OMX_VC_INTER4V   = 2, /** P picture or P-VOP */
    OMX_VC_INTRA     = 3, /** I and P picture, I- and P-VOP */
    OMX_VC_INTRA_Q   = 4, /** I and P picture, I- and P-VOP */
    OMX_VC_INTER4V_Q = 5  /** P picture or P-VOP (H.263)*/
} OMXVCM4P2MacroblockType;



/* 6.2.1.6 Coordinates  */
/* Coordinates are represented as follows:  */

typedef struct {
    OMX_INT x;
    OMX_INT y;
} OMXVCM4P2Coordinate;



/* 6.2.1.7 Motion Estimation Algorithms  */
/* A data type that enumerates motion estimation search methods is defined as follows:  */

typedef enum {
    OMX_VC_M4P2_FAST_SEARCH = 0,  /** Fast motion search */
    OMX_VC_M4P2_FULL_SEARCH = 1   /** Full motion search */ 
} OMXVCM4P2MEMode;



/* 6.2.1.8 Motion Estimation Parameters  */
/* A data structure containing control parameters for 
 * motion estimation functions is defined as follows:  
 */

typedef struct {
    OMX_INT searchEnable8x8;     /** enables 8x8 search */
    OMX_INT halfPelSearchEnable; /** enables half-pel resolution */
    OMX_INT searchRange;         /** search range */
    OMX_INT rndVal;              /** rounding control; 0-disabled, 1-enabled*/
} OMXVCM4P2MEParams;



/* 6.2.1.9 Macroblock Information   */
/* A data structure containing macroblock parameters for 
 * motion estimation functions is defined as follows:  
 */

typedef struct {
    OMX_S32 sliceId;                 /* slice number */
    OMXVCM4P2MacroblockType mbType;  /* MB type: OMX_VC_INTRA, OMX_VC_INTER, or OMX_VC_INTER4 */
    OMX_S32 qp;                      /* quantization parameter*/
    OMX_U32 cbpy;                    /* CBP Luma */
    OMX_U32 cbpc;                    /* CBP Chroma */
    OMXVCMotionVector pMV0[2][2];    /* motion vector, represented using 1/2-pel units, 
                                      * pMV0[blocky][blockx] (blocky = 0~1, blockx =0~1) 
                                      */
    OMXVCMotionVector pMVPred[2][2]; /* motion vector prediction, represented using 1/2-pel units, 
                                      * pMVPred[blocky][blockx] (blocky = 0~1, blockx = 0~1) 
                                      */
    OMX_U8 pPredDir[2][2];           /* AC prediction direction: 
                                      *   OMX_VC_NONE, OMX_VC_VERTICAL, OMX_VC_HORIZONTAL 
                                      */
} OMXVCM4P2MBInfo, *OMXVCM4P2MBInfoPtr;



/**
 * Function:  omxVCM4P2_FindMVpred   (6.2.3.1.1)
 *
 * Description:
 * Predicts a motion vector for the current block using the procedure 
 * specified in [ISO14496-2], subclause 7.6.5.  The resulting predicted MV is 
 * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then 
 * the set of three MV candidates used for prediction is also returned, 
 * otherwise pDstMVPredMEis NULL upon return. 
 *
 * Input Arguments:
 *   
 *   pSrcMVCurMB - pointer to the MV buffer associated with the current Y 
 *            macroblock; a value of NULL indicates unavailability. 
 *   pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated 
 *            with the MB located to the left of the current MB; set to NULL 
 *            if there is no MB to the left. 
 *   pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated 
 *            with the MB located above the current MB; set to NULL if there 
 *            is no MB located above the current MB. 
 *   pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated 
 *            with the MB located to the right and above the current MB; set 
 *            to NULL if there is no MB located to the above-right. 
 *   iBlk - the index of block in the current macroblock 
 *   pDstMVPredME - MV candidate return buffer;  if set to NULL then 
 *            prediction candidate MVs are not returned and pDstMVPredME will 
 *            be NULL upon function return; if pDstMVPredME is non-NULL then it 
 *            must point to a buffer containing sufficient space for three 
 *            return MVs. 
 *
 * Output Arguments:
 *   
 *   pDstMVPred - pointer to the predicted motion vector 
 *   pDstMVPredME - if non-NULL upon input then pDstMVPredME  points upon 
 *            return to a buffer containing the three motion vector candidates 
 *            used for prediction as specified in [ISO14496-2], subclause 
 *            7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL 
 *            upon output. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -    the pointer pDstMVPred is NULL 
 *    -    the parameter iBlk does not fall into the range 0 <= iBlk<=3 
 *
 */
OMXResult omxVCM4P2_FindMVpred (
    const OMXVCMotionVector *pSrcMVCurMB,
    const OMXVCMotionVector *pSrcCandMV1,
    const OMXVCMotionVector *pSrcCandMV2,
    const OMXVCMotionVector *pSrcCandMV3,
    OMXVCMotionVector *pDstMVPred,
    OMXVCMotionVector *pDstMVPredME,
    OMX_INT iBlk
);



/**
 * Function:  omxVCM4P2_IDCT8x8blk   (6.2.3.2.1)
 *
 * Description:
 * Computes a 2D inverse DCT for a single 8x8 block, as defined in 
 * [ISO14496-2]. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the start of the linearly arranged IDCT input buffer; 
 *            must be aligned on a 16-byte boundary.  According to 
 *            [ISO14496-2], the input coefficient values should lie within the 
 *            range [-2048, 2047]. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the start of the linearly arranged IDCT output buffer; 
 *            must be aligned on a 16-byte boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    pSrc or pDst is NULL. 
 *    -    pSrc or pDst is not 16-byte aligned. 
 *
 */
OMXResult omxVCM4P2_IDCT8x8blk (
    const OMX_S16 *pSrc,
    OMX_S16 *pDst
);



/**
 * Function:  omxVCM4P2_MEGetBufSize   (6.2.4.1.1)
 *
 * Description:
 * Computes the size, in bytes, of the vendor-specific specification 
 * structure for the following motion estimation functions: 
 * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB. 
 *
 * Input Arguments:
 *   
 *   MEmode - motion estimation mode; available modes are defined by the 
 *            enumerated type OMXVCM4P2MEMode 
 *   pMEParams - motion estimation parameters 
 *
 * Output Arguments:
 *   
 *   pSize - pointer to the number of bytes required for the specification 
 *            structure 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - one or more of the following is true: 
 *    -    an invalid value was specified for the parameter MEmode 
 *    -    a negative or zero value was specified for the 
 *         parameter pMEParams->searchRange 
 *
 */
OMXResult omxVCM4P2_MEGetBufSize (
    OMXVCM4P2MEMode MEmode,
    const OMXVCM4P2MEParams *pMEParams,
    OMX_U32 *pSize
);



/**
 * Function:  omxVCM4P2_MEInit   (6.2.4.1.2)
 *
 * Description:
 * Initializes the vendor-specific specification structure required for the 
 * following motion estimation functions:  BlockMatch_Integer_8x8, 
 * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the 
 * specification structure *pMESpec must be allocated prior to calling the 
 * function, and should be aligned on a 4-byte boundary.  Following 
 * initialization by this function, the vendor-specific structure *pMESpec 
 * should contain an implementation-specific representation of all motion 
 * estimation parameters received via the structure pMEParams, for example  
 * rndVal, searchRange, etc.  The number of bytes required for the 
 * specification structure can be determined using the function 
 * omxVCM4P2_MEGetBufSize. 
 *
 * Input Arguments:
 *   
 *   MEmode - motion estimation mode; available modes are defined by the 
 *            enumerated type OMXVCM4P2MEMode 
 *   pMEParams - motion estimation parameters 
 *   pMESpec - pointer to the uninitialized ME specification structure 
 *
 * Output Arguments:
 *   
 *   pMESpec - pointer to the initialized ME specification structure 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - one or more of the following is true: 
 *    -    an invalid value was specified for the parameter MEmode 
 *    -    a negative or zero value was specified for the 
 *         parameter pMEParams->searchRange 
 *
 */
OMXResult omxVCM4P2_MEInit (
    OMXVCM4P2MEMode MEmode,
    const OMXVCM4P2MEParams*pMEParams,
    void *pMESpec
);



/**
 * Function:  omxVCM4P2_BlockMatch_Integer_16x16   (6.2.4.2.1)
 *
 * Description:
 * Performs a 16x16 block search; estimates motion vector and associated 
 * minimum SAD. Both the input and output motion vectors are represented using 
 * half-pixel units, and therefore a shift left or right by 1 bit may be 
 * required, respectively, to match the input or output MVs with other 
 * functions that either generate output MVs or expect input MVs represented 
 * using integer pixel units. 
 *
 * Input Arguments:
 *   
 *   pSrcRefBuf - pointer to the reference Y plane; points to the reference 
 *            MB that corresponds to the location of the current macroblock in 
 *            the current plane. 
 *   refWidth - width of the reference plane 
 *   pRefRect - pointer to the valid reference plane rectangle; coordinates 
 *            are specified relative to the image origin.  Rectangle 
 *            boundaries may extend beyond image boundaries if the image has 
 *            been padded.  For example, if padding extends 4 pixels beyond 
 *            frame border, then the value for the left border could be set to 
 *            -4. 
 *   pSrcCurrBuf - pointer to the current block in the current macroblock 
 *            buffer extracted from the original plane (linear array, 256 
 *            entries); must be aligned on a 16-byte boundary.  The number of 
 *            bytes between lines (step) is 16. 
 *   pCurrPointPos - position of the current macroblock in the current plane 
 *   pSrcPreMV - pointer to predicted motion vector; NULL indicates no 
 *            predicted MV 
 *   pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced 
 *            by pSrcPreMV); may be set to NULL if unavailable. 
 *   pMESpec - vendor-specific motion estimation specification structure; 
 *            must have been allocated and then initialized using 
 *            omxVCM4P2_MEInit prior to calling the block matching function. 
 *
 * Output Arguments:
 *   
 *   pDstMV - pointer to estimated MV 
 *   pDstSAD - pointer to minimum SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following 
 *              conditions is true: 
 *    -    at least one of the following pointers is NULL: pSrcRefBuf, 
 *              pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or 
 *              pMESpec, or 
 *    -    pSrcCurrBuf is not 16-byte aligned 
 *
 */
OMXResult omxVCM4P2_BlockMatch_Integer_16x16 (
    const OMX_U8 *pSrcRefBuf,
    OMX_INT refWidth,
    const OMXRect *pRefRect,
    const OMX_U8 *pSrcCurrBuf,
    const OMXVCM4P2Coordinate *pCurrPointPos,
    const OMXVCMotionVector*pSrcPreMV,
    const OMX_INT *pSrcPreSAD,
    void *pMESpec,
    OMXVCMotionVector*pDstMV,
    OMX_INT *pDstSAD
);



/**
 * Function:  omxVCM4P2_BlockMatch_Integer_8x8   (6.2.4.2.2)
 *
 * Description:
 * Performs an 8x8 block search; estimates motion vector and associated 
 * minimum SAD.  Both the input and output motion vectors are represented 
 * using half-pixel units, and therefore a shift left or right by 1 bit may be 
 * required, respectively, to match the input or output MVs with other 
 * functions that either generate output MVs or expect input MVs represented 
 * using integer pixel units. 
 *
 * Input Arguments:
 *   
 *   pSrcRefBuf - pointer to the reference Y plane; points to the reference 
 *            block that corresponds to the location of the current 8x8 block 
 *            in the current plane. 
 *   refWidth - width of the reference plane 
 *   pRefRect - pointer to the valid reference plane rectangle; coordinates 
 *            are specified relative to the image origin.  Rectangle 
 *            boundaries may extend beyond image boundaries if the image has 
 *            been padded. 
 *   pSrcCurrBuf - pointer to the current block in the current macroblock 
 *            buffer extracted from the original plane (linear array, 128 
 *            entries); must be aligned on an 8-byte boundary.  The number of 
 *            bytes between lines (step) is 16 bytes. 
 *   pCurrPointPos - position of the current block in the current plane 
 *   pSrcPreMV - pointer to predicted motion vector; NULL indicates no 
 *            predicted MV 
 *   pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced 
 *            by pSrcPreMV); may be set to NULL if unavailable. 
 *   pMESpec - vendor-specific motion estimation specification structure; 
 *            must have been allocated and then initialized using 
 *            omxVCM4P2_MEInit prior to calling the block matching function. 
 *
 * Output Arguments:
 *   
 *   pDstMV - pointer to estimated MV 
 *   pDstSAD - pointer to minimum SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following 
 *              conditions is true: 
 *    -    at least one of the following pointers is NULL: pSrcRefBuf, 
 *              pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or 
 *              pMESpec, or 
 *    -    pSrcCurrBuf is not 8-byte aligned 
 *
 */
OMXResult omxVCM4P2_BlockMatch_Integer_8x8 (
    const OMX_U8 *pSrcRefBuf,
    OMX_INT refWidth,
    const OMXRect *pRefRect,
    const OMX_U8 *pSrcCurrBuf,
    const OMXVCM4P2Coordinate *pCurrPointPos,
    const OMXVCMotionVector *pSrcPreMV,
    const OMX_INT *pSrcPreSAD,
    void *pMESpec,
    OMXVCMotionVector *pDstMV,
    OMX_INT *pDstSAD
);



/**
 * Function:  omxVCM4P2_BlockMatch_Half_16x16   (6.2.4.2.3)
 *
 * Description:
 * Performs a 16x16 block match with half-pixel resolution.  Returns the 
 * estimated motion vector and associated minimum SAD.  This function 
 * estimates the half-pixel motion vector by interpolating the integer 
 * resolution motion vector referenced by the input parameter pSrcDstMV, i.e., 
 * the initial integer MV is generated externally.  The input parameters 
 * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of 
 * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function 
 * BlockMatch_Integer_16x16 may be used for integer motion estimation. 
 *
 * Input Arguments:
 *   
 *   pSrcRefBuf - pointer to the reference Y plane; points to the reference 
 *            macroblock that corresponds to the location of the current 
 *            macroblock in the current plane. 
 *   refWidth - width of the reference plane 
 *   pRefRect - reference plane valid region rectangle 
 *   pSrcCurrBuf - pointer to the current block in the current macroblock 
 *            buffer extracted from the original plane (linear array, 256 
 *            entries); must be aligned on a 16-byte boundary.  The number of 
 *            bytes between lines (step) is 16. 
 *   pSearchPointRefPos - position of the starting point for half pixel 
 *            search (specified in terms of integer pixel units) in the 
 *            reference plane, i.e., the reference position pointed to by the 
 *            predicted motion vector. 
 *   rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 
 *   pSrcDstMV - pointer to the initial MV estimate; typically generated 
 *            during a prior 16X16 integer search; specified in terms of 
 *            half-pixel units. 
 *
 * Output Arguments:
 *   
 *   pSrcDstMV - pointer to estimated MV 
 *   pDstSAD - pointer to minimum SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following 
 *              conditions is true: 
 *    -    at least one of the following pointers is NULL: pSrcRefBuf, 
 *         pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV.
 *    -    pSrcCurrBuf is not 16-byte aligned, or 
 *
 */
OMXResult omxVCM4P2_BlockMatch_Half_16x16 (
    const OMX_U8 *pSrcRefBuf,
    OMX_INT refWidth,
    const OMXRect *pRefRect,
    const OMX_U8 *pSrcCurrBuf,
    const OMXVCM4P2Coordinate *pSearchPointRefPos,
    OMX_INT rndVal,
    OMXVCMotionVector *pSrcDstMV,
    OMX_INT *pDstSAD
);



/**
 * Function:  omxVCM4P2_BlockMatch_Half_8x8   (6.2.4.2.4)
 *
 * Description:
 * Performs an 8x8 block match with half-pixel resolution. Returns the 
 * estimated motion vector and associated minimum SAD.  This function 
 * estimates the half-pixel motion vector by interpolating the integer 
 * resolution motion vector referenced by the input parameter pSrcDstMV, i.e., 
 * the initial integer MV is generated externally.  The input parameters 
 * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of 
 * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function 
 * BlockMatch_Integer_8x8 may be used for integer motion estimation. 
 *
 * Input Arguments:
 *   
 *   pSrcRefBuf - pointer to the reference Y plane; points to the reference 
 *            block that corresponds to the location of the current 8x8 block 
 *            in the current plane. 
 *   refWidth - width of the reference plane 
 *   pRefRect - reference plane valid region rectangle 
 *   pSrcCurrBuf - pointer to the current block in the current macroblock 
 *            buffer extracted from the original plane (linear array, 128 
 *            entries); must be aligned on a 8-byte boundary.  The number of 
 *            bytes between lines (step) is 16. 
 *   pSearchPointRefPos - position of the starting point for half pixel 
 *            search (specified in terms of integer pixel units) in the 
 *            reference plane. 
 *   rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 
 *   pSrcDstMV - pointer to the initial MV estimate; typically generated 
 *            during a prior 8x8 integer search, specified in terms of 
 *            half-pixel units. 
 *
 * Output Arguments:
 *   
 *   pSrcDstMV - pointer to estimated MV 
 *   pDstSAD - pointer to minimum SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following 
 *              conditions is true: 
 *    -    at least one of the following pointers is NULL: 
 *         pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV
 *    -    pSrcCurrBuf is not 8-byte aligned 
 *
 */
OMXResult omxVCM4P2_BlockMatch_Half_8x8 (
    const OMX_U8 *pSrcRefBuf,
    OMX_INT refWidth,
    const OMXRect *pRefRect,
    const OMX_U8 *pSrcCurrBuf,
    const OMXVCM4P2Coordinate *pSearchPointRefPos,
    OMX_INT rndVal,
    OMXVCMotionVector *pSrcDstMV,
    OMX_INT *pDstSAD
);



/**
 * Function:  omxVCM4P2_MotionEstimationMB   (6.2.4.3.1)
 *
 * Description:
 * Performs motion search for a 16x16 macroblock.  Selects best motion search 
 * strategy from among inter-1MV, inter-4MV, and intra modes.  Supports 
 * integer and half pixel resolution. 
 *
 * Input Arguments:
 *   
 *   pSrcCurrBuf - pointer to the top-left corner of the current MB in the 
 *            original picture plane; must be aligned on a 16-byte boundary.  
 *            The function does not expect source data outside the region 
 *            bounded by the MB to be available; for example it is not 
 *            necessary for the caller to guarantee the availability of 
 *            pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB 
 *            to be processed. 
 *   srcCurrStep - width of the original picture plane, in terms of full 
 *            pixels; must be a multiple of 16. 
 *   pSrcRefBuf - pointer to the reference Y plane; points to the reference 
 *            plane location corresponding to the location of the current 
 *            macroblock in the current plane; must be aligned on a 16-byte 
 *            boundary. 
 *   srcRefStep - width of the reference picture plane, in terms of full 
 *            pixels; must be a multiple of 16. 
 *   pRefRect - reference plane valid region rectangle, specified relative to 
 *            the image origin 
 *   pCurrPointPos - position of the current macroblock in the current plane 
 *   pMESpec - pointer to the vendor-specific motion estimation specification 
 *            structure; must be allocated and then initialized using 
 *            omxVCM4P2_MEInit prior to calling this function. 
 *   pMBInfo - array, of dimension four, containing pointers to information 
 *            associated with four nearby MBs: 
 *            -   pMBInfo[0] - pointer to left MB information 
 *            -   pMBInfo[1] - pointer to top MB information 
 *            -   pMBInfo[2] - pointer to top-left MB information 
 *            -   pMBInfo[3] - pointer to top-right MB information 
 *            Any pointer in the array may be set equal to NULL if the 
 *            corresponding MB doesn't exist.  For each MB, the following structure 
 *            members are used:    
 *            -   mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or 
 *                OMX_VC_INTER4V 
 *            -   pMV0[2][2] - estimated motion vectors; represented 
 *                in 1/2 pixel units 
 *            -   sliceID - number of the slice to which the MB belongs 
 *   pSrcDstMBCurr - pointer to information structure for the current MB.  
 *            The following entries should be set prior to calling the 
 *            function: sliceID - the number of the slice the to which the 
 *            current MB belongs.  The structure elements cbpy and cbpc are 
 *            ignored. 
 *
 * Output Arguments:
 *   
 *   pSrcDstMBCurr - pointer to updated information structure for the current 
 *            MB after MB-level motion estimation has been completed.  The 
 *            following structure members are updated by the ME function:   
 *              -  mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or 
 *                 OMX_VC_INTER4V. 
 *              -  pMV0[2][2] - estimated motion vectors; represented in 
 *                 terms of 1/2 pel units. 
 *              -  pMVPred[2][2] - predicted motion vectors; represented 
 *                 in terms of 1/2 pel units. 
 *            The structure members cbpy and cbpc are not updated by the function. 
 *   pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs 
 *            for INTER4V 
 *   pDstBlockSAD - pointer to an array of SAD values for each of the four 
 *            8x8 luma blocks in the MB.  The block SADs are in scan order for 
 *            each MB. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the 
 *              following conditions is true: 
 *    -    at least one of the following pointers is NULL: pSrcCurrBuf, 
 *              pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra, 
 *              pSrcDstMBCurr, or pDstSAD. 
 *
 */
OMXResult omxVCM4P2_MotionEstimationMB (
    const OMX_U8 *pSrcCurrBuf,
    OMX_S32 srcCurrStep,
    const OMX_U8 *pSrcRefBuf,
    OMX_S32 srcRefStep,
    const OMXRect*pRefRect,
    const OMXVCM4P2Coordinate *pCurrPointPos,
    void *pMESpec,
    const OMXVCM4P2MBInfoPtr *pMBInfo,
    OMXVCM4P2MBInfo *pSrcDstMBCurr,
    OMX_U16 *pDstSAD,
    OMX_U16 *pDstBlockSAD
);



/**
 * Function:  omxVCM4P2_DCT8x8blk   (6.2.4.4.1)
 *
 * Description:
 * Computes a 2D forward DCT for a single 8x8 block, as defined in 
 * [ISO14496-2]. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the start of the linearly arranged input buffer; must 
 *            be aligned on a 16-byte boundary.  Input values (pixel 
 *            intensities) are valid in the range [-255,255]. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the start of the linearly arranged output buffer; must 
 *            be aligned on a 16-byte boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments, returned if:
 *    -    pSrc or pDst is NULL. 
 *    -    pSrc or pDst is not 16-byte aligned. 
 *
 */
OMXResult omxVCM4P2_DCT8x8blk (
    const OMX_S16 *pSrc,
    OMX_S16 *pDst
);



/**
 * Function:  omxVCM4P2_QuantIntra_I   (6.2.4.4.2)
 *
 * Description:
 * Performs quantization on intra block coefficients. This function supports 
 * bits_per_pixel == 8. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input intra block coefficients; must be aligned 
 *            on a 16-byte boundary. 
 *   QP - quantization parameter (quantizer_scale). 
 *   blockIndex - block index indicating the component type and position, 
 *            valid in the range 0 to 5, as defined in [ISO14496-2], subclause 
 *            6.1.3.8. 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; shortVideoHeader==1 selects linear intra DC 
 *            mode, and shortVideoHeader==0 selects non linear intra DC mode. 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to the output (quantized) interblock coefficients.  
 *            When shortVideoHeader==1, AC coefficients are saturated on the 
 *            interval [-127, 127], and DC coefficients are saturated on the 
 *            interval [1, 254].  When shortVideoHeader==0, AC coefficients 
 *            are saturated on the interval [-2047, 2047]. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    pSrcDst is NULL. 
 *    -    blockIndex < 0 or blockIndex >= 10 
 *    -    QP <= 0 or QP >= 32. 
 *
 */
OMXResult omxVCM4P2_QuantIntra_I (
    OMX_S16 *pSrcDst,
    OMX_U8 QP,
    OMX_INT blockIndex,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_QuantInter_I   (6.2.4.4.3)
 *
 * Description:
 * Performs quantization on an inter coefficient block; supports 
 * bits_per_pixel == 8. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input inter block coefficients; must be aligned 
 *            on a 16-byte boundary. 
 *   QP - quantization parameter (quantizer_scale) 
 *   shortVideoHeader - binary flag indicating presence of short_video_header; 
 *            shortVideoHeader==1 selects linear intra DC mode, and 
 *            shortVideoHeader==0 selects non linear intra DC mode. 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to the output (quantized) interblock coefficients.  
 *            When shortVideoHeader==1, AC coefficients are saturated on the 
 *            interval [-127, 127], and DC coefficients are saturated on the 
 *            interval [1, 254].  When shortVideoHeader==0, AC coefficients 
 *            are saturated on the interval [-2047, 2047]. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    pSrcDst is NULL. 
 *    -    QP <= 0 or QP >= 32. 
 *
 */
OMXResult omxVCM4P2_QuantInter_I (
    OMX_S16 *pSrcDst,
    OMX_U8 QP,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_TransRecBlockCoef_intra   (6.2.4.4.4)
 *
 * Description:
 * Quantizes the DCT coefficients, implements intra block AC/DC coefficient 
 * prediction, and reconstructs the current intra block texture for prediction 
 * on the next frame.  Quantized row and column coefficients are returned in 
 * the updated coefficient buffers. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the pixels of current intra block; must be aligned on 
 *            an 8-byte boundary. 
 *   pPredBufRow - pointer to the coefficient row buffer containing 
 *            ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16. 
 *            Coefficients are organized into blocks of eight as described 
 *            below (Internal Prediction Coefficient Update Procedures).  The 
 *            DC coefficient is first, and the remaining buffer locations 
 *            contain the quantized AC coefficients. Each group of eight row 
 *            buffer elements combined with one element eight elements ahead 
 *            contains the coefficient predictors of the neighboring block 
 *            that is spatially above or to the left of the block currently to 
 *            be decoded. A negative-valued DC coefficient indicates that this 
 *            neighboring block is not INTRA-coded or out of bounds, and 
 *            therefore the AC and DC coefficients are invalid.  Pointer must 
 *            be aligned on an 8-byte boundary. 
 *   pPredBufCol - pointer to the prediction coefficient column buffer 
 *            containing 16 elements of type OMX_S16. Coefficients are 
 *            organized as described in section 6.2.2.5.  Pointer must be 
 *            aligned on an 8-byte boundary. 
 *   pSumErr - pointer to a flag indicating whether or not AC prediction is 
 *            required; AC prediction is enabled if *pSumErr >=0, but the 
 *            value is not used for coefficient prediction, i.e., the sum of 
 *            absolute differences starts from 0 for each call to this 
 *            function.  Otherwise AC prediction is disabled if *pSumErr < 0 . 
 *   blockIndex - block index indicating the component type and position, as 
 *            defined in [ISO14496-2], subclause 6.1.3.8. 
 *   curQp - quantization parameter of the macroblock to which the current 
 *            block belongs 
 *   pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0] 
 *            contains the quantization parameter associated with the 8x8 
 *            block left of the current block (QPa), and pQpBuf[1] contains 
 *            the quantization parameter associated with the 8x8 block above 
 *            the current block (QPc).  In the event that the corresponding 
 *            block is outside of the VOP bound, the Qp value will not affect 
 *            the intra prediction process, as described in [ISO14496-2], 
 *            sub-clause 7.4.3.3,  Adaptive AC Coefficient Prediction.  
 *   srcStep - width of the source buffer; must be a multiple of 8. 
 *   dstStep - width of the reconstructed destination buffer; must be a 
 *            multiple of 16. 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; shortVideoHeader==1 selects linear intra DC 
 *            mode, and shortVideoHeader==0 selects non linear intra DC mode. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains 
 *            the predicted DC coefficient; the remaining entries contain the 
 *            quantized AC coefficients (without prediction).  The pointer 
 *            pDstmust be aligned on a 16-byte boundary. 
 *   pRec - pointer to the reconstructed texture; must be aligned on an 
 *            8-byte boundary. 
 *   pPredBufRow - pointer to the updated coefficient row buffer 
 *   pPredBufCol - pointer to the updated coefficient column buffer 
 *   pPreACPredict - if prediction is enabled, the parameter points to the 
 *            start of the buffer containing the coefficient differences for 
 *            VLC encoding. The entry pPreACPredict[0]indicates prediction 
 *            direction for the current block and takes one of the following 
 *            values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or 
 *            OMX_VC_VERTICAL.  The entries 
 *            pPreACPredict[1]-pPreACPredict[7]contain predicted AC 
 *            coefficients.  If prediction is disabled (*pSumErr<0) then the 
 *            contents of this buffer are undefined upon return from the 
 *            function 
 *   pSumErr - pointer to the value of the accumulated AC coefficient errors, 
 *            i.e., sum of the absolute differences between predicted and 
 *            unpredicted AC coefficients 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - Bad arguments:
 *    -    At least one of the following pointers is NULL: pSrc, pDst, pRec, 
 *         pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr. 
 *    -    blockIndex < 0 or blockIndex >= 10; 
 *    -    curQP <= 0 or curQP >= 32. 
 *    -    srcStep, or dstStep <= 0 or not a multiple of 8. 
 *    -    pDst is not 16-byte aligned: . 
 *    -    At least one of the following pointers is not 8-byte aligned: 
 *         pSrc, pRec.  
 *
 *  Note: The coefficient buffers must be updated in accordance with the 
 *        update procedures defined in section in 6.2.2. 
 *
 */
OMXResult omxVCM4P2_TransRecBlockCoef_intra (
    const OMX_U8 *pSrc,
    OMX_S16 *pDst,
    OMX_U8 *pRec,
    OMX_S16 *pPredBufRow,
    OMX_S16 *pPredBufCol,
    OMX_S16 *pPreACPredict,
    OMX_INT *pSumErr,
    OMX_INT blockIndex,
    OMX_U8 curQp,
    const OMX_U8 *pQpBuf,
    OMX_INT srcStep,
    OMX_INT dstStep,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_TransRecBlockCoef_inter   (6.2.4.4.5)
 *
 * Description:
 * Implements DCT, and quantizes the DCT coefficients of the inter block 
 * while reconstructing the texture residual. There is no boundary check for 
 * the bit stream buffer. 
 *
 * Input Arguments:
 *   
 *   pSrc -pointer to the residuals to be encoded; must be aligned on an 
 *            16-byte boundary. 
 *   QP - quantization parameter. 
 *   shortVideoHeader - binary flag indicating presence of short_video_header; 
 *                      shortVideoHeader==1 selects linear intra DC mode, and 
 *                      shortVideoHeader==0 selects non linear intra DC mode. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the quantized DCT coefficients buffer; must be aligned 
 *            on a 16-byte boundary. 
 *   pRec - pointer to the reconstructed texture residuals; must be aligned 
 *            on a 16-byte boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    At least one of the following pointers is either NULL or 
 *         not 16-byte aligned: 
 *            - pSrc 
 *            - pDst
 *            - pRec
 *    -    QP <= 0 or QP >= 32. 
 *
 */
OMXResult omxVCM4P2_TransRecBlockCoef_inter (
    const OMX_S16 *pSrc,
    OMX_S16 *pDst,
    OMX_S16 *pRec,
    OMX_U8 QP,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_EncodeVLCZigzag_IntraDCVLC   (6.2.4.5.2)
 *
 * Description:
 * Performs zigzag scan and VLC encoding of AC and DC coefficients for one 
 * intra block.  Two versions of the function (DCVLC and ACVLC) are provided 
 * in order to support the two different methods of processing DC 
 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC 
 * Coefficient Decoding for the Case of Switched VLC Encoding".  
 *
 * Input Arguments:
 *   
 *   ppBitStream - double pointer to the current byte in the bitstream 
 *   pBitOffset - pointer to the bit position in the byte pointed by 
 *            *ppBitStream. Valid within 0 to 7. 
 *   pQDctBlkCoef - pointer to the quantized DCT coefficient 
 *   predDir - AC prediction direction, which is used to decide the zigzag 
 *            scan pattern; takes one of the following values: 
 *            -  OMX_VC_NONE - AC prediction not used.  
 *                             Performs classical zigzag scan. 
 *            -  OMX_VC_HORIZONTAL - Horizontal prediction.  
 *                             Performs alternate-vertical zigzag scan. 
 *            -  OMX_VC_VERTICAL - Vertical prediction.  
 *                             Performs alternate-horizontal zigzag scan. 
 *   pattern - block pattern which is used to decide whether this block is 
 *            encoded 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; escape modes 0-3 are used if 
 *            shortVideoHeader==0, and escape mode 4 is used when 
 *            shortVideoHeader==1. 
 *   videoComp - video component type (luminance, chrominance) of the current 
 *            block 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is encoded, so 
 *            that it points to the current byte in the bit stream buffer. 
 *   pBitOffset - *pBitOffset is updated so that it points to the current bit 
 *            position in the byte pointed by *ppBitStream. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - Bad arguments:
 *    -    At least one of the following pointers is NULL: ppBitStream, 
 *              *ppBitStream, pBitOffset, pQDctBlkCoef. 
 *    -   *pBitOffset < 0, or *pBitOffset >7. 
 *    -    PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or 
 *         OMX_VC_VERTICAL. 
 *    -    VideoComp is not one component of enum OMXVCM4P2VideoComponent. 
 *
 */
OMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (
    OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    const OMX_S16 *pQDctBlkCoef,
    OMX_U8 predDir,
    OMX_U8 pattern,
    OMX_INT shortVideoHeader,
    OMXVCM4P2VideoComponent videoComp
);



/**
 * Function:  omxVCM4P2_EncodeVLCZigzag_IntraACVLC   (6.2.4.5.2)
 *
 * Description:
 * Performs zigzag scan and VLC encoding of AC and DC coefficients for one 
 * intra block.  Two versions of the function (DCVLC and ACVLC) are provided 
 * in order to support the two different methods of processing DC 
 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4,  Intra DC 
 * Coefficient Decoding for the Case of Switched VLC Encoding.  
 *
 * Input Arguments:
 *   
 *   ppBitStream - double pointer to the current byte in the bitstream 
 *   pBitOffset - pointer to the bit position in the byte pointed by 
 *            *ppBitStream. Valid within 0 to 7. 
 *   pQDctBlkCoef - pointer to the quantized DCT coefficient 
 *   predDir - AC prediction direction, which is used to decide the zigzag 
 *            scan pattern; takes one of the following values: 
 *            -  OMX_VC_NONE - AC prediction not used.  
 *                             Performs classical zigzag scan. 
 *            -  OMX_VC_HORIZONTAL - Horizontal prediction.  
 *                             Performs alternate-vertical zigzag scan. 
 *            -  OMX_VC_VERTICAL - Vertical prediction.  
 *                             Performs alternate-horizontal zigzag scan. 
 *   pattern - block pattern which is used to decide whether this block is 
 *            encoded 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; escape modes 0-3 are used if 
 *            shortVideoHeader==0, and escape mode 4 is used when 
 *            shortVideoHeader==1. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is encoded, so 
 *            that it points to the current byte in the bit stream buffer. 
 *   pBitOffset - *pBitOffset is updated so that it points to the current bit 
 *            position in the byte pointed by *ppBitStream. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - Bad arguments:
 *    -    At least one of the following pointers is NULL: ppBitStream, 
 *              *ppBitStream, pBitOffset, pQDctBlkCoef. 
 *    -   *pBitOffset < 0, or *pBitOffset >7. 
 *    -    PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or 
 *         OMX_VC_VERTICAL. 
 *    -    VideoComp is not one component of enum OMXVCM4P2VideoComponent. 
 *
 */
OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC (
    OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    const OMX_S16 *pQDctBlkCoef,
    OMX_U8 predDir,
    OMX_U8 pattern,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_EncodeVLCZigzag_Inter   (6.2.4.5.3)
 *
 * Description:
 * Performs classical zigzag scanning and VLC encoding for one inter block. 
 *
 * Input Arguments:
 *   
 *   ppBitStream - pointer to the pointer to the current byte in the bit 
 *            stream 
 *   pBitOffset - pointer to the bit position in the byte pointed by 
 *            *ppBitStream. Valid within 0 to 7 
 *   pQDctBlkCoef - pointer to the quantized DCT coefficient 
 *   pattern - block pattern which is used to decide whether this block is 
 *            encoded 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; escape modes 0-3 are used if 
 *            shortVideoHeader==0, and escape mode 4 is used when 
 *            shortVideoHeader==1. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is encoded so that 
 *            it points to the current byte in the bit stream buffer. 
 *   pBitOffset - *pBitOffset is updated so that it points to the current bit 
 *            position in the byte pointed by *ppBitStream. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - Bad arguments 
 *    -    At least one of the pointers: is NULL: ppBitStream, *ppBitStream, 
 *              pBitOffset, pQDctBlkCoef 
 *    -   *pBitOffset < 0, or *pBitOffset >7. 
 *
 */
OMXResult omxVCM4P2_EncodeVLCZigzag_Inter (
    OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    const OMX_S16 *pQDctBlkCoef,
    OMX_U8 pattern,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_EncodeMV   (6.2.4.5.4)
 *
 * Description:
 * Predicts a motion vector for the current macroblock, encodes the 
 * difference, and writes the output to the stream buffer. The input MVs 
 * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie 
 * within the ranges associated with the input parameter fcodeForward, as 
 * described in [ISO14496-2], subclause 7.6.3.  This function provides a 
 * superset of the functionality associated with the function 
 * omxVCM4P2_FindMVpred. 
 *
 * Input Arguments:
 *   
 *   ppBitStream - double pointer to the current byte in the bitstream buffer 
 *   pBitOffset - index of the first free (next available) bit in the stream 
 *            buffer referenced by *ppBitStream, valid in the range 0 to 7. 
 *   pMVCurMB - pointer to the current macroblock motion vector; a value of 
 *            NULL indicates unavailability. 
 *   pSrcMVLeftMB - pointer to the source left macroblock motion vector; a 
 *            value of  NULLindicates unavailability. 
 *   pSrcMVUpperMB - pointer to source upper macroblock motion vector; a 
 *            value of NULL indicates unavailability. 
 *   pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a 
 *            value of NULL indicates unavailability. 
 *   fcodeForward - an integer with values from 1 to 7; used in encoding 
 *            motion vectors related to search range, as described in 
 *            [ISO14496-2], subclause 7.6.3. 
 *   MBType - macro block type, valid in the range 0 to 5 
 *
 * Output Arguments:
 *   
 *   ppBitStream - updated pointer to the current byte in the bit stream 
 *            buffer 
 *   pBitOffset - updated index of the next available bit position in stream 
 *            buffer referenced by *ppBitStream 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments 
 *    -    At least one of the following pointers is NULL: ppBitStream, 
 *              *ppBitStream, pBitOffset, pMVCurMB 
 *    -    *pBitOffset < 0, or *pBitOffset >7. 
 *    -    fcodeForward <= 0, or fcodeForward > 7, or MBType < 0. 
 *
 */
OMXResult omxVCM4P2_EncodeMV (
    OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    const OMXVCMotionVector *pMVCurMB,
    const OMXVCMotionVector*pSrcMVLeftMB,
    const OMXVCMotionVector *pSrcMVUpperMB,
    const OMXVCMotionVector *pSrcMVUpperRightMB,
    OMX_INT fcodeForward,
    OMXVCM4P2MacroblockType MBType
);



/**
 * Function:  omxVCM4P2_DecodePadMV_PVOP   (6.2.5.1.1)
 *
 * Description:
 * Decodes and pads the four motion vectors associated with a non-intra P-VOP 
 * macroblock.  For macroblocks of type OMX_VC_INTER4V, the output MV is 
 * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for 
 * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to 
 * all four output MV buffer entries. 
 *
 * Input Arguments:
 *   
 *   ppBitStream - pointer to the pointer to the current byte in the bit 
 *            stream buffer 
 *   pBitOffset - pointer to the bit position in the byte pointed to by 
 *            *ppBitStream. *pBitOffset is valid within [0-7]. 
 *   pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the 
 *            motion vector buffers of the macroblocks specially at the left, 
 *            upper, and upper-right side of the current macroblock, 
 *            respectively; a value of NULL indicates unavailability.  Note: 
 *            Any neighborhood macroblock outside the current VOP or video 
 *            packet or outside the current GOB (when short_video_header is 
 *             1 ) for which gob_header_empty is  0  is treated as 
 *            transparent, according to [ISO14496-2], subclause 7.6.5. 
 *   fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream 
 *            syntax 
 *   MBType - the type of the current macroblock. If MBType is not equal to 
 *            OMX_VC_INTER4V, the destination motion vector buffer is still 
 *            filled with the same decoded vector. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is decoded, so 
 *            that it points to the current byte in the bit stream buffer 
 *   pBitOffset - *pBitOffset is updated so that it points to the current bit 
 *            position in the byte pointed by *ppBitStream 
 *   pDstMVCurMB - pointer to the motion vector buffer for the current 
 *            macroblock; contains four decoded motion vectors 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    At least one of the following pointers is NULL: 
 *         ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB 
 *    -    *pBitOffset exceeds [0,7]
 *    -    fcodeForward exceeds (0,7]
 *    -    MBType less than zero
 *    -    motion vector buffer is not 4-byte aligned. 
 *    OMX_Sts_Err - status error 
 *
 */
OMXResult omxVCM4P2_DecodePadMV_PVOP (
    const OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    OMXVCMotionVector *pSrcMVLeftMB,
    OMXVCMotionVector*pSrcMVUpperMB,
    OMXVCMotionVector *pSrcMVUpperRightMB,
    OMXVCMotionVector*pDstMVCurMB,
    OMX_INT fcodeForward,
    OMXVCM4P2MacroblockType MBType
);



/**
 * Function:  omxVCM4P2_DecodeVLCZigzag_IntraDCVLC   (6.2.5.2.2)
 *
 * Description:
 * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients 
 * for one intra block.  Two versions of the function (DCVLC and ACVLC) are 
 * provided in order to support the two different methods of processing DC 
 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4,  Intra DC 
 * Coefficient Decoding for the Case of Switched VLC Encoding.  
 *
 * Input Arguments:
 *   
 *   ppBitStream - pointer to the pointer to the current byte in the 
 *            bitstream buffer 
 *   pBitOffset - pointer to the bit position in the current byte referenced 
 *            by *ppBitStream.  The parameter *pBitOffset is valid in the 
 *            range [0-7]. 
 *            Bit Position in one byte:  |Most      Least| 
 *                    *pBitOffset        |0 1 2 3 4 5 6 7| 
 *   predDir - AC prediction direction; used to select the zigzag scan 
 *            pattern; takes one of the following values: 
 *            -  OMX_VC_NONE - AC prediction not used; 
 *                             performs classical zigzag scan. 
 *            -  OMX_VC_HORIZONTAL - Horizontal prediction; 
 *                             performs alternate-vertical zigzag scan; 
 *            -  OMX_VC_VERTICAL - Vertical prediction; 
 *                             performs alternate-horizontal zigzag scan. 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; escape modes 0-3 are used if 
 *            shortVideoHeader==0, and escape mode 4 is used when 
 *            shortVideoHeader==1. 
 *   videoComp - video component type (luminance or chrominance) of the 
 *            current block 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is decoded such 
 *            that it points to the current byte in the bit stream buffer 
 *   pBitOffset - *pBitOffset is updated such that it points to the current 
 *            bit position in the byte pointed by *ppBitStream 
 *   pDst - pointer to the coefficient buffer of current block; must be 
 *            4-byte aligned. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments, if:
 *    -    At least one of the following pointers is NULL: 
 *         ppBitStream, *ppBitStream, pBitOffset, pDst
 *    -    *pBitOffset exceeds [0,7]
 *    -    preDir exceeds [0,2]
 *    -    pDst is not 4-byte aligned 
 *    OMX_Sts_Err - if:
 *    -    In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 
 *    -    At least one of mark bits equals zero 
 *    -    Illegal stream encountered; code cannot be located in VLC table 
 *    -    Forbidden code encountered in the VLC FLC table. 
 *    -    The number of coefficients is greater than 64 
 *
 */
OMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (
    const OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    OMX_S16 *pDst,
    OMX_U8 predDir,
    OMX_INT shortVideoHeader,
    OMXVCM4P2VideoComponent videoComp
);



/**
 * Function:  omxVCM4P2_DecodeVLCZigzag_IntraACVLC   (6.2.5.2.2)
 *
 * Description:
 * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients 
 * for one intra block.  Two versions of the function (DCVLC and ACVLC) are 
 * provided in order to support the two different methods of processing DC 
 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4,  Intra DC 
 * Coefficient Decoding for the Case of Switched VLC Encoding.  
 *
 * Input Arguments:
 *   
 *   ppBitStream - pointer to the pointer to the current byte in the 
 *            bitstream buffer 
 *   pBitOffset - pointer to the bit position in the current byte referenced 
 *            by *ppBitStream.  The parameter *pBitOffset is valid in the 
 *            range [0-7]. Bit Position in one byte:  |Most Least| *pBitOffset 
 *            |0 1 2 3 4 5 6 7| 
 *   predDir - AC prediction direction; used to select the zigzag scan 
 *            pattern; takes one of the following values: OMX_VC_NONE - AC 
 *            prediction not used; performs classical zigzag scan. 
 *            OMX_VC_HORIZONTAL - Horizontal prediction; performs 
 *            alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical 
 *            prediction; performs alternate-horizontal zigzag scan. 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; escape modes 0-3 are used if 
 *            shortVideoHeader==0, and escape mode 4 is used when 
 *            shortVideoHeader==1. 
 *   videoComp - video component type (luminance or chrominance) of the 
 *            current block 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is decoded such 
 *            that it points to the current byte in the bit stream buffer 
 *   pBitOffset - *pBitOffset is updated such that it points to the current 
 *            bit position in the byte pointed by *ppBitStream 
 *   pDst - pointer to the coefficient buffer of current block; must be 
 *            4-byte aligned. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments At least one of the following 
 *              pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, 
 *              or At least one of the following conditions is true: 
 *              *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is 
 *              not 4-byte aligned 
 *    OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of 
 *              mark bits equals zero Illegal stream encountered; code cannot 
 *              be located in VLC table Forbidden code encountered in the VLC 
 *              FLC table The number of coefficients is greater than 64 
 *
 */
OMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC (
    const OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    OMX_S16 *pDst,
    OMX_U8 predDir,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_DecodeVLCZigzag_Inter   (6.2.5.2.3)
 *
 * Description:
 * Performs VLC decoding and inverse zigzag scan for one inter-coded block. 
 *
 * Input Arguments:
 *   
 *   ppBitStream - double pointer to the current byte in the stream buffer 
 *   pBitOffset - pointer to the next available bit in the current stream 
 *            byte referenced by *ppBitStream. The parameter *pBitOffset is 
 *            valid within the range [0-7]. 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; escape modes 0-3 are used if 
 *            shortVideoHeader==0, and escape mode 4 is used when 
 *            shortVideoHeader==1. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is decoded such 
 *            that it points to the current byte in the stream buffer 
 *   pBitOffset - *pBitOffset is updated after decoding such that it points 
 *            to the next available bit in the stream byte referenced by 
 *            *ppBitStream 
 *   pDst - pointer to the coefficient buffer of current block; must be 
 *            4-byte aligned. 
 *
 * Return Value:
 *    
 *    OMX_Sts_BadArgErr - bad arguments:
 *    -    At least one of the following pointers is NULL: 
 *         ppBitStream, *ppBitStream, pBitOffset, pDst
 *    -    pDst is not 4-byte aligned
 *    -   *pBitOffset exceeds [0,7]
 *    OMX_Sts_Err - status error, if:
 *    -    At least one mark bit is equal to zero 
 *    -    Encountered an illegal stream code that cannot be found in the VLC table 
 *    -    Encountered an illegal code in the VLC FLC table 
 *    -    The number of coefficients is greater than 64 
 *
 */
OMXResult omxVCM4P2_DecodeVLCZigzag_Inter (
    const OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    OMX_S16 *pDst,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_QuantInvIntra_I   (6.2.5.3.2)
 *
 * Description:
 * Performs the second inverse quantization mode on an intra/inter coded 
 * block. Supports bits_per_pixel = 8. The output coefficients are clipped to 
 * the range [-2048, 2047]. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input (quantized) intra/inter block; must be 
 *            aligned on a 16-byte boundary. 
 *   QP - quantization parameter (quantizer_scale) 
 *   videoComp - video component type of the current block. Takes one of the 
 *            following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra 
 *            version only). 
 *   shortVideoHeader - binary flag indicating presence of short_video_header 
 *            (intra version only). 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to the output (dequantized) intra/inter block 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; one or more of the following is 
 *              true: 
 *    -    pSrcDst is NULL 
 *    -    QP <= 0 or QP >=31 
 *    -    videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE. 
 *
 */
OMXResult omxVCM4P2_QuantInvIntra_I (
    OMX_S16 *pSrcDst,
    OMX_INT QP,
    OMXVCM4P2VideoComponent videoComp,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_QuantInvInter_I   (6.2.5.3.2)
 *
 * Description:
 * Performs the second inverse quantization mode on an intra/inter coded 
 * block. Supports bits_per_pixel = 8. The output coefficients are clipped to 
 * the range [-2048, 2047]. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input (quantized) intra/inter block; must be 
 *            aligned on a 16-byte boundary. 
 *   QP - quantization parameter (quantizer_scale) 
 *   videoComp - video component type of the current block. Takes one of the 
 *            following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra 
 *            version only). 
 *   shortVideoHeader - binary flag indicating presence of short_video_header 
 *            (intra version only). 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to the output (dequantized) intra/inter block 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; one or more of the following is 
 *              true: 
 *    -    pSrcDst is NULL 
 *    -    QP <= 0 or QP >=31 
 *    -    videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE. 
 *
 */
OMXResult omxVCM4P2_QuantInvInter_I (
    OMX_S16 *pSrcDst,
    OMX_INT QP
);



/**
 * Function:  omxVCM4P2_DecodeBlockCoef_Intra   (6.2.5.4.1)
 *
 * Description:
 * Decodes the INTRA block coefficients. Inverse quantization, inversely 
 * zigzag positioning, and IDCT, with appropriate clipping on each step, are 
 * performed on the coefficients. The results are then placed in the output 
 * frame/plane on a pixel basis.  Note: This function will be used only when 
 * at least one non-zero AC coefficient of current block exists in the bit 
 * stream. The DC only condition will be handled in another function. 
 *
 *
 * Input Arguments:
 *   
 *   ppBitStream - pointer to the pointer to the current byte in the bit 
 *            stream buffer. There is no boundary check for the bit stream 
 *            buffer. 
 *   pBitOffset - pointer to the bit position in the byte pointed to by 
 *            *ppBitStream. *pBitOffset is valid within [0-7]. 
 *   step - width of the destination plane 
 *   pCoefBufRow - pointer to the coefficient row buffer; must be aligned on 
 *            an 8-byte boundary. 
 *   pCoefBufCol - pointer to the coefficient column buffer; must be aligned 
 *            on an 8-byte boundary. 
 *   curQP - quantization parameter of the macroblock which the current block 
 *            belongs to 
 *   pQPBuf - pointer to the quantization parameter buffer 
 *   blockIndex - block index indicating the component type and position as 
 *            defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5. 
 *   intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a 
 *            mechanism to switch between two VLC for coding of Intra DC 
 *            coefficients as per [ISO14496-2], Table 6-21. 
 *   ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if 
 *            the ac coefficients of the first row or first column are 
 *            differentially coded for intra coded macroblock. 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; shortVideoHeader==1 selects linear intra DC 
 *            mode, and shortVideoHeader==0 selects non linear intra DC mode. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is decoded, so 
 *            that it points to the current byte in the bit stream buffer 
 *   pBitOffset - *pBitOffset is updated so that it points to the current bit 
 *            position in the byte pointed by *ppBitStream 
 *   pDst - pointer to the block in the destination plane; must be aligned on 
 *            an 8-byte boundary. 
 *   pCoefBufRow - pointer to the updated coefficient row buffer. 
 *   pCoefBufCol - pointer to the updated coefficient column buffer  Note: 
 *            The coefficient buffers must be updated in accordance with the 
 *            update procedure defined in section 6.2.2. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments, if:
 *    -    At least one of the following pointers is NULL: 
 *         ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol, 
 *         pQPBuf, pDst. 
 *    -    *pBitOffset exceeds [0,7] 
 *    -    curQP exceeds (1, 31)
 *    -    blockIndex exceeds [0,5]
 *    -    step is not the multiple of 8
 *    -    a pointer alignment requirement was violated. 
 *    OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra.  
 *
 */
OMXResult omxVCM4P2_DecodeBlockCoef_Intra (
    const OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    OMX_U8 *pDst,
    OMX_INT step,
    OMX_S16 *pCoefBufRow,
    OMX_S16 *pCoefBufCol,
    OMX_U8 curQP,
    const OMX_U8 *pQPBuf,
    OMX_INT blockIndex,
    OMX_INT intraDCVLC,
    OMX_INT ACPredFlag,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_DecodeBlockCoef_Inter   (6.2.5.4.2)
 *
 * Description:
 * Decodes the INTER block coefficients. This function performs inverse 
 * quantization, inverse zigzag positioning, and IDCT (with appropriate 
 * clipping on each step) on the coefficients. The results (residuals) are 
 * placed in a contiguous array of 64 elements. For INTER block, the output 
 * buffer holds the residuals for further reconstruction. 
 *
 * Input Arguments:
 *   
 *   ppBitStream - pointer to the pointer to the current byte in the bit 
 *            stream buffer. There is no boundary check for the bit stream 
 *            buffer. 
 *   pBitOffset - pointer to the bit position in the byte pointed to by 
 *            *ppBitStream. *pBitOffset is valid within [0-7] 
 *   QP - quantization parameter 
 *   shortVideoHeader - binary flag indicating presence of 
 *            short_video_header; shortVideoHeader==1 selects linear intra DC 
 *            mode, and shortVideoHeader==0 selects non linear intra DC mode. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after the block is decoded, so 
 *            that it points to the current byte in the bit stream buffer 
 *   pBitOffset - *pBitOffset is updated so that it points to the current bit 
 *            position in the byte pointed by *ppBitStream 
 *   pDst - pointer to the decoded residual buffer (a contiguous array of 64 
 *            elements of OMX_S16 data type); must be aligned on a 16-byte 
 *            boundary. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments, if:
 *    -    At least one of the following pointers is Null: 
 *         ppBitStream, *ppBitStream, pBitOffset , pDst 
 *    -    *pBitOffset exceeds [0,7]
 *    -    QP <= 0. 
 *    -    pDst is not 16-byte aligned 
 *    OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter . 
 *
 */
OMXResult omxVCM4P2_DecodeBlockCoef_Inter (
    const OMX_U8 **ppBitStream,
    OMX_INT *pBitOffset,
    OMX_S16 *pDst,
    OMX_INT QP,
    OMX_INT shortVideoHeader
);



/**
 * Function:  omxVCM4P2_PredictReconCoefIntra   (6.2.5.4.3)
 *
 * Description:
 * Performs adaptive DC/AC coefficient prediction for an intra block.  Prior 
 * to the function call, prediction direction (predDir) should be selected as 
 * specified in [ISO14496-2], subclause 7.4.3.1. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the coefficient buffer which contains the quantized 
 *            coefficient residuals (PQF) of the current block; must be 
 *            aligned on a 4-byte boundary.  The output coefficients are 
 *            saturated to the range [-2048, 2047]. 
 *   pPredBufRow - pointer to the coefficient row buffer; must be aligned on 
 *            a 4-byte boundary. 
 *   pPredBufCol - pointer to the coefficient column buffer; must be aligned 
 *            on a 4-byte boundary. 
 *   curQP - quantization parameter of the current block. curQP may equal to 
 *            predQP especially when the current block and the predictor block 
 *            are in the same macroblock. 
 *   predQP - quantization parameter of the predictor block 
 *   predDir - indicates the prediction direction which takes one of the 
 *            following values: OMX_VC_HORIZONTAL - predict horizontally 
 *            OMX_VC_VERTICAL - predict vertically 
 *   ACPredFlag - a flag indicating if AC prediction should be performed. It 
 *            is equal to ac_pred_flag in the bit stream syntax of MPEG-4 
 *   videoComp - video component type (luminance or chrominance) of the 
 *            current block 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to the coefficient buffer which contains the quantized 
 *            coefficients (QF) of the current block 
 *   pPredBufRow - pointer to the updated coefficient row buffer 
 *   pPredBufCol - pointer to the updated coefficient column buffer  Note: 
 *            Buffer update: Update the AC prediction buffer (both row and 
 *            column buffer). 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments, if:
 *        -    At least one of the pointers is NULL: 
 *              pSrcDst, pPredBufRow, or pPredBufCol. 
 *        -    curQP <= 0, 
 *        -    predQP <= 0, 
 *        -    curQP >31, 
 *        -    predQP > 31, 
 *        -    preDir exceeds [1,2]
 *        -    pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned. 
 *
 */
OMXResult omxVCM4P2_PredictReconCoefIntra (
    OMX_S16 *pSrcDst,
    OMX_S16 *pPredBufRow,
    OMX_S16 *pPredBufCol,
    OMX_INT curQP,
    OMX_INT predQP,
    OMX_INT predDir,
    OMX_INT ACPredFlag,
    OMXVCM4P2VideoComponent videoComp
);



/**
 * Function:  omxVCM4P2_MCReconBlock   (6.2.5.5.1)
 *
 * Description:
 * Performs motion compensation prediction for an 8x8 block using 
 * interpolation described in [ISO14496-2], subclause 7.6.2. 
 *
 * Input Arguments:
 *   
 *   pSrc - pointer to the block in the reference plane. 
 *   srcStep - distance between the start of consecutive lines in the 
 *            reference plane, in bytes; must be a multiple of 8. 
 *   dstStep - distance between the start of consecutive lines in the 
 *            destination plane, in bytes; must be a multiple of 8. 
 *   pSrcResidue - pointer to a buffer containing the 16-bit prediction 
 *            residuals; must be 16-byte aligned. If the pointer is NULL, then 
 *            no prediction is done, only motion compensation, i.e., the block 
 *            is moved with interpolation. 
 *   predictType - bilinear interpolation type, as defined in section 
 *            6.2.1.2. 
 *   rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the destination buffer; must be 8-byte aligned.  If 
 *            prediction residuals are added then output intensities are 
 *            clipped to the range [0,255]. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following 
 *              conditions: 
 *    -    pDst is not 8-byte aligned. 
 *    -    pSrcResidue is not 16-byte aligned. 
 *    -    one or more of the following pointers is NULL: pSrc or pDst. 
 *    -    either srcStep or dstStep is not a multiple of 8. 
 *    -    invalid type specified for the parameter predictType. 
 *    -    the parameter rndVal is not equal either to 0 or 1. 
 *
 */
OMXResult omxVCM4P2_MCReconBlock (
    const OMX_U8 *pSrc,
    OMX_INT srcStep,
    const OMX_S16 *pSrcResidue,
    OMX_U8 *pDst,
    OMX_INT dstStep,
    OMX_INT predictType,
    OMX_INT rndVal
);



/* 6.3.1.1 Intra 16x16 Prediction Modes  */
/* A data type that enumerates intra_16x16 macroblock prediction modes is defined as follows:  */

typedef enum {
    OMX_VC_16X16_VERT = 0,  /** Intra_16x16_Vertical */
    OMX_VC_16X16_HOR = 1,   /** Intra_16x16_Horizontal */
    OMX_VC_16X16_DC = 2,    /** Intra_16x16_DC */
    OMX_VC_16X16_PLANE = 3  /** Intra_16x16_Plane */ 
} OMXVCM4P10Intra16x16PredMode;



/* 6.3.1.2 Intra 4x4 Prediction Modes  */
/* A data type that enumerates intra_4x4 macroblock prediction modes is defined as follows:  */

typedef enum {
    OMX_VC_4X4_VERT = 0,     /** Intra_4x4_Vertical */
    OMX_VC_4X4_HOR = 1,      /** Intra_4x4_Horizontal */
    OMX_VC_4X4_DC = 2,       /** Intra_4x4_DC */
    OMX_VC_4X4_DIAG_DL = 3,  /** Intra_4x4_Diagonal_Down_Left */
    OMX_VC_4X4_DIAG_DR = 4,  /** Intra_4x4_Diagonal_Down_Right */
    OMX_VC_4X4_VR = 5,       /** Intra_4x4_Vertical_Right */
    OMX_VC_4X4_HD = 6,       /** Intra_4x4_Horizontal_Down */
    OMX_VC_4X4_VL = 7,       /** Intra_4x4_Vertical_Left */
    OMX_VC_4X4_HU = 8        /** Intra_4x4_Horizontal_Up */ 
} OMXVCM4P10Intra4x4PredMode;



/* 6.3.1.3 Chroma Prediction Modes  */
/* A data type that enumerates intra chroma prediction modes is defined as follows:  */

typedef enum {
    OMX_VC_CHROMA_DC = 0,    /** Intra_Chroma_DC */
    OMX_VC_CHROMA_HOR = 1,   /** Intra_Chroma_Horizontal */
    OMX_VC_CHROMA_VERT = 2,  /** Intra_Chroma_Vertical */
    OMX_VC_CHROMA_PLANE = 3  /** Intra_Chroma_Plane */ 
} OMXVCM4P10IntraChromaPredMode;



/* 6.3.1.4 Motion Estimation Modes  */
/* A data type that enumerates H.264 motion estimation modes is defined as follows:  */

typedef enum {
    OMX_VC_M4P10_FAST_SEARCH = 0, /** Fast motion search */
    OMX_VC_M4P10_FULL_SEARCH = 1  /** Full motion search */ 
} OMXVCM4P10MEMode;



/* 6.3.1.5 Macroblock Types  */
/* A data type that enumerates H.264 macroblock types is defined as follows:  */

typedef enum {
    OMX_VC_P_16x16  = 0, /* defined by [ISO14496-10] */
    OMX_VC_P_16x8  = 1,
    OMX_VC_P_8x16  = 2,
    OMX_VC_P_8x8  = 3,
    OMX_VC_PREF0_8x8  = 4,
    OMX_VC_INTER_SKIP  = 5,
    OMX_VC_INTRA_4x4  = 8,
    OMX_VC_INTRA_16x16  = 9,
    OMX_VC_INTRA_PCM = 10 
} OMXVCM4P10MacroblockType;



/* 6.3.1.6 Sub-Macroblock Types  */
/* A data type that enumerates H.264 sub-macroblock types is defined as follows:  */

typedef enum {
    OMX_VC_SUB_P_8x8 = 0, /* defined by [ISO14496-10] */
    OMX_VC_SUB_P_8x4 = 1,
    OMX_VC_SUB_P_4x8 = 2,
    OMX_VC_SUB_P_4x4 = 3 
} OMXVCM4P10SubMacroblockType;



/* 6.3.1.7 Variable Length Coding (VLC) Information  */

typedef struct {
    OMX_U8 uTrailing_Ones;      /* Trailing ones; 3 at most */
    OMX_U8 uTrailing_One_Signs; /* Trailing ones signal */
    OMX_U8 uNumCoeffs;          /* Total number of non-zero coefs, including trailing ones */
    OMX_U8 uTotalZeros;         /* Total number of zero coefs */
    OMX_S16 iLevels[16];        /* Levels of non-zero coefs, in reverse zig-zag order */
    OMX_U8 uRuns[16];           /* Runs for levels and trailing ones, in reverse zig-zag order */
} OMXVCM4P10VLCInfo;



/* 6.3.1.8 Macroblock Information  */

typedef struct {
    OMX_S32 sliceId;                          /* slice number */
    OMXVCM4P10MacroblockType mbType;          /* MB type */
    OMXVCM4P10SubMacroblockType subMBType[4]; /* sub-block type */
    OMX_S32 qpy;                              /* qp for luma */
    OMX_S32 qpc;                              /* qp for chroma */
    OMX_U32 cbpy;                             /* CBP Luma */
    OMX_U32 cbpc;                             /* CBP Chroma */
    OMXVCMotionVector pMV0[4][4]; /* motion vector, represented using 1/4-pel units, pMV0[blocky][blockx] (blocky = 0~3, blockx =0~3) */
    OMXVCMotionVector pMVPred[4][4]; /* motion vector prediction, Represented using 1/4-pel units, pMVPred[blocky][blockx] (blocky = 0~3, blockx = 0~3) */
    OMX_U8 pRefL0Idx[4];                      /* reference picture indices */
    OMXVCM4P10Intra16x16PredMode Intra16x16PredMode; /* best intra 16x16 prediction mode */
    OMXVCM4P10Intra4x4PredMode pIntra4x4PredMode[16]; /* best intra 4x4 prediction mode for each block, pMV0 indexed as above */
} OMXVCM4P10MBInfo, *OMXVCM4P10MBInfoPtr;



/* 6.3.1.9 Motion Estimation Parameters  */

typedef struct {
    OMX_S32 blockSplitEnable8x8; /* enables 16x8, 8x16, 8x8 */
    OMX_S32 blockSplitEnable4x4; /* enable splitting of 8x4, 4x8, 4x4 blocks */
    OMX_S32 halfSearchEnable;
    OMX_S32 quarterSearchEnable;
    OMX_S32 intraEnable4x4;      /* 1=enable, 0=disable */
    OMX_S32 searchRange16x16;    /* integer pixel units */
    OMX_S32 searchRange8x8;
    OMX_S32 searchRange4x4;
} OMXVCM4P10MEParams;



/**
 * Function:  omxVCM4P10_PredictIntra_4x4   (6.3.3.1.1)
 *
 * Description:
 * Perform Intra_4x4 prediction for luma samples. If the upper-right block is 
 * not available, then duplication work should be handled inside the function. 
 * Users need not define them outside. 
 *
 * Input Arguments:
 *   
 *   pSrcLeft -  Pointer to the buffer of 4 left pixels: 
 *                  p[x, y] (x = -1, y = 0..3) 
 *   pSrcAbove - Pointer to the buffer of 8 above pixels: 
 *                  p[x,y] (x = 0..7, y =-1); 
 *               must be aligned on a 4-byte boundary. 
 *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1) 
 *   leftStep - Step of left pixel buffer; must be a multiple of 4. 
 *   dstStep - Step of the destination buffer; must be a multiple of 4. 
 *   predMode - Intra_4x4 prediction mode. 
 *   availability - Neighboring 4x4 block availability flag, refer to 
 *             "Neighboring Macroblock Availability" . 
 *
 * Output Arguments:
 *   
 *   pDst - Pointer to the destination buffer; must be aligned on a 4-byte 
 *            boundary. 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If one of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    pDst is NULL. 
 *    dstStep < 4, or dstStep is not a multiple of 4. 
 *    leftStep is not a multiple of 4. 
 *    predMode is not in the valid range of enumeration 
 *              OMXVCM4P10Intra4x4PredMode. 
 *    predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER 
 *              indicating p[x,-1] (x = 0..3) is not available. 
 *    predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT 
 *              indicating p[-1,y] (y = 0..3) is not available. 
 *    predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set 
 *              OMX_VC_UPPER indicating p[x, -1] (x = 0..3) is not available. 
 *    predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set 
 *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 
 *              p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not 
 *              available. 
 *    predMode is OMX_VC_4x4_VR, but availability doesn't set 
 *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 
 *              p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not 
 *              available. 
 *    predMode is OMX_VC_4x4_HD, but availability doesn't set 
 *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 
 *              p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not 
 *              available. 
 *    predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER 
 *              indicating p[x,-1] (x = 0..3) is not available. 
 *    predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT 
 *              indicating p[-1,y] (y = 0..3) is not available. 
 *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL. 
 *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL. 
 *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL. 
 *    either pSrcAbove or pDst is not aligned on a 4-byte boundary.  
 *
 * Note: 
 *     pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if 
 *     they are not used by intra prediction as implied in predMode. 
 *
 */
OMXResult omxVCM4P10_PredictIntra_4x4 (
    const OMX_U8 *pSrcLeft,
    const OMX_U8 *pSrcAbove,
    const OMX_U8 *pSrcAboveLeft,
    OMX_U8 *pDst,
    OMX_INT leftStep,
    OMX_INT dstStep,
    OMXVCM4P10Intra4x4PredMode predMode,
    OMX_S32 availability
);



/**
 * Function:  omxVCM4P10_PredictIntra_16x16   (6.3.3.1.2)
 *
 * Description:
 * Perform Intra_16x16 prediction for luma samples. If the upper-right block 
 * is not available, then duplication work should be handled inside the 
 * function. Users need not define them outside. 
 *
 * Input Arguments:
 *   
 *   pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y = 
 *            0..15) 
 *   pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15, 
 *            y= -1); must be aligned on a 16-byte boundary. 
 *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1) 
 *   leftStep - Step of left pixel buffer; must be a multiple of 16. 
 *   dstStep - Step of the destination buffer; must be a multiple of 16. 
 *   predMode - Intra_16x16 prediction mode, please refer to section 3.4.1. 
 *   availability - Neighboring 16x16 MB availability flag. Refer to 
 *                  section 3.4.4. 
 *
 * Output Arguments:
 *   
 *   pDst -Pointer to the destination buffer; must be aligned on a 16-byte 
 *            boundary. 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If one of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    pDst is NULL. 
 *    dstStep < 16. or dstStep is not a multiple of 16. 
 *    leftStep is not a multiple of 16. 
 *    predMode is not in the valid range of enumeration 
 *              OMXVCM4P10Intra16x16PredMode 
 *    predMode is OMX_VC_16X16_VERT, but availability doesn't set 
 *              OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available. 
 *    predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT 
 *              indicating p[-1,y] (y = 0..15) is not available. 
 *    predMode is OMX_VC_16X16_PLANE, but availability doesn't set 
 *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 
 *              p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not 
 *              available. 
 *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL. 
 *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL. 
 *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL. 
 *    either pSrcAbove or pDst is not aligned on a 16-byte boundary.  
 *
 * Note: 
 *     pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if 
 *     they are not used by intra prediction implied in predMode. 
 * Note: 
 *     OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction. 
 *
 */
OMXResult omxVCM4P10_PredictIntra_16x16 (
    const OMX_U8 *pSrcLeft,
    const OMX_U8 *pSrcAbove,
    const OMX_U8 *pSrcAboveLeft,
    OMX_U8 *pDst,
    OMX_INT leftStep,
    OMX_INT dstStep,
    OMXVCM4P10Intra16x16PredMode predMode,
    OMX_S32 availability
);



/**
 * Function:  omxVCM4P10_PredictIntraChroma_8x8   (6.3.3.1.3)
 *
 * Description:
 * Performs intra prediction for chroma samples. 
 *
 * Input Arguments:
 *   
 *   pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y= 
 *            0..7). 
 *   pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y 
 *            = -1); must be aligned on an 8-byte boundary. 
 *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1) 
 *   leftStep - Step of left pixel buffer; must be a multiple of 8. 
 *   dstStep - Step of the destination buffer; must be a multiple of 8. 
 *   predMode - Intra chroma prediction mode, please refer to section 3.4.3. 
 *   availability - Neighboring chroma block availability flag, please refer 
 *            to  "Neighboring Macroblock Availability". 
 *
 * Output Arguments:
 *   
 *   pDst - Pointer to the destination buffer; must be aligned on an 8-byte 
 *            boundary. 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If any of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    pDst is NULL. 
 *    dstStep < 8 or dstStep is not a multiple of 8. 
 *    leftStep is not a multiple of 8. 
 *    predMode is not in the valid range of enumeration 
 *              OMXVCM4P10IntraChromaPredMode. 
 *    predMode is OMX_VC_CHROMA_VERT, but availability doesn't set 
 *              OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available. 
 *    predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT 
 *              indicating p[-1,y] (y = 0..7) is not available. 
 *    predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set 
 *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 
 *              p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not 
 *              available. 
 *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL. 
 *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL. 
 *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL. 
 *    either pSrcAbove or pDst is not aligned on a 8-byte boundary.  
 *
 *  Note: pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if 
 *  they are not used by intra prediction implied in predMode. 
 *
 *  Note: OMX_VC_UPPER_RIGHT is not used in intra chroma prediction. 
 *
 */
OMXResult omxVCM4P10_PredictIntraChroma_8x8 (
    const OMX_U8 *pSrcLeft,
    const OMX_U8 *pSrcAbove,
    const OMX_U8 *pSrcAboveLeft,
    OMX_U8 *pDst,
    OMX_INT leftStep,
    OMX_INT dstStep,
    OMXVCM4P10IntraChromaPredMode predMode,
    OMX_S32 availability
);



/**
 * Function:  omxVCM4P10_InterpolateLuma   (6.3.3.2.1)
 *
 * Description:
 * Performs quarter-pixel interpolation for inter luma MB. It is assumed that 
 * the frame is already padded when calling this function. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the source reference frame buffer 
 *   srcStep - reference frame step, in bytes; must be a multiple of roi.width 
 *   dstStep - destination frame step, in bytes; must be a multiple of 
 *            roi.width 
 *   dx - Fractional part of horizontal motion vector component in 1/4 pixel 
 *            unit; valid in the range [0,3] 
 *   dy - Fractional part of vertical motion vector y component in 1/4 pixel 
 *            unit; valid in the range [0,3] 
 *   roi - Dimension of the interpolation region; the parameters roi.width and 
 *            roi.height must be equal to either 4, 8, or 16. 
 *
 * Output Arguments:
 *   
 *   pDst - Pointer to the destination frame buffer: 
 *          if roi.width==4,  4-byte alignment required 
 *          if roi.width==8,  8-byte alignment required 
 *          if roi.width==16, 16-byte alignment required 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If one of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    pSrc or pDst is NULL. 
 *    srcStep or dstStep < roi.width. 
 *    dx or dy is out of range [0,3]. 
 *    roi.width or roi.height is out of range {4, 8, 16}. 
 *    roi.width is equal to 4, but pDst is not 4 byte aligned. 
 *    roi.width is equal to 8 or 16, but pDst is not 8 byte aligned. 
 *    srcStep or dstStep is not a multiple of 8. 
 *
 */
OMXResult omxVCM4P10_InterpolateLuma (
    const OMX_U8 *pSrc,
    OMX_S32 srcStep,
    OMX_U8 *pDst,
    OMX_S32 dstStep,
    OMX_S32 dx,
    OMX_S32 dy,
    OMXSize roi
);



/**
 * Function:  omxVCM4P10_InterpolateChroma   (6.3.3.2.2)
 *
 * Description:
 * Performs 1/8-pixel interpolation for inter chroma MB. 
 *
 * Input Arguments:
 *   
 *   pSrc -Pointer to the source reference frame buffer 
 *   srcStep -Reference frame step in bytes 
 *   dstStep -Destination frame step in bytes; must be a multiple of 
 *            roi.width. 
 *   dx -Fractional part of horizontal motion vector component in 1/8 pixel 
 *            unit; valid in the range [0,7] 
 *   dy -Fractional part of vertical motion vector component in 1/8 pixel 
 *            unit; valid in the range [0,7] 
 *   roi -Dimension of the interpolation region; the parameters roi.width and 
 *            roi.height must be equal to either 2, 4, or 8. 
 *
 * Output Arguments:
 *   
 *   pDst -Pointer to the destination frame buffer:
 *         if roi.width==2,  2-byte alignment required 
 *         if roi.width==4,  4-byte alignment required 
 *         if roi.width==8, 8-byte alignment required 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If one of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    pSrc or pDst is NULL. 
 *    srcStep or dstStep < 8. 
 *    dx or dy is out of range [0-7]. 
 *    roi.width or roi.height is out of range {2,4,8}. 
 *    roi.width is equal to 2, but pDst is not 2-byte aligned. 
 *    roi.width is equal to 4, but pDst is not 4-byte aligned. 
 *    roi.width is equal to 8, but pDst is not 8 byte aligned. 
 *    srcStep or dstStep is not a multiple of 8. 
 *
 */
OMXResult omxVCM4P10_InterpolateChroma (
    const OMX_U8 *pSrc,
    OMX_S32 srcStep,
    OMX_U8 *pDst,
    OMX_S32 dstStep,
    OMX_S32 dx,
    OMX_S32 dy,
    OMXSize roi
);



/**
 * Function:  omxVCM4P10_FilterDeblockingLuma_VerEdge_I   (6.3.3.3.1)
 *
 * Description:
 * Performs in-place deblock filtering on four vertical edges of the luma 
 * macroblock (16x16). 
 *
 * Input Arguments:
 *   
 *   pSrcDst - Pointer to the input macroblock; must be 16-byte aligned. 
 *   srcdstStep -Step of the arrays; must be a multiple of 16. 
 *   pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha 
 *            threshold for the external vertical edge, and the second item is 
 *            for the internal vertical edge); per [ISO14496-10] alpha values 
 *            must be in the range [0,255]. 
 *   pBeta -Array of size 2 of beta thresholds (the first item is the beta 
 *            threshold for the external vertical edge, and the second item is 
 *            for the internal vertical edge); per [ISO14496-10] beta values 
 *            must be in the range [0,18]. 
 *   pThresholds -Array of size 16 of Thresholds (TC0) (values for the left 
 *            edge of each 4x4 block, arranged in vertical block order); must 
 *            be aligned on a 4-byte boundary..  Per [ISO14496-10] values must 
 *            be in the range [0,25]. 
 *   pBS -Array of size 16 of BS parameters (arranged in vertical block 
 *            order); valid in the range [0,4] with the following 
 *            restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) 
 *            pBS[i]== 4 if and only if pBS[i^3]== 4.  Must be 4-byte aligned. 
 *
 * Output Arguments:
 *   
 *   pSrcDst -Pointer to filtered output macroblock. 
 *
 * Return Value:
 *    If the function runs without error, it returns OMX_Sts_NoErr. 
 *    If one of the following cases occurs, the function returns 
 *              OMX_Sts_BadArgErr: 
 *    Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS 
 *              is NULL. 
 *    Either pThresholds or pBS is not aligned on a 4-byte boundary. 
 *    pSrcDst is not 16-byte aligned. 
 *    srcdstStep is not a multiple of 16. 
 *    pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 
 *    pBeta[0] and/or pBeta[1] is outside the range [0,18]. 
 *    One or more entries in the table pThresholds[0..15]is outside of the 
 *              range [0,25]. 
 *    pBS is out of range, i.e., one of the following conditions is true: 
 *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && 
 *              pBS[i^3]!=4) for 0<=i<=3. 
 *
 */
OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I (
    OMX_U8 *pSrcDst,
    OMX_S32 srcdstStep,
    const OMX_U8 *pAlpha,
    const OMX_U8 *pBeta,
    const OMX_U8 *pThresholds,
    const OMX_U8 *pBS
);



/**
 * Function:  omxVCM4P10_FilterDeblockingLuma_HorEdge_I   (6.3.3.3.2)
 *
 * Description:
 * Performs in-place deblock filtering on four horizontal edges of the luma 
 * macroblock (16x16). 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input macroblock; must be 16-byte aligned. 
 *   srcdstStep - step of the arrays; must be a multiple of 16. 
 *   pAlpha - array of size 2 of alpha thresholds (the first item is the alpha 
 *            threshold for the external vertical edge, and the second item is 
 *            for the internal horizontal edge); per [ISO14496-10] alpha 
 *            values must be in the range [0,255]. 
 *   pBeta - array of size 2 of beta thresholds (the first item is the beta 
 *            threshold for the external horizontal edge, and the second item 
 *            is for the internal horizontal edge). Per [ISO14496-10] beta 
 *            values must be in the range [0,18]. 
 *   pThresholds - array of size 16 containing thresholds, TC0, for the top 
 *            horizontal edge of each 4x4 block, arranged in horizontal block 
 *            order; must be aligned on a 4-byte boundary.  Per [ISO14496 10] 
 *            values must be in the range [0,25]. 
 *   pBS - array of size 16 of BS parameters (arranged in horizontal block 
 *            order); valid in the range [0,4] with the following 
 *            restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) 
 *            pBS[i]== 4 if and only if pBS[i^3]== 4.  Must be 4-byte aligned. 
 *
 * Output Arguments:
 *   
 *   pSrcDst -Pointer to filtered output macroblock. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr, if the function runs without error.
 * 
 *    OMX_Sts_BadArgErr, if one of the following cases occurs: 
 *    -    one or more of the following pointers is NULL: pSrcDst, pAlpha, 
 *              pBeta, pThresholds, or pBS. 
 *    -    either pThresholds or pBS is not aligned on a 4-byte boundary. 
 *    -    pSrcDst is not 16-byte aligned. 
 *    -    srcdstStep is not a multiple of 16. 
 *    -    pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 
 *    -    pBeta[0] and/or pBeta[1] is outside the range [0,18]. 
 *    -    One or more entries in the table pThresholds[0..15] is 
 *         outside of the range [0,25]. 
 *    -    pBS is out of range, i.e., one of the following conditions is true: 
 *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 
 *              (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 
 *
 */
OMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I (
    OMX_U8 *pSrcDst,
    OMX_S32 srcdstStep,
    const OMX_U8 *pAlpha,
    const OMX_U8 *pBeta,
    const OMX_U8 *pThresholds,
    const OMX_U8 *pBS
);



/**
 * Function:  omxVCM4P10_FilterDeblockingChroma_VerEdge_I   (6.3.3.3.3)
 *
 * Description:
 * Performs in-place deblock filtering on four vertical edges of the chroma 
 * macroblock (8x8). 
 *
 * Input Arguments:
 *   
 *   pSrcDst - Pointer to the input macroblock; must be 8-byte aligned. 
 *   srcdstStep - Step of the arrays; must be a multiple of 8. 
 *   pAlpha - Array of size 2 of alpha thresholds (the first item is alpha 
 *            threshold for external vertical edge, and the second item is for 
 *            internal vertical edge); per [ISO14496-10] alpha values must be 
 *            in the range [0,255]. 
 *   pBeta - Array of size 2 of beta thresholds (the first item is the beta 
 *            threshold for the external vertical edge, and the second item is 
 *            for the internal vertical edge); per [ISO14496-10] beta values 
 *            must be in the range [0,18]. 
 *   pThresholds - Array of size 8 containing thresholds, TC0, for the left 
 *            vertical edge of each 4x2 chroma block, arranged in vertical 
 *            block order; must be aligned on a 4-byte boundary.  Per 
 *            [ISO14496-10] values must be in the range [0,25]. 
 *   pBS - Array of size 16 of BS parameters (values for each 2x2 chroma 
 *            block, arranged in vertical block order). This parameter is the 
 *            same as the pBS parameter passed into FilterDeblockLuma_VerEdge; 
 *            valid in the range [0,4] with the following restrictions: i) 
 *            pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and 
 *            only if pBS[i^3]== 4.  Must be 4 byte aligned. 
 *
 * Output Arguments:
 *   
 *   pSrcDst -Pointer to filtered output macroblock. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr, if the function runs without error.
 * 
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    one or more of the following pointers is NULL: pSrcDst, pAlpha, 
 *              pBeta, pThresholds, or pBS. 
 *    -    pSrcDst is not 8-byte aligned. 
 *    -    srcdstStep is not a multiple of 8. 
 *    -    pThresholds is not 4-byte aligned. 
 *    -    pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 
 *    -    pBeta[0] and/or pBeta[1] is outside the range [0,18]. 
 *    -    One or more entries in the table pThresholds[0..7] is outside 
 *         of the range [0,25]. 
 *    -    pBS is out of range, i.e., one of the following conditions is true: 
 *         pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 
 *         (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 
 *    -    pBS is not 4-byte aligned. 
 *
 */
OMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I (
    OMX_U8 *pSrcDst,
    OMX_S32 srcdstStep,
    const OMX_U8 *pAlpha,
    const OMX_U8 *pBeta,
    const OMX_U8 *pThresholds,
    const OMX_U8 *pBS
);



/**
 * Function:  omxVCM4P10_FilterDeblockingChroma_HorEdge_I   (6.3.3.3.4)
 *
 * Description:
 * Performs in-place deblock filtering on the horizontal edges of the chroma 
 * macroblock (8x8). 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input macroblock; must be 8-byte aligned. 
 *   srcdstStep - array step; must be a multiple of 8. 
 *   pAlpha - array of size 2 containing alpha thresholds; the first element 
 *            contains the threshold for the external horizontal edge, and the 
 *            second element contains the threshold for internal horizontal 
 *            edge.  Per [ISO14496-10] alpha values must be in the range 
 *            [0,255]. 
 *   pBeta - array of size 2 containing beta thresholds; the first element 
 *            contains the threshold for the external horizontal edge, and the 
 *            second element contains the threshold for the internal 
 *            horizontal edge.  Per [ISO14496-10] beta values must be in the 
 *            range [0,18]. 
 *   pThresholds - array of size 8 containing thresholds, TC0, for the top 
 *            horizontal edge of each 2x4 chroma block, arranged in horizontal 
 *            block order; must be aligned on a 4-byte boundary.  Per 
 *            [ISO14496-10] values must be in the range [0,25]. 
 *   pBS - array of size 16 containing BS parameters for each 2x2 chroma 
 *            block, arranged in horizontal block order; valid in the range 
 *            [0,4] with the following restrictions: i) pBS[i]== 4 may occur 
 *            only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4. 
 *            Must be 4-byte aligned. 
 *
 * Output Arguments:
 *   
 *   pSrcDst -Pointer to filtered output macroblock. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr, if the function runs without error.
 * 
 *    OMX_Sts_BadArgErr, if one of the following cases occurs: 
 *    -    any of the following pointers is NULL: 
 *         pSrcDst, pAlpha, pBeta, pThresholds, or pBS. 
 *    -    pSrcDst is not 8-byte aligned. 
 *    -    srcdstStep is not a multiple of 8. 
 *    -    pThresholds is not 4-byte aligned. 
 *    -    pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 
 *    -    pBeta[0] and/or pBeta[1] is outside the range [0,18]. 
 *    -    One or more entries in the table pThresholds[0..7] is outside 
 *         of the range [0,25]. 
 *    -    pBS is out of range, i.e., one of the following conditions is true: 
 *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 
 *              (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
 *    -    pBS is not 4-byte aligned. 
 *
 */
OMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I (
    OMX_U8 *pSrcDst,
    OMX_S32 srcdstStep,
    const OMX_U8 *pAlpha,
    const OMX_U8 *pBeta,
    const OMX_U8 *pThresholds,
    const OMX_U8 *pBS
);



/**
 * Function:  omxVCM4P10_DeblockLuma_I   (6.3.3.3.5)
 *
 * Description:
 * This function performs in-place deblock filtering the horizontal and 
 * vertical edges of a luma macroblock (16x16). 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input macroblock; must be 16-byte aligned. 
 *   srcdstStep - image width; must be a multiple of 16. 
 *   pAlpha - pointer to a 2x2 table of alpha thresholds, organized as 
 *            follows: {external vertical edge, internal vertical edge, 
 *            external horizontal edge, internal horizontal edge }.  Per 
 *            [ISO14496-10] alpha values must be in the range [0,255]. 
 *   pBeta - pointer to a 2x2 table of beta thresholds, organized as follows: 
 *            {external vertical edge, internal vertical edge, external 
 *            horizontal edge, internal horizontal edge }.  Per [ISO14496-10] 
 *            beta values must be in the range [0,18]. 
 *   pThresholds - pointer to a 16x2 table of threshold (TC0), organized as 
 *            follows: {values for the left or above edge of each 4x4 block, 
 *            arranged in vertical block order and then in horizontal block 
 *            order}; must be aligned on a 4-byte boundary.  Per [ISO14496-10] 
 *            values must be in the range [0,25]. 
 *   pBS - pointer to a 16x2 table of BS parameters arranged in scan block 
 *            order for vertical edges and then horizontal edges; valid in the 
 *            range [0,4] with the following restrictions: i) pBS[i]== 4 may 
 *            occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 
 *            4. Must be 4-byte aligned. 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to filtered output macroblock. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments 
 *    -     one or more of the following pointers is NULL: pSrcDst, pAlpha, 
 *              pBeta, pThresholds or pBS. 
 *    -    pSrcDst is not 16-byte aligned. 
 *    -    either pThresholds or pBS is not aligned on a 4-byte boundary. 
 *    -    one or more entries in the table pAlpha[0..3] is outside the range 
 *              [0,255]. 
 *    -    one or more entries in the table pBeta[0..3] is outside the range 
 *              [0,18]. 
 *    -    one or more entries in the table pThresholds[0..31]is outside of 
 *              the range [0,25]. 
 *    -    pBS is out of range, i.e., one of the following conditions is true: 
 *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 
 *             (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 
 *    -    srcdstStep is not a multiple of 16. 
 *
 */
OMXResult omxVCM4P10_DeblockLuma_I (
    OMX_U8 *pSrcDst,
    OMX_S32 srcdstStep,
    const OMX_U8 *pAlpha,
    const OMX_U8 *pBeta,
    const OMX_U8 *pThresholds,
    const OMX_U8 *pBS
);



/**
 * Function:  omxVCM4P10_DeblockChroma_I   (6.3.3.3.6)
 *
 * Description:
 * Performs in-place deblocking filtering on all edges of the chroma 
 * macroblock (16x16). 
 *
 * Input Arguments:
 *   
 *   pSrcDst - pointer to the input macroblock; must be 8-byte aligned. 
 *   srcdstStep - step of the arrays; must be a multiple of 8. 
 *   pAlpha - pointer to a 2x2 array of alpha thresholds, organized as 
 *            follows: {external vertical edge, internal vertical edge, 
 *            external horizontal edge, internal horizontal edge }.  Per 
 *            [ISO14496-10] alpha values must be in the range [0,255]. 
 *   pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows: 
 *            { external vertical edge, internal vertical edge, external 
 *            horizontal edge, internal horizontal edge }.  Per [ISO14496-10] 
 *            beta values must be in the range [0,18]. 
 *   pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left 
 *            or above edge of each 4x2 or 2x4 block, arranged in vertical 
 *            block order and then in horizontal block order); must be aligned 
 *            on a 4-byte boundary. Per [ISO14496-10] values must be in the 
 *            range [0,25]. 
 *   pBS - array of size 16x2 of BS parameters (arranged in scan block order 
 *            for vertical edges and then horizontal edges); valid in the 
 *            range [0,4] with the following restrictions: i) pBS[i]== 4 may 
 *            occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 
 *            4.  Must be 4-byte aligned. 
 *
 * Output Arguments:
 *   
 *   pSrcDst - pointer to filtered output macroblock. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments 
 *    -   one or more of the following pointers is NULL: pSrcDst, pAlpha, 
 *              pBeta, pThresholds, or pBS. 
 *    -   pSrcDst is not 8-byte aligned. 
 *    -   either pThresholds or pBS is not 4-byte aligned. 
 *    -   one or more entries in the table pAlpha[0..3] is outside the range 
 *              [0,255]. 
 *    -   one or more entries in the table pBeta[0..3] is outside the range 
 *              [0,18]. 
 *    -   one or more entries in the table pThresholds[0..15]is outside of 
 *              the range [0,25]. 
 *    -   pBS is out of range, i.e., one of the following conditions is true: 
 *            pBS[i]<0, pBS[i]>4, pBS[i]==4  for i>=4, or 
 *            (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 
 *    -   srcdstStep is not a multiple of 8. 
 *
 */
OMXResult omxVCM4P10_DeblockChroma_I (
    OMX_U8 *pSrcDst,
    OMX_S32 srcdstStep,
    const OMX_U8 *pAlpha,
    const OMX_U8 *pBeta,
    const OMX_U8 *pThresholds,
    const OMX_U8 *pBS
);



/**
 * Function:  omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC   (6.3.4.1.1)
 *
 * Description:
 * Performs CAVLC decoding and inverse raster scan for a 2x2 block of 
 * ChromaDCLevel.  The decoded coefficients in the packed position-coefficient 
 * buffer are stored in reverse zig-zag order, i.e., the first buffer element 
 * contains the last non-zero postion-coefficient pair of the block. Within 
 * each position-coefficient pair, the position entry indicates the 
 * raster-scan position of the coefficient, while the coefficient entry 
 * contains the coefficient value. 
 *
 * Input Arguments:
 *   
 *   ppBitStream - Double pointer to current byte in bit stream buffer 
 *   pOffset - Pointer to current bit position in the byte pointed to by 
 *            *ppBitStream; valid in the range [0,7]. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after each block is decoded 
 *   pOffset - *pOffset is updated after each block is decoded 
 *   pNumCoeff - Pointer to the number of nonzero coefficients in this block 
 *   ppPosCoefBuf - Double pointer to destination residual 
 *            coefficient-position pair buffer.  Buffer position 
 *            (*ppPosCoefBuf) is updated upon return, unless there are only 
 *            zero coefficients in the currently decoded block.  In this case 
 *            the caller is expected to bypass the transform/dequantization of 
 *            the empty blocks. 
 *
 * Return Value:
 *
 *    OMX_Sts_NoErr, if the function runs without error.
 * 
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    ppBitStream or pOffset is NULL. 
 *    -    ppPosCoefBuf or pNumCoeff is NULL. 
 *    OMX_Sts_Err - if one of the following is true: 
 *    -    an illegal code is encountered in the bitstream 
 *
 */
OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
    const OMX_U8 **ppBitStream,
    OMX_S32*pOffset,
    OMX_U8 *pNumCoeff,
    OMX_U8 **ppPosCoefbuf
);



/**
 * Function:  omxVCM4P10_DecodeCoeffsToPairCAVLC   (6.3.4.1.2)
 *
 * Description:
 * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of 
 * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse 
 * field scan is not supported. The decoded coefficients in the packed 
 * position-coefficient buffer are stored in reverse zig-zag order, i.e., the 
 * first buffer element contains the last non-zero postion-coefficient pair of 
 * the block. Within each position-coefficient pair, the position entry 
 * indicates the raster-scan position of the coefficient, while the 
 * coefficient entry contains the coefficient value. 
 *
 * Input Arguments:
 *   
 *   ppBitStream -Double pointer to current byte in bit stream buffer 
 *   pOffset - Pointer to current bit position in the byte pointed to by 
 *            *ppBitStream; valid in the range [0,7]. 
 *   sMaxNumCoeff - Maximum the number of non-zero coefficients in current 
 *            block 
 *   sVLCSelect - VLC table selector, obtained from the number of non-zero 
 *            coefficients contained in the above and left 4x4 blocks.  It is 
 *            equivalent to the variable nC described in H.264 standard table 
 *            9 5, except its value can t be less than zero. 
 *
 * Output Arguments:
 *   
 *   ppBitStream - *ppBitStream is updated after each block is decoded.  
 *            Buffer position (*ppPosCoefBuf) is updated upon return, unless 
 *            there are only zero coefficients in the currently decoded block. 
 *             In this case the caller is expected to bypass the 
 *            transform/dequantization of the empty blocks. 
 *   pOffset - *pOffset is updated after each block is decoded 
 *   pNumCoeff - Pointer to the number of nonzero coefficients in this block 
 *   ppPosCoefBuf - Double pointer to destination residual 
 *            coefficient-position pair buffer 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 * 
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    ppBitStream or pOffset is NULL. 
 *    -    ppPosCoefBuf or pNumCoeff is NULL. 
 *    -    sMaxNumCoeff is not equal to either 15 or 16. 
 *    -    sVLCSelect is less than 0. 
 *
 *    OMX_Sts_Err - if one of the following is true: 
 *    -    an illegal code is encountered in the bitstream 
 *
 */
OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC (
    const OMX_U8 **ppBitStream,
    OMX_S32 *pOffset,
    OMX_U8 *pNumCoeff,
    OMX_U8 **ppPosCoefbuf,
    OMX_INT sVLCSelect,
    OMX_INT sMaxNumCoeff
);



/**
 * Function:  omxVCM4P10_TransformDequantLumaDCFromPair   (6.3.4.2.1)
 *
 * Description:
 * Reconstructs the 4x4 LumaDC block from the coefficient-position pair 
 * buffer, performs integer inverse, and dequantization for 4x4 LumaDC 
 * coefficients, and updates the pair buffer pointer to the next non-empty 
 * block. 
 *
 * Input Arguments:
 *   
 *   ppSrc - Double pointer to residual coefficient-position pair buffer 
 *            output by CALVC decoding 
 *   QP - Quantization parameter QpY 
 *
 * Output Arguments:
 *   
 *   ppSrc - *ppSrc is updated to the start of next non empty block 
 *   pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must 
 *            be aligned on a 8-byte boundary. 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    ppSrc or pDst is NULL. 
 *    -    pDst is not 8 byte aligned. 
 *    -    QP is not in the range of [0-51]. 
 *
 */
OMXResult omxVCM4P10_TransformDequantLumaDCFromPair (
    const OMX_U8 **ppSrc,
    OMX_S16 *pDst,
    OMX_INT QP
);



/**
 * Function:  omxVCM4P10_TransformDequantChromaDCFromPair   (6.3.4.2.2)
 *
 * Description:
 * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer, 
 * perform integer inverse transformation, and dequantization for 2x2 chroma 
 * DC coefficients, and update the pair buffer pointer to next non-empty 
 * block. 
 *
 * Input Arguments:
 *   
 *   ppSrc - Double pointer to residual coefficient-position pair buffer 
 *            output by CALVC decoding 
 *   QP - Quantization parameter QpC 
 *
 * Output Arguments:
 *   
 *   ppSrc - *ppSrc is updated to the start of next non empty block 
 *   pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer; 
 *            must be aligned on a 4-byte boundary. 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    ppSrc or pDst is NULL. 
 *    -    pDst is not 4-byte aligned. 
 *    -    QP is not in the range of [0-51]. 
 *
 */
OMXResult omxVCM4P10_TransformDequantChromaDCFromPair (
    const OMX_U8 **ppSrc,
    OMX_S16 *pDst,
    OMX_INT QP
);



/**
 * Function:  omxVCM4P10_DequantTransformResidualFromPairAndAdd   (6.3.4.2.3)
 *
 * Description:
 * Reconstruct the 4x4 residual block from coefficient-position pair buffer, 
 * perform dequantization and integer inverse transformation for 4x4 block of 
 * residuals with previous intra prediction or motion compensation data, and 
 * update the pair buffer pointer to next non-empty block. If pDC == NULL, 
 * there re 16 non-zero AC coefficients at most in the packed buffer starting 
 * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC 
 * coefficients at most in the packet buffer starting from 4x4 block position 
 * 1. 
 *
 * Input Arguments:
 *   
 *   ppSrc - Double pointer to residual coefficient-position pair buffer 
 *            output by CALVC decoding 
 *   pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte 
 *            boundary 
 *   predStep - Predicted frame step size in bytes; must be a multiple of 4 
 *   dstStep - Destination frame step in bytes; must be a multiple of 4 
 *   pDC - Pointer to the DC coefficient of this block, NULL if it doesn't 
 *            exist 
 *   QP - QP Quantization parameter.  It should be QpC in chroma 4x4 block 
 *            decoding, otherwise it should be QpY. 
 *   AC - Flag indicating if at least one non-zero AC coefficient exists 
 *
 * Output Arguments:
 *   
 *   pDst - pointer to the reconstructed 4x4 block data; must be aligned on a 
 *            4-byte boundary 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    pPred or pDst is NULL. 
 *    -    pPred or pDst is not 4-byte aligned. 
 *    -    predStep or dstStep is not a multiple of 4. 
 *    -    AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL. 
 *    -    AC ==0 && pDC ==NULL. 
 *
 */
OMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd (
    const OMX_U8 **ppSrc,
    const OMX_U8 *pPred,
    const OMX_S16 *pDC,
    OMX_U8 *pDst,
    OMX_INT predStep,
    OMX_INT dstStep,
    OMX_INT QP,
    OMX_INT AC
);



/**
 * Function:  omxVCM4P10_MEGetBufSize   (6.3.5.1.1)
 *
 * Description:
 * Computes the size, in bytes, of the vendor-specific specification 
 * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer 
 * and MotionEstimationMB. 
 *
 * Input Arguments:
 *   
 *   MEmode - motion estimation mode; available modes are defined by the 
 *            enumerated type OMXVCM4P10MEMode 
 *   pMEParams -motion estimation parameters 
 *
 * Output Arguments:
 *   
 *   pSize - pointer to the number of bytes required for the motion 
 *            estimation specification structure 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    pMEParams or pSize is NULL. 
 *    -    an invalid MEMode is specified. 
 *
 */
OMXResult omxVCM4P10_MEGetBufSize (
    OMXVCM4P10MEMode MEmode,
    const OMXVCM4P10MEParams *pMEParams,
    OMX_U32 *pSize
);



/**
 * Function:  omxVCM4P10_MEInit   (6.3.5.1.2)
 *
 * Description:
 * Initializes the vendor-specific specification structure required for the 
 * omxVCM4P10 motion estimation functions:  BlockMatch_Integer and 
 * MotionEstimationMB. Memory for the specification structure *pMESpec must be 
 * allocated prior to calling the function, and should be aligned on a 4-byte 
 * boundary.  The number of bytes required for the specification structure can 
 * be determined using the function omxVCM4P10_MEGetBufSize. Following 
 * initialization by this function, the vendor-specific structure *pMESpec 
 * should contain an implementation-specific representation of all motion 
 * estimation parameters received via the structure pMEParams, for example  
 * searchRange16x16, searchRange8x8, etc. 
 *
 * Input Arguments:
 *   
 *   MEmode - motion estimation mode; available modes are defined by the 
 *            enumerated type OMXVCM4P10MEMode 
 *   pMEParams - motion estimation parameters 
 *   pMESpec - pointer to the uninitialized ME specification structure 
 *
 * Output Arguments:
 *   
 *   pMESpec - pointer to the initialized ME specification structure 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    pMEParams or pSize is NULL. 
 *    -    an invalid value was specified for the parameter MEmode 
 *    -    a negative or zero value was specified for one of the search ranges 
 *         (e.g.,  pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.) 
 *    -    either in isolation or in combination, one or more of the enables or 
 *         search ranges in the structure *pMEParams were configured such 
 *         that the requested behavior fails to comply with [ISO14496-10]. 
 *
 */
OMXResult omxVCM4P10_MEInit (
    OMXVCM4P10MEMode MEmode,
    const OMXVCM4P10MEParams *pMEParams,
    void *pMESpec
);



/**
 * Function:  omxVCM4P10_BlockMatch_Integer   (6.3.5.2.1)
 *
 * Description:
 * Performs integer block match.  Returns best MV and associated cost. 
 *
 * Input Arguments:
 *   
 *   pSrcOrgY - Pointer to the top-left corner of the current block:
 *            If iBlockWidth==4,  4-byte alignment required. 
 *            If iBlockWidth==8,  8-byte alignment required. 
 *            If iBlockWidth==16, 16-byte alignment required. 
 *   pSrcRefY - Pointer to the top-left corner of the co-located block in the 
 *            reference picture: 
 *            If iBlockWidth==4,  4-byte alignment required.  
 *            If iBlockWidth==8,  8-byte alignment required.  
 *            If iBlockWidth==16, 16-byte alignment required. 
 *   nSrcOrgStep - Stride of the original picture plane, expressed in terms 
 *            of integer pixels; must be a multiple of iBlockWidth. 
 *   nSrcRefStep - Stride of the reference picture plane, expressed in terms 
 *            of integer pixels 
 *   pRefRect - pointer to the valid reference rectangle inside the reference 
 *            picture plane 
 *   nCurrPointPos - position of the current block in the current plane 
 *   iBlockWidth - Width of the current block, expressed in terms of integer 
 *            pixels; must be equal to either 4, 8, or 16. 
 *   iBlockHeight - Height of the current block, expressed in terms of 
 *            integer pixels; must be equal to either 4, 8, or 16. 
 *   nLamda - Lamda factor; used to compute motion cost 
 *   pMVPred - Predicted MV; used to compute motion cost, expressed in terms 
 *            of 1/4-pel units 
 *   pMVCandidate - Candidate MV; used to initialize the motion search, 
 *            expressed in terms of integer pixels 
 *   pMESpec - pointer to the ME specification structure 
 *
 * Output Arguments:
 *   
 *   pDstBestMV - Best MV resulting from integer search, expressed in terms 
 *            of 1/4-pel units 
 *   pBestCost - Motion cost associated with the best MV; computed as 
 *            SAD+Lamda*BitsUsedByMV 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    any of the following pointers are NULL:
 *         pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec. 
 *    -    Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16. 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_BlockMatch_Integer (
    const OMX_U8 *pSrcOrgY,
    OMX_S32 nSrcOrgStep,
    const OMX_U8 *pSrcRefY,
    OMX_S32 nSrcRefStep,
    const OMXRect *pRefRect,
    const OMXVCM4P2Coordinate *pCurrPointPos,
    OMX_U8 iBlockWidth,
    OMX_U8 iBlockHeight,
    OMX_U32 nLamda,
    const OMXVCMotionVector *pMVPred,
    const OMXVCMotionVector *pMVCandidate,
    OMXVCMotionVector *pBestMV,
    OMX_S32 *pBestCost,
    void *pMESpec
);



/**
 * Function:  omxVCM4P10_BlockMatch_Half   (6.3.5.2.2)
 *
 * Description:
 * Performs a half-pel block match using results from a prior integer search. 
 *  Returns the best MV and associated cost.  This function estimates the 
 * half-pixel motion vector by interpolating the integer resolution motion 
 * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial 
 * integer MV is generated externally.  The function 
 * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation. 
 *
 * Input Arguments:
 *   
 *   pSrcOrgY - Pointer to the current position in original picture plane:
 *              If iBlockWidth==4,  4-byte alignment required. 
 *              If iBlockWidth==8,  8-byte alignment required. 
 *              If iBlockWidth==16, 16-byte alignment required. 
 *   pSrcRefY - Pointer to the top-left corner of the co-located block in the 
 *            reference picture:  
 *              If iBlockWidth==4,  4-byte alignment required.  
 *              If iBlockWidth==8,  8-byte alignment required.  
 *              If iBlockWidth==16, 16-byte alignment required. 
 *   nSrcOrgStep - Stride of the original picture plane in terms of full 
 *            pixels; must be a multiple of iBlockWidth. 
 *   nSrcRefStep - Stride of the reference picture plane in terms of full 
 *            pixels 
 *   iBlockWidth - Width of the current block in terms of full pixels; must 
 *            be equal to either 4, 8, or 16. 
 *   iBlockHeight - Height of the current block in terms of full pixels; must 
 *            be equal to either 4, 8, or 16. 
 *   nLamda - Lamda factor, used to compute motion cost 
 *   pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to 
 *            compute motion cost 
 *   pSrcDstBestMV - The best MV resulting from a prior integer search, 
 *            represented in terms of 1/4-pel units 
 *
 * Output Arguments:
 *   
 *   pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in 
 *            terms of 1/4-pel units 
 *   pBestCost - Motion cost associated with the best MV; computed as 
 *            SAD+Lamda*BitsUsedByMV 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    any of the following pointers is NULL: pSrcOrgY, pSrcRefY, 
 *              pSrcDstBestMV, pMVPred, pBestCost 
 *    -    iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16. 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_BlockMatch_Half (
    const OMX_U8 *pSrcOrgY,
    OMX_S32 nSrcOrgStep,
    const OMX_U8 *pSrcRefY,
    OMX_S32 nSrcRefStep,
    OMX_U8 iBlockWidth,
    OMX_U8 iBlockHeight,
    OMX_U32 nLamda,
    const OMXVCMotionVector *pMVPred,
    OMXVCMotionVector *pSrcDstBestMV,
    OMX_S32 *pBestCost
);



/**
 * Function:  omxVCM4P10_BlockMatch_Quarter   (6.3.5.2.3)
 *
 * Description:
 * Performs a quarter-pel block match using results from a prior half-pel 
 * search.  Returns the best MV and associated cost.  This function estimates 
 * the quarter-pixel motion vector by interpolating the half-pel resolution 
 * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the 
 * initial half-pel MV is generated externally.  The function 
 * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation. 
 *
 * Input Arguments:
 *   
 *   pSrcOrgY - Pointer to the current position in original picture plane:
 *            If iBlockWidth==4,  4-byte alignment required. 
 *            If iBlockWidth==8,  8-byte alignment required. 
 *            If iBlockWidth==16, 16-byte alignment required. 
 *   pSrcRefY - Pointer to the top-left corner of the co-located block in the 
 *            reference picture:
 *            If iBlockWidth==4,  4-byte alignment required.  
 *            If iBlockWidth==8,  8-byte alignment required.  
 *            If iBlockWidth==16, 16-byte alignment required. 
 *   nSrcOrgStep - Stride of the original picture plane in terms of full 
 *            pixels; must be a multiple of iBlockWidth. 
 *   nSrcRefStep - Stride of the reference picture plane in terms of full 
 *            pixels 
 *   iBlockWidth - Width of the current block in terms of full pixels; must 
 *            be equal to either 4, 8, or 16. 
 *   iBlockHeight - Height of the current block in terms of full pixels; must 
 *            be equal to either 4, 8, or 16. 
 *   nLamda - Lamda factor, used to compute motion cost 
 *   pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to 
 *            compute motion cost 
 *   pSrcDstBestMV - The best MV resulting from a prior half-pel search, 
 *            represented in terms of 1/4 pel units 
 *
 * Output Arguments:
 *   
 *   pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed 
 *            in terms of 1/4-pel units 
 *   pBestCost - Motion cost associated with the best MV; computed as 
 *            SAD+Lamda*BitsUsedByMV 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    One or more of the following pointers is NULL: 
 *         pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost 
 *    -    iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16. 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_BlockMatch_Quarter (
    const OMX_U8 *pSrcOrgY,
    OMX_S32 nSrcOrgStep,
    const OMX_U8 *pSrcRefY,
    OMX_S32 nSrcRefStep,
    OMX_U8 iBlockWidth,
    OMX_U8 iBlockHeight,
    OMX_U32 nLamda,
    const OMXVCMotionVector *pMVPred,
    OMXVCMotionVector *pSrcDstBestMV,
    OMX_S32 *pBestCost
);



/**
 * Function:  omxVCM4P10_MotionEstimationMB   (6.3.5.3.1)
 *
 * Description:
 * Performs MB-level motion estimation and selects best motion estimation 
 * strategy from the set of modes supported in baseline profile [ISO14496-10]. 
 *
 * Input Arguments:
 *   
 *   pSrcCurrBuf - Pointer to the current position in original picture plane; 
 *            16-byte alignment required 
 *   pSrcRefBufList - Pointer to an array with 16 entries.  Each entry points 
 *            to the top-left corner of the co-located MB in a reference 
 *            picture.  The array is filled from low-to-high with valid 
 *            reference frame pointers; the unused high entries should be set 
 *            to NULL.  Ordering of the reference frames should follow 
 *            [ISO14496-10] subclause 8.2.4  Decoding Process for Reference 
 *            Picture Lists.   The entries must be 16-byte aligned. 
 *   pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the 
 *            reconstructed picture; must be 16-byte aligned. 
 *   SrcCurrStep - Width of the original picture plane in terms of full 
 *            pixels; must be a multiple of 16. 
 *   SrcRefStep - Width of the reference picture plane in terms of full 
 *            pixels; must be a multiple of 16. 
 *   SrcRecStep - Width of the reconstructed picture plane in terms of full 
 *            pixels; must be a multiple of 16. 
 *   pRefRect - Pointer to the valid reference rectangle; relative to the 
 *            image origin. 
 *   pCurrPointPos - Position of the current macroblock in the current plane. 
 *   Lambda - Lagrange factor for computing the cost function 
 *   pMESpec - Pointer to the motion estimation specification structure; must 
 *            have been allocated and initialized prior to calling this 
 *            function. 
 *   pMBInter - Array, of dimension four, containing pointers to information 
 *            associated with four adjacent type INTER MBs (Left, Top, 
 *            Top-Left, Top-Right). Any pointer in the array may be set equal 
 *            to NULL if the corresponding MB doesn t exist or is not of type 
 *            INTER. 
 *            -  pMBInter[0] - Pointer to left MB information 
 *            -  pMBInter[1] - Pointer to top MB information 
 *            -  pMBInter[2] - Pointer to top-left MB information 
 *            -  pMBInter[3] - Pointer to top-right MB information 
 *   pMBIntra - Array, of dimension four, containing pointers to information 
 *            associated with four adjacent type INTRA MBs (Left, Top, 
 *            Top-Left, Top-Right). Any pointer in the array may be set equal 
 *            to NULL if the corresponding MB doesn t exist or is not of type 
 *            INTRA. 
 *            -  pMBIntra[0] - Pointer to left MB information 
 *            -  pMBIntra[1] - Pointer to top MB information 
 *            -  pMBIntra[2] - Pointer to top-left MB information 
 *            -  pMBIntra[3] - Pointer to top-right MB information 
 *   pSrcDstMBCurr - Pointer to information structure for the current MB.  
 *            The following entries should be set prior to calling the 
 *            function:  sliceID - the number of the slice the to which the 
 *            current MB belongs. 
 *
 * Output Arguments:
 *   
 *   pDstCost - Pointer to the minimum motion cost for the current MB. 
 *   pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma 
 *            4x4 blocks in each MB.  The block SADs are in scan order for 
 *            each MB.  For implementations that cannot compute the SAD values 
 *            individually, the maximum possible value (0xffff) is returned 
 *            for each of the 16 block SAD entries. 
 *   pSrcDstMBCurr - Pointer to updated information structure for the current 
 *            MB after MB-level motion estimation has been completed.  The 
 *            following fields are updated by the ME function.   The following 
 *            parameter set quantifies the MB-level ME search results: 
 *            -  MbType 
 *            -  subMBType[4] 
 *            -  pMV0[4][4] 
 *            -  pMVPred[4][4] 
 *            -  pRefL0Idx[4] 
 *            -  Intra16x16PredMode 
 *            -  pIntra4x4PredMode[4][4] 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -   One or more of the following pointers is NULL: pSrcCurrBuf, 
 *           pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec, 
 *           pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0] 
 *    -    SrcRefStep, SrcRecStep are not multiples of 16 
 *    -    iBlockWidth or iBlockHeight are values other than 4, 8, or 16. 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_MotionEstimationMB (
    const OMX_U8 *pSrcCurrBuf,
    OMX_S32 SrcCurrStep,
    const OMX_U8 *pSrcRefBufList[15],
    OMX_S32 SrcRefStep,
    const OMX_U8 *pSrcRecBuf,
    OMX_S32 SrcRecStep,
    const OMXRect *pRefRect,
    const OMXVCM4P2Coordinate *pCurrPointPos,
    OMX_U32 Lambda,
    void *pMESpec,
    const OMXVCM4P10MBInfoPtr *pMBInter,
    const OMXVCM4P10MBInfoPtr *pMBIntra,
    OMXVCM4P10MBInfoPtr pSrcDstMBCurr,
    OMX_INT *pDstCost,
    OMX_U16 *pDstBlockSAD
);



/**
 * Function:  omxVCM4P10_SAD_4x   (6.3.5.4.1)
 *
 * Description:
 * This function calculates the SAD for 4x8 and 4x4 blocks. 
 *
 * Input Arguments:
 *   
 *   pSrcOrg -Pointer to the original block; must be aligned on a 4-byte 
 *            boundary. 
 *   iStepOrg -Step of the original block buffer; must be a multiple of 4. 
 *   pSrcRef -Pointer to the reference block 
 *   iStepRef -Step of the reference block buffer 
 *   iHeight -Height of the block; must be equal to either 4 or 8. 
 *
 * Output Arguments:
 *   
 *   pDstSAD -Pointer of result SAD 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    One or more of the following pointers is NULL: 
 *         pSrcOrg, pSrcRef, or pDstSAD 
 *    -    iHeight is not equal to either 4 or 8. 
 *    -    iStepOrg is not a multiple of 4 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_SAD_4x (
    const OMX_U8 *pSrcOrg,
    OMX_U32 iStepOrg,
    const OMX_U8 *pSrcRef,
    OMX_U32 iStepRef,
    OMX_S32 *pDstSAD,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_SADQuar_4x   (6.3.5.4.2)
 *
 * Description:
 * This function calculates the SAD between one block (pSrc) and the average 
 * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks.  Rounding 
 * is applied according to the convention (a+b+1)>>1. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the original block; must be aligned on a 4-byte 
 *            boundary. 
 *   pSrcRef0 - Pointer to reference block 0 
 *   pSrcRef1 - Pointer to reference block 1 
 *   iSrcStep - Step of the original block buffer; must be a multiple of 4. 
 *   iRefStep0 - Step of reference block 0 
 *   iRefStep1 - Step of reference block 1 
 *   iHeight - Height of the block; must be equal to either 4 or 8. 
 *
 * Output Arguments:
 *   
 *   pDstSAD - Pointer of result SAD 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    iHeight is not equal to either 4 or 8. 
 *    -    One or more of the following pointers is NULL: pSrc, pSrcRef0, 
 *              pSrcRef1, pDstSAD. 
 *    -    iSrcStep is not a multiple of 4 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_SADQuar_4x (
    const OMX_U8 *pSrc,
    const OMX_U8 *pSrcRef0,
    const OMX_U8 *pSrcRef1,
    OMX_U32 iSrcStep,
    OMX_U32 iRefStep0,
    OMX_U32 iRefStep1,
    OMX_U32 *pDstSAD,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_SADQuar_8x   (6.3.5.4.3)
 *
 * Description:
 * This function calculates the SAD between one block (pSrc) and the average 
 * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.  
 * Rounding is applied according to the convention (a+b+1)>>1. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the original block; must be aligned on an 8-byte 
 *            boundary. 
 *   pSrcRef0 - Pointer to reference block 0 
 *   pSrcRef1 - Pointer to reference block 1 
 *   iSrcStep - Step of the original block buffer; must be a multiple of 8. 
 *   iRefStep0 - Step of reference block 0 
 *   iRefStep1 - Step of reference block 1 
 *   iHeight - Height of the block; must be equal either 4, 8, or 16. 
 *
 * Output Arguments:
 *   
 *   pDstSAD - Pointer of result SAD 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    iHeight is not equal to either 4, 8, or 16. 
 *    -    One or more of the following pointers is NULL: pSrc, pSrcRef0, 
 *              pSrcRef1, pDstSAD. 
 *    -    iSrcStep is not a multiple of 8 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_SADQuar_8x (
    const OMX_U8 *pSrc,
    const OMX_U8 *pSrcRef0,
    const OMX_U8 *pSrcRef1,
    OMX_U32 iSrcStep,
    OMX_U32 iRefStep0,
    OMX_U32 iRefStep1,
    OMX_U32 *pDstSAD,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_SADQuar_16x   (6.3.5.4.4)
 *
 * Description:
 * This function calculates the SAD between one block (pSrc) and the average 
 * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks.  
 * Rounding is applied according to the convention (a+b+1)>>1. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the original block; must be aligned on a 16-byte 
 *            boundary. 
 *   pSrcRef0 - Pointer to reference block 0 
 *   pSrcRef1 - Pointer to reference block 1 
 *   iSrcStep - Step of the original block buffer; must be a multiple of 16 
 *   iRefStep0 - Step of reference block 0 
 *   iRefStep1 - Step of reference block 1 
 *   iHeight - Height of the block; must be equal to either 8 or 16 
 *
 * Output Arguments:
 *   
 *   pDstSAD -Pointer of result SAD 
 *
 * Return Value:
 *    OMX_Sts_NoErr, if the function runs without error.
 *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 
 *    -    iHeight is not equal to either 8 or 16. 
 *    -    One or more of the following pointers is NULL: pSrc, pSrcRef0, 
 *              pSrcRef1, pDstSAD. 
 *    -    iSrcStep is not a multiple of 16 
 *    -    Any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_SADQuar_16x (
    const OMX_U8 *pSrc,
    const OMX_U8 *pSrcRef0,
    const OMX_U8 *pSrcRef1,
    OMX_U32 iSrcStep,
    OMX_U32 iRefStep0,
    OMX_U32 iRefStep1,
    OMX_U32 *pDstSAD,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_SATD_4x4   (6.3.5.4.5)
 *
 * Description:
 * This function calculates the sum of absolute transform differences (SATD) 
 * for a 4x4 block by applying a Hadamard transform to the difference block 
 * and then calculating the sum of absolute coefficient values. 
 *
 * Input Arguments:
 *   
 *   pSrcOrg - Pointer to the original block; must be aligned on a 4-byte 
 *            boundary 
 *   iStepOrg - Step of the original block buffer; must be a multiple of 4 
 *   pSrcRef - Pointer to the reference block; must be aligned on a 4-byte 
 *            boundary 
 *   iStepRef - Step of the reference block buffer; must be a multiple of 4 
 *
 * Output Arguments:
 *   
 *   pDstSAD - pointer to the resulting SAD 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *         pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg 
 *    -    pSrcRef is not aligned on a 4-byte boundary 
 *    -    iStepOrg <= 0 or iStepOrg is not a multiple of 4 
 *    -    iStepRef <= 0 or iStepRef is not a multiple of 4 
 *
 */
OMXResult omxVCM4P10_SATD_4x4 (
    const OMX_U8 *pSrcOrg,
    OMX_U32 iStepOrg,
    const OMX_U8 *pSrcRef,
    OMX_U32 iStepRef,
    OMX_U32 *pDstSAD
);



/**
 * Function:  omxVCM4P10_InterpolateHalfHor_Luma   (6.3.5.5.1)
 *
 * Description:
 * This function performs interpolation for two horizontal 1/2-pel positions 
 * (-1/2,0) and (1/2, 0) - around a full-pel position. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the top-left corner of the block used to interpolate in 
 *            the reconstruction frame plane. 
 *   iSrcStep - Step of the source buffer. 
 *   iDstStep - Step of the destination(interpolation) buffer; must be a 
 *            multiple of iWidth. 
 *   iWidth - Width of the current block; must be equal to either 4, 8, or 16 
 *   iHeight - Height of the current block; must be equal to 4, 8, or 16 
 *
 * Output Arguments:
 *   
 *   pDstLeft -Pointer to the interpolation buffer of the left -pel position 
 *            (-1/2, 0) 
 *                 If iWidth==4,  4-byte alignment required. 
 *                 If iWidth==8,  8-byte alignment required. 
 *                 If iWidth==16, 16-byte alignment required. 
 *   pDstRight -Pointer to the interpolation buffer of the right -pel 
 *            position (1/2, 0) 
 *                 If iWidth==4,  4-byte alignment required. 
 *                 If iWidth==8,  8-byte alignment required. 
 *                 If iWidth==16, 16-byte alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *             pSrc, pDstLeft, or pDstRight 
 *    -    iWidth or iHeight have values other than 4, 8, or 16 
 *    -    iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary 
 *    -    iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary 
 *    -    iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary 
 *    -    any alignment restrictions are violated 
 *
 */
OMXResult omxVCM4P10_InterpolateHalfHor_Luma (
    const OMX_U8 *pSrc,
    OMX_U32 iSrcStep,
    OMX_U8 *pDstLeft,
    OMX_U8 *pDstRight,
    OMX_U32 iDstStep,
    OMX_U32 iWidth,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_InterpolateHalfVer_Luma   (6.3.5.5.2)
 *
 * Description:
 * This function performs interpolation for two vertical 1/2-pel positions - 
 * (0, -1/2) and (0, 1/2) - around a full-pel position. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to top-left corner of block used to interpolate in the 
 *            reconstructed frame plane 
 *   iSrcStep - Step of the source buffer. 
 *   iDstStep - Step of the destination (interpolation) buffer; must be a 
 *            multiple of iWidth. 
 *   iWidth - Width of the current block; must be equal to either 4, 8, or 16 
 *   iHeight - Height of the current block; must be equal to either 4, 8, or 16 
 *
 * Output Arguments:
 *   
 *   pDstUp -Pointer to the interpolation buffer of the -pel position above 
 *            the current full-pel position (0, -1/2) 
 *                If iWidth==4, 4-byte alignment required. 
 *                If iWidth==8, 8-byte alignment required. 
 *                If iWidth==16, 16-byte alignment required. 
 *   pDstDown -Pointer to the interpolation buffer of the -pel position below 
 *            the current full-pel position (0, 1/2) 
 *                If iWidth==4, 4-byte alignment required. 
 *                If iWidth==8, 8-byte alignment required. 
 *                If iWidth==16, 16-byte alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *            pSrc, pDstUp, or pDstDown 
 *    -    iWidth or iHeight have values other than 4, 8, or 16 
 *    -    iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary 
 *    -    iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary 
 *    -    iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary 
 *
 */
OMXResult omxVCM4P10_InterpolateHalfVer_Luma (
    const OMX_U8 *pSrc,
    OMX_U32 iSrcStep,
    OMX_U8 *pDstUp,
    OMX_U8 *pDstDown,
    OMX_U32 iDstStep,
    OMX_U32 iWidth,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_Average_4x   (6.3.5.5.3)
 *
 * Description:
 * This function calculates the average of two 4x4, 4x8 blocks.  The result 
 * is rounded according to (a+b+1)/2. 
 *
 * Input Arguments:
 *   
 *   pPred0 - Pointer to the top-left corner of reference block 0 
 *   pPred1 - Pointer to the top-left corner of reference block 1 
 *   iPredStep0 - Step of reference block 0; must be a multiple of 4. 
 *   iPredStep1 - Step of reference block 1; must be a multiple of 4. 
 *   iDstStep - Step of the destination buffer; must be a multiple of 4. 
 *   iHeight - Height of the blocks; must be either 4 or 8. 
 *
 * Output Arguments:
 *   
 *   pDstPred - Pointer to the destination buffer. 4-byte alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *           pPred0, pPred1, or pDstPred 
 *    -    pDstPred is not aligned on a 4-byte boundary 
 *    -    iPredStep0 <= 0 or iPredStep0 is not a multiple of 4 
 *    -    iPredStep1 <= 0 or iPredStep1 is not a multiple of 4 
 *    -    iDstStep <= 0 or iDstStep is not a multiple of 4 
 *    -    iHeight is not equal to either 4 or 8 
 *
 */
OMXResult omxVCM4P10_Average_4x (
    const OMX_U8 *pPred0,
    const OMX_U8 *pPred1,
    OMX_U32 iPredStep0,
    OMX_U32 iPredStep1,
    OMX_U8 *pDstPred,
    OMX_U32 iDstStep,
    OMX_U32 iHeight
);



/**
 * Function:  omxVCM4P10_TransformQuant_ChromaDC   (6.3.5.6.1)
 *
 * Description:
 * This function performs 2x2 Hadamard transform of chroma DC coefficients 
 * and then quantizes the coefficients. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - Pointer to the 2x2 array of chroma DC coefficients.  8-byte 
 *            alignment required. 
 *   iQP - Quantization parameter; must be in the range [0,51]. 
 *   bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER 
 *
 * Output Arguments:
 *   
 *   pSrcDst - Pointer to transformed and quantized coefficients.  8-byte 
 *            alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *             pSrcDst 
 *    -    pSrcDst is not aligned on an 8-byte boundary 
 *
 */
OMXResult omxVCM4P10_TransformQuant_ChromaDC (
    OMX_S16 *pSrcDst,
    OMX_U32 iQP,
    OMX_U8 bIntra
);



/**
 * Function:  omxVCM4P10_TransformQuant_LumaDC   (6.3.5.6.2)
 *
 * Description:
 * This function performs a 4x4 Hadamard transform of luma DC coefficients 
 * and then quantizes the coefficients. 
 *
 * Input Arguments:
 *   
 *   pSrcDst - Pointer to the 4x4 array of luma DC coefficients.  16-byte 
 *            alignment required. 
 *   iQP - Quantization parameter; must be in the range [0,51]. 
 *
 * Output Arguments:
 *   
 *   pSrcDst - Pointer to transformed and quantized coefficients.  16-byte 
 *             alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: pSrcDst 
 *    -    pSrcDst is not aligned on an 16-byte boundary 
 *
 */
OMXResult omxVCM4P10_TransformQuant_LumaDC (
    OMX_S16 *pSrcDst,
    OMX_U32 iQP
);



/**
 * Function:  omxVCM4P10_InvTransformDequant_LumaDC   (6.3.5.6.3)
 *
 * Description:
 * This function performs inverse 4x4 Hadamard transform and then dequantizes 
 * the coefficients. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and 
 *            quantized coefficients.  16 byte alignment required. 
 *   iQP - Quantization parameter; must be in the range [0,51]. 
 *
 * Output Arguments:
 *   
 *   pDst - Pointer to inverse-transformed and dequantized coefficients.  
 *            16-byte alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: pSrc 
 *    -    pSrc or pDst is not aligned on a 16-byte boundary 
 *
 */
OMXResult omxVCM4P10_InvTransformDequant_LumaDC (
    const OMX_S16 *pSrc,
    OMX_S16 *pDst,
    OMX_U32 iQP
);



/**
 * Function:  omxVCM4P10_InvTransformDequant_ChromaDC   (6.3.5.6.4)
 *
 * Description:
 * This function performs inverse 2x2 Hadamard transform and then dequantizes 
 * the coefficients. 
 *
 * Input Arguments:
 *   
 *   pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and 
 *            quantized coefficients.  8 byte alignment required. 
 *   iQP - Quantization parameter; must be in the range [0,51]. 
 *
 * Output Arguments:
 *   
 *   pDst - Pointer to inverse-transformed and dequantized coefficients.  
 *            8-byte alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: pSrc 
 *    -    pSrc or pDst is not aligned on an 8-byte boundary 
 *
 */
OMXResult omxVCM4P10_InvTransformDequant_ChromaDC (
    const OMX_S16 *pSrc,
    OMX_S16 *pDst,
    OMX_U32 iQP
);



/**
 * Function:  omxVCM4P10_InvTransformResidualAndAdd   (6.3.5.7.1)
 *
 * Description:
 * This function performs inverse an 4x4 integer transformation to produce 
 * the difference signal and then adds the difference to the prediction to get 
 * the reconstructed signal. 
 *
 * Input Arguments:
 *   
 *   pSrcPred - Pointer to prediction signal.  4-byte alignment required. 
 *   pDequantCoeff - Pointer to the transformed coefficients.  8-byte 
 *            alignment required. 
 *   iSrcPredStep - Step of the prediction buffer; must be a multiple of 4. 
 *   iDstReconStep - Step of the destination reconstruction buffer; must be a 
 *            multiple of 4. 
 *   bAC - Indicate whether there is AC coefficients in the coefficients 
 *            matrix. 
 *
 * Output Arguments:
 *   
 *   pDstRecon -Pointer to the destination reconstruction buffer.  4-byte 
 *            alignment required. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *            pSrcPred, pDequantCoeff, pDstRecon 
 *    -    pSrcPred is not aligned on a 4-byte boundary 
 *    -    iSrcPredStep or iDstReconStep is not a multiple of 4. 
 *    -    pDequantCoeff is not aligned on an 8-byte boundary 
 *
 */
OMXResult omxVCM4P10_InvTransformResidualAndAdd (
    const OMX_U8 *pSrcPred,
    const OMX_S16 *pDequantCoeff,
    OMX_U8 *pDstRecon,
    OMX_U32 iSrcPredStep,
    OMX_U32 iDstReconStep,
    OMX_U8 bAC
);



/**
 * Function:  omxVCM4P10_SubAndTransformQDQResidual   (6.3.5.8.1)
 *
 * Description:
 * This function subtracts the prediction signal from the original signal to 
 * produce the difference signal and then performs a 4x4 integer transform and 
 * quantization. The quantized transformed coefficients are stored as 
 * pDstQuantCoeff. This function can also output dequantized coefficients or 
 * unquantized DC coefficients optionally by setting the pointers 
 * pDstDeQuantCoeff, pDCCoeff. 
 *
 * Input Arguments:
 *   
 *   pSrcOrg - Pointer to original signal. 4-byte alignment required. 
 *   pSrcPred - Pointer to prediction signal. 4-byte alignment required. 
 *   iSrcOrgStep - Step of the original signal buffer; must be a multiple of 
 *            4. 
 *   iSrcPredStep - Step of the prediction signal buffer; must be a multiple 
 *            of 4. 
 *   pNumCoeff -Number of non-zero coefficients after quantization. If this 
 *            parameter is not required, it is set to NULL. 
 *   nThreshSAD - Zero-block early detection threshold. If this parameter is 
 *            not required, it is set to 0. 
 *   iQP - Quantization parameter; must be in the range [0,51]. 
 *   bIntra - Indicates whether this is an INTRA block, either 1-INTRA or 
 *            0-INTER 
 *
 * Output Arguments:
 *   
 *   pDstQuantCoeff - Pointer to the quantized transformed coefficients.  
 *            8-byte alignment required. 
 *   pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients 
 *            if this parameter is not equal to NULL.  8-byte alignment 
 *            required. 
 *   pDCCoeff - Pointer to the unquantized DC coefficient if this parameter 
 *            is not equal to NULL. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *            pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff, 
 *            pDstDeQuantCoeff, pDCCoeff 
 *    -    pSrcOrg is not aligned on a 4-byte boundary 
 *    -    pSrcPred is not aligned on a 4-byte boundary 
 *    -    iSrcOrgStep is not a multiple of 4 
 *    -    iSrcPredStep is not a multiple of 4 
 *    -    pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary 
 *
 */
OMXResult omxVCM4P10_SubAndTransformQDQResidual (
    const OMX_U8 *pSrcOrg,
    const OMX_U8 *pSrcPred,
    OMX_U32 iSrcOrgStep,
    OMX_U32 iSrcPredStep,
    OMX_S16 *pDstQuantCoeff,
    OMX_S16 *pDstDeQuantCoeff,
    OMX_S16 *pDCCoeff,
    OMX_S8 *pNumCoeff,
    OMX_U32 nThreshSAD,
    OMX_U32 iQP,
    OMX_U8 bIntra
);



/**
 * Function:  omxVCM4P10_GetVLCInfo   (6.3.5.9.1)
 *
 * Description:
 * This function extracts run-length encoding (RLE) information from the 
 * coefficient matrix.  The results are returned in an OMXVCM4P10VLCInfo 
 * structure. 
 *
 * Input Arguments:
 *   
 *   pSrcCoeff - pointer to the transform coefficient matrix.  8-byte 
 *            alignment required. 
 *   pScanMatrix - pointer to the scan order definition matrix.  For a luma 
 *            block the scan matrix should follow [ISO14496-10] section 8.5.4, 
 *            and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 
 *            10, 7, 11, 14, 15.  For a chroma block, the scan matrix should 
 *            contain the values 0, 1, 2, 3. 
 *   bAC - indicates presence of a DC coefficient; 0 = DC coefficient 
 *            present, 1= DC coefficient absent. 
 *   MaxNumCoef - specifies the number of coefficients contained in the 
 *            transform coefficient matrix, pSrcCoeff. The value should be 16 
 *            for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The 
 *            value should be 4 for blocks of type CHROMADC. 
 *
 * Output Arguments:
 *   
 *   pDstVLCInfo - pointer to structure that stores information for 
 *            run-length coding. 
 *
 * Return Value:
 *    
 *    OMX_Sts_NoErr - no error 
 *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following 
 *              conditions are true: 
 *    -    at least one of the following pointers is NULL: 
 *            pSrcCoeff, pScanMatrix, pDstVLCInfo 
 *    -    pSrcCoeff is not aligned on an 8-byte boundary 
 *
 */
OMXResult omxVCM4P10_GetVLCInfo (
    const OMX_S16 *pSrcCoeff,
    const OMX_U8 *pScanMatrix,
    OMX_U8 bAC,
    OMX_U32 MaxNumCoef,
    OMXVCM4P10VLCInfo*pDstVLCInfo
);



#ifdef __cplusplus
}
#endif

#endif /** end of #define _OMXVC_H_ */

/** EOF */