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
|
.686
.XMM
.model FLAT
; Slice
tex_ctx@Slice = 100
coeff@Slice = 15632
coeff_ctr@Slice = 15760
pos@Slice = 15764
last_dquant@Slice = 88
mot_ctx@Slice = 96
slice_type@Slice = 64
; VideoParameters
structure@VideoParameters = 697200
dec_picture@VideoParameters = 698192
bitdepth_chroma_qp_scale@VideoParameters = 697456
; Macroblock
p_Slice@Macroblock = 0
p_Vid@Macroblock = 4
qp@macroblock = 60
qp_scaled@Macroblock = 72
mb_field@Macroblock = 344
read_and_store_CBP_block_bit@Macroblock = 400
; StorablePicture
structure@StorablePicture = 0
chroma_qp_offset@StorablePicture = 158688
; TextureInfoContexts
map_contexts@TextureInfoContexts = 436
last_contexts@TextureInfoContexts = 3252
one_contexts@TextureInfoContexts = 6068
abs_contexts@TextureInfoContexts = 6508
_DATA SEGMENT
_pos2ctx_map DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map8x8
DD FLAT:_pos2ctx_map8x4
DD FLAT:_pos2ctx_map8x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map2x4c
DD FLAT:_pos2ctx_map4x4c
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map8x8
DD FLAT:_pos2ctx_map8x4
DD FLAT:_pos2ctx_map8x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map8x8
DD FLAT:_pos2ctx_map8x4
DD FLAT:_pos2ctx_map8x4
DD FLAT:_pos2ctx_map4x4
_pos2ctx_map_int DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map8x8i
DD FLAT:_pos2ctx_map8x4i
DD FLAT:_pos2ctx_map4x8i
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map2x4c
DD FLAT:_pos2ctx_map4x4c
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map8x8i
DD FLAT:_pos2ctx_map8x4i
DD FLAT:_pos2ctx_map8x4i
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map4x4
DD FLAT:_pos2ctx_map8x8i
DD FLAT:_pos2ctx_map8x4i
DD FLAT:_pos2ctx_map8x4i
DD FLAT:_pos2ctx_map4x4
_pos2ctx_last DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last8x8
DD FLAT:_pos2ctx_last8x4
DD FLAT:_pos2ctx_last8x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last2x4c
DD FLAT:_pos2ctx_last4x4c
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last8x8
DD FLAT:_pos2ctx_last8x4
DD FLAT:_pos2ctx_last8x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last4x4
DD FLAT:_pos2ctx_last8x8
DD FLAT:_pos2ctx_last8x4
DD FLAT:_pos2ctx_last8x4
DD FLAT:_pos2ctx_last4x4
_DATA ENDS
CONST SEGMENT
_rLPS_table_64x4 DB 080H
DB 080H
DB 080H
DB 07bH
DB 074H
DB 06fH
DB 069H
DB 064H
DB 05fH
DB 05aH
DB 055H
DB 051H
DB 04dH
DB 049H
DB 045H
DB 042H
DB 03eH
DB 03bH
DB 038H
DB 035H
DB 033H
DB 030H
DB 02eH
DB 02bH
DB 029H
DB 027H
DB 025H
DB 023H
DB 021H
DB 020H
DB 01eH
DB 01dH
DB 01bH
DB 01aH
DB 018H
DB 017H
DB 016H
DB 015H
DB 014H
DB 013H
DB 012H
DB 011H
DB 010H
DB 0fH
DB 0eH
DB 0eH
DB 0dH
DB 0cH
DB 0cH
DB 0bH
DB 0bH
DB 0aH
DB 0aH
DB 09H
DB 09H
DB 08H
DB 08H
DB 07H
DB 07H
DB 07H
DB 06H
DB 06H
DB 06H
DB 02H
DB 0b0H
DB 0a7H
DB 09eH
DB 096H
DB 08eH
DB 087H
DB 080H
DB 07aH
DB 074H
DB 06eH
DB 068H
DB 063H
DB 05eH
DB 059H
DB 055H
DB 050H
DB 04cH
DB 048H
DB 045H
DB 041H
DB 03eH
DB 03bH
DB 038H
DB 035H
DB 032H
DB 030H
DB 02dH
DB 02bH
DB 029H
DB 027H
DB 025H
DB 023H
DB 021H
DB 01fH
DB 01eH
DB 01cH
DB 01bH
DB 01aH
DB 018H
DB 017H
DB 016H
DB 015H
DB 014H
DB 013H
DB 012H
DB 011H
DB 010H
DB 0fH
DB 0eH
DB 0eH
DB 0dH
DB 0cH
DB 0cH
DB 0bH
DB 0bH
DB 0aH
DB 09H
DB 09H
DB 09H
DB 08H
DB 08H
DB 07H
DB 07H
DB 02H
DB 0d0H
DB 0c5H
DB 0bbH
DB 0b2H
DB 0a9H
DB 0a0H
DB 098H
DB 090H
DB 089H
DB 082H
DB 07bH
DB 075H
DB 06fH
DB 069H
DB 064H
DB 05fH
DB 05aH
DB 056H
DB 051H
DB 04dH
DB 049H
DB 045H
DB 042H
DB 03fH
DB 03bH
DB 038H
DB 036H
DB 033H
DB 030H
DB 02eH
DB 02bH
DB 029H
DB 027H
DB 025H
DB 023H
DB 021H
DB 020H
DB 01eH
DB 01dH
DB 01bH
DB 01aH
DB 019H
DB 017H
DB 016H
DB 015H
DB 014H
DB 013H
DB 012H
DB 011H
DB 010H
DB 0fH
DB 0fH
DB 0eH
DB 0dH
DB 0cH
DB 0cH
DB 0bH
DB 0bH
DB 0aH
DB 0aH
DB 09H
DB 09H
DB 08H
DB 02H
DB 0f0H
DB 0e3H
DB 0d8H
DB 0cdH
DB 0c3H
DB 0b9H
DB 0afH
DB 0a6H
DB 09eH
DB 096H
DB 08eH
DB 087H
DB 080H
DB 07aH
DB 074H
DB 06eH
DB 068H
DB 063H
DB 05eH
DB 059H
DB 055H
DB 050H
DB 04cH
DB 048H
DB 045H
DB 041H
DB 03eH
DB 03bH
DB 038H
DB 035H
DB 032H
DB 030H
DB 02dH
DB 02bH
DB 029H
DB 027H
DB 025H
DB 023H
DB 021H
DB 01fH
DB 01eH
DB 01cH
DB 01bH
DB 019H
DB 018H
DB 017H
DB 016H
DB 015H
DB 014H
DB 013H
DB 012H
DB 011H
DB 010H
DB 0fH
DB 0eH
DB 0eH
DB 0dH
DB 0cH
DB 0cH
DB 0bH
DB 0bH
DB 0aH
DB 09H
DB 02H
_AC_next_state_MPS_64 DB 01H
DB 02H
DB 03H
DB 04H
DB 05H
DB 06H
DB 07H
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 0cH
DB 0dH
DB 0eH
DB 0fH
DB 010H
DB 011H
DB 012H
DB 013H
DB 014H
DB 015H
DB 016H
DB 017H
DB 018H
DB 019H
DB 01aH
DB 01bH
DB 01cH
DB 01dH
DB 01eH
DB 01fH
DB 020H
DB 021H
DB 022H
DB 023H
DB 024H
DB 025H
DB 026H
DB 027H
DB 028H
DB 029H
DB 02aH
DB 02bH
DB 02cH
DB 02dH
DB 02eH
DB 02fH
DB 030H
DB 031H
DB 032H
DB 033H
DB 034H
DB 035H
DB 036H
DB 037H
DB 038H
DB 039H
DB 03aH
DB 03bH
DB 03cH
DB 03dH
DB 03eH
DB 03eH
DB 03fH
_AC_next_state_LPS_64 DB 00H
DB 00H
DB 01H
DB 02H
DB 02H
DB 04H
DB 04H
DB 05H
DB 06H
DB 07H
DB 08H
DB 09H
DB 09H
DB 0bH
DB 0bH
DB 0cH
DB 0dH
DB 0dH
DB 0fH
DB 0fH
DB 010H
DB 010H
DB 012H
DB 012H
DB 013H
DB 013H
DB 015H
DB 015H
DB 016H
DB 016H
DB 017H
DB 018H
DB 018H
DB 019H
DB 01aH
DB 01aH
DB 01bH
DB 01bH
DB 01cH
DB 01dH
DB 01dH
DB 01eH
DB 01eH
DB 01eH
DB 01fH
DB 020H
DB 020H
DB 021H
DB 021H
DB 021H
DB 022H
DB 022H
DB 023H
DB 023H
DB 023H
DB 024H
DB 024H
DB 024H
DB 025H
DB 025H
DB 025H
DB 026H
DB 026H
DB 03fH
_renorm_table_32 DB 06H
DB 05H
DB 04H
DB 04H
DB 03H
DB 03H
DB 03H
DB 03H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
_renorm_table_256 DB 06H
DB 06H
DB 06H
DB 06H
DB 06H
DB 06H
DB 06H
DB 06H
DB 05H
DB 05H
DB 05H
DB 05H
DB 05H
DB 05H
DB 05H
DB 05H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
_maxpos DB 0fH
DB 0eH
DB 03fH
DB 01fH
DB 01fH
DB 0fH
DB 03H
DB 0eH
DB 07H
DB 0fH
DB 0fH
DB 0eH
DB 03fH
DB 01fH
DB 01fH
DB 0fH
DB 0fH
DB 0eH
DB 03fH
DB 01fH
DB 01fH
DB 0fH
ORG $+2
_c1isdc DB 01H
DB 00H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 00H
DB 01H
DB 01H
DB 01H
DB 00H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 00H
DB 01H
DB 01H
DB 01H
DB 01H
ORG $+2
_type2ctx_bcbp DB 00H
DB 01H
DB 02H
DB 03H
DB 03H
DB 04H
DB 05H
DB 06H
DB 05H
DB 05H
DB 0aH
DB 0bH
DB 0cH
DB 0dH
DB 0dH
DB 0eH
DB 010H
DB 011H
DB 012H
DB 013H
DB 013H
DB 014H
ORG $+2
_type2ctx_map DW 00H
DW 010H
DW 020H
DW 030H
DW 040H
DW 050H
DW 060H
DW 070H
DW 060H
DW 060H
DW 0A0H
DW 0B0H
DW 0C0H
DW 0D0H
DW 0E0H
DW 0F0H
DW 0100H
DW 0110H
DW 0120H
DW 0130H
DW 0140H
DW 0150H
ORG $+2
_type2ctx_last DW 00H
DW 010H
DW 020H
DW 030H
DW 040H
DW 050H
DW 060H
DW 070H
DW 060H
DW 060H
DW 0A0H
DW 0B0H
DW 0C0H
DW 0D0H
DW 0E0H
DW 0F0H
DW 0100H
DW 0110H
DW 0120H
DW 0130H
DW 0140H
DW 0150H
ORG $+2
_type2ctx_one DB 00H
DB 01H
DB 02H
DB 03H
DB 03H
DB 04H
DB 05H
DB 06H
DB 05H
DB 05H
DB 0aH
DB 0bH
DB 0cH
DB 0dH
DB 0dH
DB 0eH
DB 010H
DB 011H
DB 012H
DB 013H
DB 013H
DB 014H
ORG $+2
_type2ctx_abs DB 00H
DB 01H
DB 02H
DB 03H
DB 03H
DB 04H
DB 05H
DB 06H
DB 05H
DB 05H
DB 0aH
DB 0bH
DB 0cH
DB 0dH
DB 0dH
DB 0eH
DB 010H
DB 011H
DB 012H
DB 013H
DB 013H
DB 014H
ORG $+2
plus_one_clip4 DD 1,2,3,4,4
plus_one_clip3 DD 1,2,3,3
_max_c2 DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip3
DD plus_one_clip4
DD plus_one_clip3
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
DD plus_one_clip4
ORG $+6
_pos2ctx_map8x8 DB 00H
DB 01H
DB 02H
DB 03H
DB 04H
DB 05H
DB 05H
DB 04H
DB 04H
DB 03H
DB 03H
DB 04H
DB 04H
DB 04H
DB 05H
DB 05H
DB 04H
DB 04H
DB 04H
DB 04H
DB 03H
DB 03H
DB 06H
DB 07H
DB 07H
DB 07H
DB 08H
DB 09H
DB 0aH
DB 09H
DB 08H
DB 07H
DB 07H
DB 06H
DB 0bH
DB 0cH
DB 0dH
DB 0bH
DB 06H
DB 07H
DB 08H
DB 09H
DB 0eH
DB 0aH
DB 09H
DB 08H
DB 06H
DB 0bH
DB 0cH
DB 0dH
DB 0bH
DB 06H
DB 09H
DB 0eH
DB 0aH
DB 09H
DB 0bH
DB 0cH
DB 0dH
DB 0bH
DB 0eH
DB 0aH
DB 0cH
DB 0eH
_pos2ctx_map8x4 DB 00H
DB 01H
DB 02H
DB 03H
DB 04H
DB 05H
DB 07H
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 09H
DB 08H
DB 06H
DB 07H
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 09H
DB 08H
DB 06H
DB 0cH
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 09H
DB 0dH
DB 0dH
DB 0eH
DB 0eH
_pos2ctx_map4x4 DB 00H
DB 01H
DB 02H
DB 03H
DB 04H
DB 05H
DB 06H
DB 07H
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 0cH
DB 0dH
DB 0eH
DB 0eH
_pos2ctx_map2x4c DB 00H
DB 00H
DB 01H
DB 01H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
_pos2ctx_map4x4c DB 00H
DB 00H
DB 00H
DB 00H
DB 01H
DB 01H
DB 01H
DB 01H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
_pos2ctx_map8x8i DB 00H
DB 01H
DB 01H
DB 02H
DB 02H
DB 03H
DB 03H
DB 04H
DB 05H
DB 06H
DB 07H
DB 07H
DB 07H
DB 08H
DB 04H
DB 05H
DB 06H
DB 09H
DB 0aH
DB 0aH
DB 08H
DB 0bH
DB 0cH
DB 0bH
DB 09H
DB 09H
DB 0aH
DB 0aH
DB 08H
DB 0bH
DB 0cH
DB 0bH
DB 09H
DB 09H
DB 0aH
DB 0aH
DB 08H
DB 0bH
DB 0cH
DB 0bH
DB 09H
DB 09H
DB 0aH
DB 0aH
DB 08H
DB 0dH
DB 0dH
DB 09H
DB 09H
DB 0aH
DB 0aH
DB 08H
DB 0dH
DB 0dH
DB 09H
DB 09H
DB 0aH
DB 0aH
DB 0eH
DB 0eH
DB 0eH
DB 0eH
DB 0eH
DB 0eH
_pos2ctx_map8x4i DB 00H
DB 01H
DB 02H
DB 03H
DB 04H
DB 05H
DB 06H
DB 03H
DB 04H
DB 05H
DB 06H
DB 03H
DB 04H
DB 07H
DB 06H
DB 08H
DB 09H
DB 07H
DB 06H
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 0cH
DB 0cH
DB 0aH
DB 0bH
DB 0dH
DB 0dH
DB 0eH
DB 0eH
DB 0eH
_pos2ctx_map4x8i DB 00H
DB 01H
DB 01H
DB 01H
DB 02H
DB 03H
DB 03H
DB 04H
DB 04H
DB 04H
DB 05H
DB 06H
DB 02H
DB 07H
DB 07H
DB 08H
DB 08H
DB 08H
DB 05H
DB 06H
DB 09H
DB 0aH
DB 0aH
DB 0bH
DB 0bH
DB 0bH
DB 0cH
DB 0dH
DB 0dH
DB 0eH
DB 0eH
DB 0eH
_pos2ctx_last8x8 DB 00H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 03H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 04H
DB 05H
DB 05H
DB 05H
DB 05H
DB 06H
DB 06H
DB 06H
DB 06H
DB 07H
DB 07H
DB 07H
DB 07H
DB 08H
DB 08H
DB 08H
DB 08H
_pos2ctx_last8x4 DB 00H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 01H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 03H
DB 03H
DB 03H
DB 03H
DB 04H
DB 04H
DB 04H
DB 04H
DB 05H
DB 05H
DB 06H
DB 06H
DB 07H
DB 07H
DB 08H
DB 08H
_pos2ctx_last4x4 DB 00H
DB 01H
DB 02H
DB 03H
DB 04H
DB 05H
DB 06H
DB 07H
DB 08H
DB 09H
DB 0aH
DB 0bH
DB 0cH
DB 0dH
DB 0eH
DB 0fH
_pos2ctx_last2x4c DB 00H
DB 00H
DB 01H
DB 01H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
DB 02H
_pos2ctx_last4x4c DB 00, 00, 00, 00, 01, 01, 01, 01, 02, 02, 02, 02, 02, 02, 02, 02
plus_one_clip0_4 DD 0,2,3,4,4
align 16
_QP_SCALE_CR DD 00H
DD 01H
DD 02H
DD 03H
DD 04H
DD 05H
DD 06H
DD 07H
DD 08H
DD 09H
DD 0aH
DD 0bH
DD 0cH
DD 0dH
DD 0eH
DD 0fH
DD 010H
DD 011H
DD 012H
DD 013H
DD 014H
DD 015H
DD 016H
DD 017H
DD 018H
DD 019H
DD 01aH
DD 01bH
DD 01cH
DD 01dH
DD 01dH
DD 01eH
DD 01fH
DD 020H
DD 020H
DD 021H
DD 022H
DD 022H
DD 023H
DD 023H
DD 024H
DD 024H
DD 025H
DD 025H
DD 025H
DD 026H
DD 026H
DD 026H
DD 027H
DD 027H
DD 027H
DD 027H
align 16
_51 DD 51
CONST ENDS
PUBLIC _biari_decode_symbol
_TEXT SEGMENT
dep = 4 ; size = 4
bi_ct = 8 ; size = 4
_biari_decode_symbol PROC
STACKOFFSET=0
mov edx, DWORD PTR dep[esp+STACKOFFSET] ; edx = dep
STACKOFFSET=STACKOFFSET+4
push ebx
mov ebx, DWORD PTR bi_ct[esp+STACKOFFSET] ; ebx = bi_ct
movzx eax, WORD PTR [ebx] ; eax = state
push ebp
push edi
STACKOFFSET = STACKOFFSET+8
mov edi, DWORD PTR [edx] ; edi = range
mov ecx, edi ; ecx = range
and ecx, 0C0H ; range >>= 6
movzx ebp, BYTE PTR _rLPS_table_64x4[ecx+eax] ; ebp = rLPS
; register state:
; eax: state (bi_ct->state)
; ebx: bi_ct
; edx: dep
; edi: range
; ebp: rLPS
mov ecx, DWORD PTR [edx+8] ; ecx = bitsleft
sub edi, ebp ; range -= rLPS
shl edi, cl ; range << bitsleft
cmp DWORD PTR [edx+4], edi ; value < (range << bitsleft)
jge SHORT CABAC@LPS
movzx ax, BYTE PTR _AC_next_state_MPS_64[eax] ; eax = state = AC_next_state_MPS_64[state]
shr edi, cl ; undo earlier shift
mov WORD PTR [ebx], ax ; bi_ct->MPS = state
cmp edi, 256 ; 00000100H
setb cl
; register state
; eax: state
; ebx: bi_ct
; ecx: state (old)
; edx: dep
; edi: range
; ebp: rLPS
shl edi, cl
sub DWORD PTR [edx+8], ecx ; dep->DbitsLeft--
mov DWORD PTR [edx], edi ; dep->Drange = range
movzx eax, BYTE PTR [ebx+2] ; return bit
jz SHORT READ_TWO_BYTES; if (dep->DbitsLeft==0)
pop edi
pop ebp
pop ebx
ret 0
align 16
CABAC@LPS:
sub DWORD PTR [edx+4], edi
movzx cx, BYTE PTR _AC_next_state_LPS_64[eax] ; cx: state = AC_next_state_LPS_64[state]
mov WORD PTR [ebx], cx ; store state back to bi_ct->MPS
; register state:
; eax: state (old)
; ebx: bi_ct
; ecx: state (new)
; edx: dep
; edi: range
; ebp: rLPS
mov edi, ebx
test eax, eax ; if state(old) == 0
movzx ecx, BYTE PTR _renorm_table_256[ebp] ; ecx = renorm_table_32[rLPS>>3]
sete bl ; bl = 1 [ if state(old) == 0 ]
movzx eax, BYTE PTR [edi+2]
xor eax, 1
xor BYTE PTR [edi+2], bl ; al ^= bi_ct->state
; register state:
; eax: !state
; ebx: bi_ct
; ecx: renorm
; edx: dep
; edi: range
; ebp: rLPS
shl ebp, cl ; ebp = range = rLPS <<= renorm
sub DWORD PTR [edx+8], ecx ; dep->DbitsLeft -= renorm;
mov DWORD PTR [edx], ebp ; dep->Drange = range;
jle SHORT READ_TWO_BYTES ; if( dep->DbitsLeft <= 0 )
; register state:
; eax: !state
; ebx: bi_ct
; ecx: renorm
; edx: dep
; edi: range
; ebp: range = rLPS <<= renorm
pop edi
pop ebp
pop ebx
ret 0
align 16
READ_TWO_BYTES:
; register state:
; eax: !state
; ebx: bi_ct
; ecx: renorm
; edx: dep
; edi: range
mov ebx, DWORD PTR [edx+16] ; eax = dep->Dcodestrm_len
mov ecx, DWORD PTR [ebx] ; ecx = *dep->Dcodestrm_len
lea edi, DWORD PTR [ecx+2] ; edi = *dep->Dcodestrm_len + 2
mov DWORD PTR [ebx], edi ; *dep->Dcodestrm_len += 2
mov ebx, DWORD PTR [edx+12] ; edx = dep->Dcodestrm
movzx ecx, WORD PTR [ebx+ecx]
xchg cl, ch
shl DWORD PTR [edx+4], 16
mov WORD PTR [edx+4], cx
add DWORD PTR [edx+8], 16 ; dep->DbitsLeft += 16
;mov eax, DWORD PTR _bit$[esp+STACKOFFSET] ; eax = bit = return value
pop edi
pop ebp
pop ebx
ret 0
_biari_decode_symbol ENDP
_TEXT ENDS
;
;
; a version of biari_decode_symbol slightly optimized
; pass dep in edx and ctx in eax. edx retains dep on exit
_TEXT SEGMENT
_biari_decode_symbol_map PROC NEAR
STACKOFFSET=0
push ebx
STACKOFFSET=4
movzx ebx, WORD PTR [eax] ; ebx = state
push ebp
push edi
STACKOFFSET = 12
mov edi, DWORD PTR [edx] ; edi = range
mov ecx, edi ; ecx = range
and ecx, 0C0H ; range >>= 6
movzx ebp, BYTE PTR _rLPS_table_64x4[ecx+ebx] ; ebp = rLPS
; register state:
; ebx: state (bi_ct->state)
; eax: bi_ct
; edx: dep
; edi: range
; ebp: rLPS
mov ecx, DWORD PTR [edx+8] ; ecx = bitsleft
sub edi, ebp ; range -= rLPS
shl edi, cl ; range << bitsleft
cmp DWORD PTR [edx+4], edi ; value < (range << bitsleft)
jge SHORT CABAC_OPT@LPS
; MPS
movzx bx, BYTE PTR _AC_next_state_MPS_64[ebx] ; ebx = state = AC_next_state_MPS_64[state]
shr edi, cl ; undo earlier shift
mov WORD PTR [eax], bx ; bi_ct->MPS = state
cmp edi, 256 ; 00000100H
setb cl
; register state
; ebx: state
; eax: bi_ct
; ecx: state (old)
; edx: dep
; edi: range
; ebp: rLPS
shl edi, cl
sub DWORD PTR [edx+8], ecx ; dep->DbitsLeft--
mov DWORD PTR [edx], edi ; dep->Drange = range
movzx eax, BYTE PTR [eax+2] ; return bit
jz SHORT READ_TWO_BYTES ; if (dep->DbitsLeft==0)
; register state
; ebx: state
; eax: bi_ct
; ecx: range<<1
; edx: dep
; edi: range
; ebp: rLPS
pop edi
pop ebp
pop ebx
ret 0
align 16
CABAC_OPT@LPS:
sub DWORD PTR [edx+4], edi
movzx cx, BYTE PTR _AC_next_state_LPS_64[ebx] ; cx: state = AC_next_state_LPS_64[state]
mov WORD PTR [eax], cx ; store state back to bi_ct->MPS
; register state:
; ebx: state (old)
; eax: bi_ct
; ecx: state (new)
; edx: dep
; edi: range
; ebp: rLPS
mov edi, eax
movzx eax, BYTE PTR [eax+2]
xor eax, 1
test ebx, ebx ; if state(old) == 0
movzx ecx, BYTE PTR _renorm_table_256[ebp] ; ecx = renorm_table_32[rLPS>>3]
sete bl ; bl = 1 [ if state(old) == 0 ]
xor BYTE PTR [edi+2], bl ; bl ^= bi_ct->state
; register state:
; ebx: !state
; eax: bi_ct
; ecx: renorm
; edx: dep
; edi: range
; ebp: rLPS
shl ebp, cl ; ebp = range = rLPS <<= renorm
sub DWORD PTR [edx+8], ecx ; dep->DbitsLeft -= renorm;
mov DWORD PTR [edx], ebp ; dep->Drange = range;
jle SHORT READ_TWO_BYTES ; if( dep->DbitsLeft <= 0 )
; register state:
; ebx: !state
; eax: bi_ct
; ecx: renorm
; edx: dep
; edi: range
; ebp: range = rLPS <<= renorm
pop edi
pop ebp
pop ebx
ret 0
align 16
READ_TWO_BYTES:
; register state:
; ebx: !state
; eax: bi_ct
; ecx: renorm
; edx: dep
; edi: range
mov ebx, DWORD PTR [edx+16] ; ebx = dep->Dcodestrm_len
mov ecx, DWORD PTR [ebx] ; ecx = *dep->Dcodestrm_len
lea edi, DWORD PTR [ecx+2] ; edi = *dep->Dcodestrm_len + 2
mov DWORD PTR [ebx], edi ; *dep->Dcodestrm_len += 2
mov ebx, DWORD PTR [edx+12] ; edx = dep->Dcodestrm
movzx ecx, WORD PTR [ebx+ecx]
xchg cl, ch
shl DWORD PTR [edx+4], 16
mov WORD PTR [edx+4], cx
add DWORD PTR [edx+8], 16 ; dep->DbitsLeft += 16
pop edi
pop ebp
pop ebx
ret 0
_biari_decode_symbol_map ENDP
_TEXT ENDS
; ebx, ebp and edi are NOT preserved
; pass tex_ctx in ebp
; pass type in ebx
; pass dep in edx
; pass coeff in edi
SigCoefFunction MACRO MaxC2, TypeCtxOne, TypeCtxAbs, MaxPos
_abs_contexts$ = 28 ; local variable (safe because of how the function is called)
_one_contexts$ = 32 ; local variable (safe because of how the function is called)
STACKOFFSET=0
lea eax, DWORD PTR [ebp+TypeCtxOne*20+6068] ; 6068 = offsetof(tex_ctx, one_contexts)
mov DWORD PTR _one_contexts$[esp+STACKOFFSET], eax ; one_contexts = tex_ctx->one_contexts[type2ctx_one[type]];
;push esi
STACKOFFSET=STACKOFFSET+0
;esi: i (loop variable) = maxpos[type]
lea ecx, DWORD PTR [ebp+TypeCtxAbs*20+6508]
mov ebp, 1 ; ebp: c1
xor ebx, ebx ; ebx: c2
mov DWORD PTR _abs_contexts$[esp+STACKOFFSET], ecx ; abs_contexts = tex_ctx->abs_contexts[type2ctx_abs[type]];
SIGN_COEFF@LOOP_AGAIN:
cmp WORD PTR [edi+esi*2], 0 ;if (coeff[i]!=0)
je SHORT SIGN_COEFF@LOOP_ITR
mov ecx, DWORD PTR _one_contexts$[esp+STACKOFFSET]
lea eax, DWORD PTR [ecx+ebp*4]
mov ebp, DWORD PTR plus_one_clip0_4[ebp*4] ; c1 = plus_one_clip0_4[c1];
call _biari_decode_symbol_map ; biari_decode_symbol (dep_dp, one_contexts + c1);
test eax, eax
jz SHORT SIGN_COEFF@DECODE_EQ_PROB
;add WORD PTR [edi+esi*2], ax ; coeff[i] +=
mov ecx, DWORD PTR _abs_contexts$[esp+STACKOFFSET]
lea eax, DWORD PTR [ecx+ebx*4]
call _unary_exp_golomb_level_decode ;unary_exp_golomb_level_decode (dep_dp, abs_contexts + c2);
inc eax
add WORD PTR [edi+esi*2], ax ; coeff[i] += return val
xor ebp, ebp ; c1 = 0
mov ebx, DWORD PTR MaxC2[ebx*4]
SIGN_COEFF@DECODE_EQ_PROB:
call _biari_decode_symbol_eq_prob_asm ; biari_decode_symbol_eq_prob(dep_dp)
js SHORT SIGN_COEFF@LOOP_ITR
neg WORD PTR [edi+esi*2]
SIGN_COEFF@LOOP_ITR:
sub esi, 1
jns SHORT SIGN_COEFF@LOOP_AGAIN
pop esi
ret 0
ENDM
_TEXT SEGMENT
_read_significant_coefficients0 PROC
SigCoefFunction plus_one_clip4, 0, 0, 15
_read_significant_coefficients0 ENDP
_read_significant_coefficients1 PROC
SigCoefFunction plus_one_clip4, 1, 1, 14
_read_significant_coefficients1 ENDP
_read_significant_coefficients2 PROC
SigCoefFunction plus_one_clip4, 2, 2, 63
_read_significant_coefficients2 ENDP
_read_significant_coefficients3 PROC
SigCoefFunction plus_one_clip4, 3, 3, 31
_read_significant_coefficients3 ENDP
_read_significant_coefficients4 PROC
SigCoefFunction plus_one_clip4, 3, 3, 31
_read_significant_coefficients4 ENDP
_read_significant_coefficients5 PROC
SigCoefFunction plus_one_clip4, 4, 4, 15
_read_significant_coefficients5 ENDP
_read_significant_coefficients6 PROC
SigCoefFunction plus_one_clip3, 5, 5, 3
_read_significant_coefficients6 ENDP
_read_significant_coefficients7 PROC
SigCoefFunction plus_one_clip4, 6, 6, 14
_read_significant_coefficients7 ENDP
_read_significant_coefficients8 PROC
SigCoefFunction plus_one_clip3, 5, 5, 7
_read_significant_coefficients8 ENDP
_read_significant_coefficients9 PROC
SigCoefFunction plus_one_clip4, 5, 5, 15
_read_significant_coefficients9 ENDP
_read_significant_coefficients10 PROC
SigCoefFunction plus_one_clip4, 10, 10, 15
_read_significant_coefficients10 ENDP
_read_significant_coefficients11 PROC
SigCoefFunction plus_one_clip4, 11, 11, 14
_read_significant_coefficients11 ENDP
_read_significant_coefficients12 PROC
SigCoefFunction plus_one_clip4, 12, 12, 63
_read_significant_coefficients12 ENDP
_read_significant_coefficients13 PROC
SigCoefFunction plus_one_clip4, 13, 13, 31
_read_significant_coefficients13 ENDP
_read_significant_coefficients14 PROC
SigCoefFunction plus_one_clip4, 13, 13, 31
_read_significant_coefficients14 ENDP
_read_significant_coefficients15 PROC
SigCoefFunction plus_one_clip4, 14, 14, 15
_read_significant_coefficients15 ENDP
_read_significant_coefficients16 PROC
SigCoefFunction plus_one_clip4, 16, 16, 15
_read_significant_coefficients16 ENDP
_read_significant_coefficients17 PROC
SigCoefFunction plus_one_clip4, 17, 17, 14
_read_significant_coefficients17 ENDP
_read_significant_coefficients18 PROC
SigCoefFunction plus_one_clip4, 18, 18, 63
_read_significant_coefficients18 ENDP
_read_significant_coefficients19 PROC
SigCoefFunction plus_one_clip4, 19, 19, 31
_read_significant_coefficients19 ENDP
_read_significant_coefficients20 PROC
SigCoefFunction plus_one_clip4, 19, 19, 31
_read_significant_coefficients20 ENDP
_read_significant_coefficients21 PROC
SigCoefFunction plus_one_clip4, 20, 20, 15
_read_significant_coefficients21 ENDP
_TEXT ENDS
;
; push eax ; currSlice->coeff
; push ecx ; tex_ctx
; edi is NOT preserved
; pass currMB in edi
; pass dep in ebp
; pass type in ebx
; on return, edi contains coeff, edx contains dep
SigMapFunction MACRO PosCtxMap, TypeCtxLast, IsDC, MaxPos, PosCtxLast, TypeCtxMap, Func
last_ctx$ = 24 ; local variable (cheating and using stack space from _readRunLevel_CABAC)
coeff_ctr$ = 28 ; local variable (cheating and using stack space from _readRunLevel_CABAC)
STACKOFFSET=0
mov edx, DWORD PTR [edi+p_Vid@Macroblock] ; edx: p_Vid
push esi
xor esi, esi
STACKOFFSET=STACKOFFSET+4
mov edx, DWORD PTR [edx+structure@VideoParameters]
add edx, DWORD PTR [edi+mb_field@Macroblock] ; currMB->mb_field
mov edi, eax ; edi: coeff
mov eax, 1408 ; 16 * 22 * sizeof(BiContextType)
cmovz eax, esi
mov edx, OFFSET PosCtxMap
cmovnz edx, DWORD PTR _pos2ctx_map_int[ebx*4]
IF IsDC EQ 0
lea ebx, [edx + 1]
ELSE
mov ebx, edx ; pos2ctx_Map = (fld) ? pos2ctx_map_int[type] : pos2ctx_map[type];
ENDIF
mov edx, ebp
lea ebp, [eax+ecx+TypeCtxMap*64+map_contexts@TextureInfoContexts] ; map_ctx = tex_ctx->map_contexts[fld][type2ctx_map [type]];
lea ecx, DWORD PTR [eax+ecx+TypeCtxLast*64+last_contexts@TextureInfoContexts]
mov DWORD PTR last_ctx$[esp+STACKOFFSET], ecx ; last_ctx = tex_ctx->last_contexts[fld][type2ctx_last[type]];
mov DWORD PTR coeff_ctr$[esp+STACKOFFSET], esi; coeff_ctr = 0
;jne LOOP_AGAIN
; esi: i
; ebx: i1 (loop end)
; ebp: dep_dp
; edi: coeff
; for (i=i0; i < i1; ++i) // if last coeff is reached, it has to be significant
LOOP_AGAIN:
; --- read significance symbol ---
; if (biari_decode_symbol (dep_dp, map_ctx + pos2ctx_Map[i]))
movzx eax, BYTE PTR [esi+ebx]
lea eax, DWORD PTR [ebp+eax*4]
call _biari_decode_symbol_map
test eax, eax
mov WORD PTR [edi+esi*2], ax ; coeff[i] = biari_decode_symbol()
je SHORT LOOP_ITR
; --- read last coefficient symbol ---
; if (biari_decode_symbol (dep_dp, last_ctx + last[i]))
inc DWORD PTR coeff_ctr$[esp+STACKOFFSET] ; coeff_ctr++
IF IsDC EQ 0
movzx ecx, BYTE PTR PosCtxLast[esi+1]
ELSE
movzx ecx, BYTE PTR PosCtxLast[esi]
ENDIF
mov eax, DWORD PTR last_ctx$[esp+STACKOFFSET]
lea eax, DWORD PTR [eax+ecx*4]
call _biari_decode_symbol_map
test eax, eax
je SHORT LOOP_ITR
mov eax, DWORD PTR coeff_ctr$[esp+STACKOFFSET]; return coeff_ctr;
mov ecx, DWORD PTR [esp]
mov ebp, DWORD PTR [ecx+tex_ctx@Slice] ; ; edx: currSlice->tex_ctx
mov DWORD PTR [ecx+coeff_ctr@Slice], eax ; currSlice->coeff_ctr = return value (read_significance_map)
jmp Func
align 16
LOOP_ITR:
inc esi
cmp esi, MaxPos
jl SHORT LOOP_AGAIN
mov eax, DWORD PTR coeff_ctr$[esp+STACKOFFSET]
mov WORD PTR [edi+esi*2], 1
inc eax
mov ecx, DWORD PTR [esp]
mov ebp, DWORD PTR [ecx+tex_ctx@Slice] ; ; edx: currSlice->tex_ctx
mov DWORD PTR [ecx+coeff_ctr@Slice], eax ; currSlice->coeff_ctr = return value (read_significance_map)
jmp Func
ENDM
_TEXT SEGMENT
_read_significance_map0 PROC
SigMapFunction _pos2ctx_map4x4, 0, 1, 15, _pos2ctx_last4x4, 0, _read_significant_coefficients0
_read_significance_map0 ENDP
_read_significance_map1 PROC
SigMapFunction _pos2ctx_map4x4, 1, 0, 14, _pos2ctx_last4x4, 1, _read_significant_coefficients1
_read_significance_map1 ENDP
_read_significance_map2 PROC
SigMapFunction _pos2ctx_map8x8, 2, 1, 63, _pos2ctx_last8x8, 2, _read_significant_coefficients2
_read_significance_map2 ENDP
_read_significance_map3 PROC
SigMapFunction _pos2ctx_map8x4, 3, 1, 31, _pos2ctx_last8x4, 3, _read_significant_coefficients3
_read_significance_map3 ENDP
_read_significance_map4 PROC
SigMapFunction _pos2ctx_map8x4, 4, 1, 31, _pos2ctx_last8x4, 4, _read_significant_coefficients4
_read_significance_map4 ENDP
_read_significance_map5 PROC
SigMapFunction _pos2ctx_map4x4, 5, 1, 15, _pos2ctx_last4x4, 5, _read_significant_coefficients5
_read_significance_map5 ENDP
_read_significance_map6 PROC
SigMapFunction _pos2ctx_map4x4, 6, 1, 3, _pos2ctx_last4x4, 6, _read_significant_coefficients6
_read_significance_map6 ENDP
_read_significance_map7 PROC
SigMapFunction _pos2ctx_map4x4, 7, 0, 14, _pos2ctx_last4x4, 7, _read_significant_coefficients7
_read_significance_map7 ENDP
_read_significance_map8 PROC
SigMapFunction _pos2ctx_map2x4c, 6, 1, 7, _pos2ctx_last2x4c, 6, _read_significant_coefficients8
_read_significance_map8 ENDP
_read_significance_map9 PROC
SigMapFunction _pos2ctx_map4x4c, 6, 1, 15, _pos2ctx_last4x4c, 6, _read_significant_coefficients9
_read_significance_map9 ENDP
_read_significance_map10 PROC
SigMapFunction _pos2ctx_map4x4, 10, 1, 15, _pos2ctx_last4x4, 10, _read_significant_coefficients10
_read_significance_map10 ENDP
_read_significance_map11 PROC
SigMapFunction _pos2ctx_map4x4, 11, 0, 14, _pos2ctx_last4x4, 11, _read_significant_coefficients11
_read_significance_map11 ENDP
_read_significance_map12 PROC
SigMapFunction _pos2ctx_map8x8, 12, 1, 63, _pos2ctx_last8x8, 12, _read_significant_coefficients12
_read_significance_map12 ENDP
_read_significance_map13 PROC
SigMapFunction _pos2ctx_map8x4, 13, 1, 31, _pos2ctx_last8x4, 13, _read_significant_coefficients13
_read_significance_map13 ENDP
_read_significance_map14 PROC
SigMapFunction _pos2ctx_map8x4, 14, 1, 31, _pos2ctx_last8x4, 14, _read_significant_coefficients14
_read_significance_map14 ENDP
_read_significance_map15 PROC
SigMapFunction _pos2ctx_map4x4, 15, 1, 15, _pos2ctx_last4x4, 15, _read_significant_coefficients15
_read_significance_map15 ENDP
_read_significance_map16 PROC
SigMapFunction _pos2ctx_map4x4, 16, 1, 15, _pos2ctx_last4x4, 16, _read_significant_coefficients16
_read_significance_map16 ENDP
_read_significance_map17 PROC
SigMapFunction _pos2ctx_map4x4, 17, 0, 14, _pos2ctx_last4x4, 17, _read_significant_coefficients17
_read_significance_map17 ENDP
_read_significance_map18 PROC
SigMapFunction _pos2ctx_map8x8, 18, 1, 63, _pos2ctx_last8x8, 18, _read_significant_coefficients18
_read_significance_map18 ENDP
_read_significance_map19 PROC
SigMapFunction _pos2ctx_map8x4, 19, 1, 31, _pos2ctx_last8x4, 19, _read_significant_coefficients19
_read_significance_map19 ENDP
_read_significance_map20 PROC
SigMapFunction _pos2ctx_map8x4, 20, 1, 31, _pos2ctx_last8x4, 20, _read_significant_coefficients20
_read_significance_map20 ENDP
_read_significance_map21 PROC
SigMapFunction _pos2ctx_map4x4, 21, 1, 15, _pos2ctx_last4x4, 21, _read_significant_coefficients21
_read_significance_map21 ENDP
_TEXT ENDS
_TEXT SEGMENT
; edx: dep - unchanged by function
; SF holds the return value
_biari_decode_symbol_eq_prob_asm PROC
mov ecx, DWORD PTR [edx+8]; dep->DbitsLeft
dec ecx ; dep->DbitsLeft--
mov eax, DWORD PTR [edx+4] ; eax: dep->DValue
push esi
jnz SHORT $LN3@biari_deco; if(--(dep->DbitsLeft) == 0)
mov ecx, DWORD PTR [edx+16] ; ebp: dep->Dcodestrm_len
mov esi, DWORD PTR [ecx] ; esi: *dep->Dcodestrm_len
add DWORD PTR [ecx], 2 ; *dep->Dcodestrm_len += 2
mov ecx, DWORD PTR [edx+12] ; ebp: dep->Dcodestrm
shl eax, 16
mov ax, WORD PTR [ecx+esi] ; value = (value << 16) | getword( dep )
xchg ah, al
mov ecx, 16 ; dep->DbitsLeft = 16;
$LN3@biari_deco:
mov esi, DWORD PTR [edx] ; dep->Drange
shl esi, cl ; (dep->Drange << dep->DbitsLeft)
mov DWORD PTR [edx+8], ecx
mov ecx, eax
sub ecx, esi
pop esi
cmovns eax, ecx ; if (tmp_value <0) value = tmp_value
mov DWORD PTR [edx+4], eax ; dep->Dvalue = value;
ret 0
_biari_decode_symbol_eq_prob_asm ENDP
_TEXT ENDS
_TEXT SEGMENT
; edx: dep. retained on return
; esi and ebp are NOT retained, because the (only) calling function doesn't need them to be
_exp_golomb_decode_eq_prob0 PROC
STACKOFFSET=0
xor esi, esi ; esi: binary_symbol
xor ebp, ebp ; ebp: symbol
push edi
mov edi, 1 ; edi: k
DECODE_EQ@LOOP_AGAIN:
call _biari_decode_symbol_eq_prob_asm ; l = biari_decode_symbol_eq_prob(dep_dp);
js SHORT DECODE_EQ@LOOP_DONE
add ebp, edi ; symbol += k
shl edi, 1 ; k <<= 1
jmp SHORT DECODE_EQ@LOOP_AGAIN
align 16
DECODE_EQ@LOOP_DONE:
shr edi, 1
jz SHORT DECODE_EQ@RETURN
call _biari_decode_symbol_eq_prob_asm ; if (biari_decode_symbol_eq_prob(dep_dp)==1)
js SHORT DECODE_EQ@LOOP_DONE
or esi, edi ; binary_symbol |= (1<<k);
jmp SHORT DECODE_EQ@LOOP_DONE
align 16
DECODE_EQ@RETURN:
lea eax, DWORD PTR [esi+ebp+13] ; return (unsigned int) (symbol + binary_symbol);
pop edi
ret 0
_exp_golomb_decode_eq_prob0 ENDP
_TEXT ENDS
;
;
; pass dep in edx, context in eax
; edx is retained on return
; ebp is destroyed
_TEXT SEGMENT
ctx = 4 ; second parameter
_unary_exp_golomb_level_decode PROC
STACKOFFSET=0
mov ebp, eax ; eax (and now ebp also) contains the context pointer
call _biari_decode_symbol_map
test eax, eax ; if (symbol==0)
jne SHORT SYMBOL_NOT_ZERO
ret 0
align 16
SYMBOL_NOT_ZERO:
push esi
xor esi, esi
LEVEL_DECODE@LOOP_AGAIN:
mov eax, ebp ; _biari_decode_symbol_map wants ctx in eax
inc esi ; ++symbol;
call _biari_decode_symbol_map ; l = biari_decode_symbol(dep_dp, ctx);
test eax, eax ; if (!l)
je SHORT LEVEL_IS_ZERO
cmp esi, 12 ; exp_start-1
jb SHORT LEVEL_DECODE@LOOP_AGAIN
call _exp_golomb_decode_eq_prob0 ; exp_golomb_decode_eq_prob(dep_dp,0)
pop esi
ret 0
align 16
LEVEL_IS_ZERO:
mov eax, esi ; return symbol;
pop esi
ret 0
_unary_exp_golomb_level_decode ENDP
_TEXT ENDS
CONST SEGMENT
sigmap_functions DD FLAT:_read_significance_map0
DD FLAT:_read_significance_map1
DD FLAT:_read_significance_map2
DD FLAT:_read_significance_map3
DD FLAT:_read_significance_map4
DD FLAT:_read_significance_map5
DD FLAT:_read_significance_map6
DD FLAT:_read_significance_map7
DD FLAT:_read_significance_map8
DD FLAT:_read_significance_map9
DD FLAT:_read_significance_map10
DD FLAT:_read_significance_map11
DD FLAT:_read_significance_map12
DD FLAT:_read_significance_map13
DD FLAT:_read_significance_map14
DD FLAT:_read_significance_map15
DD FLAT:_read_significance_map16
DD FLAT:_read_significance_map17
DD FLAT:_read_significance_map18
DD FLAT:_read_significance_map19
DD FLAT:_read_significance_map20
DD FLAT:_read_significance_map21
CONST ENDS
PUBLIC _readRunLevel_CABAC
_TEXT SEGMENT
_currMB$ = 4 ; first parameter
_dep_dp$ = 8 ; second parameter
_context$ = 12 ; third parameter
_readRunLevel_CABAC PROC
push esi
push edi
STACKOFFSET=8
mov edi, DWORD PTR _currMB$[esp+STACKOFFSET] ; edi: currMB
mov esi, DWORD PTR [edi] ; esi: currSlice = currMB->p_Slice;
cmp DWORD PTR [esi+coeff_ctr@Slice], 0 ; if (currSlice->coeff_ctr >= 0)
jge SHORT SET_RUN_AND_LEVEL
; ===== decode CBP-BIT =====
mov eax, DWORD PTR [edi+read_and_store_CBP_block_bit@Macroblock] ; eax: currMB->read_and_store_CBP_block_bit
push ebx
STACKOFFSET=STACKOFFSET+4
mov ebx, DWORD PTR _context$[esp+STACKOFFSET] ; ebx: context
push ebp
STACKOFFSET=STACKOFFSET+4
mov ebp, DWORD PTR _dep_dp$[esp+STACKOFFSET] ; ebp: dep
push ebx ; context
push ebp ; dep
push edi ; currMB
call eax ; currMB->read_and_store_CBP_block_bit(currMB, dep_dp, context)
add esp, 12
mov DWORD PTR [esi+coeff_ctr@Slice], eax ; currSlice->coeff_ctr = return value
test eax, eax ; if (currSlice->coeff_ctr == 0)
je SHORT SET_RUN_AND_LEVEL_POP
; ===== decode significance coefficients =====
mov ecx, DWORD PTR [esi+tex_ctx@Slice] ; ecx: currSlice->tex_ctx
lea eax, DWORD PTR [esi+coeff@Slice] ; eax: currSlice->coeff
;push eax ; currSlice->coeff
;push ecx ; tex_ctx
;call _read_significance_map ; read_significance_map(currSlice->tex_ctx, currMB, dep_dp, context, currSlice->coeff);
call sigmap_functions[ebx*4]
SET_RUN_AND_LEVEL_POP:
pop ebp
pop ebx
STACKOFFSET=STACKOFFSET-8
SET_RUN_AND_LEVEL:
; --- set run and level ---
xor edx, edx ; edx: 0
dec DWORD PTR [esi+coeff_ctr@Slice] ; if (currSlice->coeff_ctr--)
js SHORT EOB
; --- set run and level (coefficient) ---
mov ecx, DWORD PTR [esi+pos@Slice] ; ecx: currSlice->pos
xor edi, edi ; edi: run=0
cmp WORD PTR [esi+ecx*2+coeff@Slice], dx ; currSlice->coeff[currSlice->pos] == 0
jne SHORT LOOP_END
LOOP_ITR:
cmp WORD PTR [esi+ecx*2+1+coeff@Slice], dx ; currSlice->coeff[currSlice->pos] == 0
lea ecx, [ecx+1]
lea edi, [edi+1]
je SHORT LOOP_ITR
LOOP_END:
movsx eax, WORD PTR [esi+ecx*2+coeff@Slice] ; eax: value = currSlice->coeff[currSlice->pos]
inc ecx ; currSlice->pos++
; --- decrement coefficient counter and re-set position ---
;cmp DWORD PTR [esi+coeff_ctr@Slice], edx ; if (currSlice->coeff_ctr == 0)
;cmove ecx, edx ; currSlice->pos = 0
mov edx, edi
pop edi
mov DWORD PTR [esi+pos@Slice], ecx ; store currSlice->pos
pop esi
ret 0 ; eax contains value
align 16
EOB:
xor eax, eax ; return 0
mov DWORD PTR [esi+pos@Slice], edx ; currSlice->pos = 0;
pop edi
pop esi
ret 0
_readRunLevel_CABAC ENDP
_TEXT ENDS
;
; edi is not saved
; pass dep_dp in edx, retained on exit
; pass ctx in edi
; return value in esi
PUBLIC _unary_exp_golomb_mv_decode3
_TEXT SEGMENT
_ctx$ = 4 ; second parameter
_unary_exp_golomb_mv_decode3 PROC
STACKOFFSET=0
mov eax, edi
call _biari_decode_symbol_map ; pass dep in edx and ctx in eax. edx retains dep on exit
test eax, eax ; if (symbol)
jne SHORT SYMBOL_NOT_ZERO
xor esi, esi
ret 0
align 16
SYMBOL_NOT_ZERO:
push ebp
STACKOFFSET=STACKOFFSET+4
mov ebp, 3
add edi, 4 ; ctx++
mov esi, 1 ; esi: symbol
LOOP_START:
mov eax, edi
call _biari_decode_symbol_map ; pass dep in edx and ctx in eax. edx retains dep on exit
test eax, eax
je SHORT SYMBOL_ZERO_RETURN
inc esi
cmp esi, 2 ; if (symbol == 2)
sete al ; eax will be 1, so this is safe to do
lea edi, [edi + eax*4] ; ctx += (symbol == 2)
cmp esi, ebp ; if (symbol == max_bin)
sete al ; eax will have nothing set high, so this is safe to do
lea edi, [edi + eax*4] ; ctx += (symbol != max_bin)
cmp esi, 8 ; if (symbol < exp_start)
jb SHORT LOOP_START
; return exp_start + exp_golomb_decode_eq_prob(dep_dp,3);
xor ebp, ebp ; ebp: symbol
mov edi, ebp ; edi: binary_symbol
DECODE_EQ3@LOOP1:
call _biari_decode_symbol_eq_prob_asm ; edx holds dep_dp
js SHORT DECODE_EQ3@LOOP2
or ebp, esi; symbol += (l<<k)
shl esi, 1 ; k <<= 1
jmp SHORT DECODE_EQ3@LOOP1
align 16
DECODE_EQ3@LOOP2:
shr esi, 1
jz SHORT DECODE_EQ3@RETURN
call _biari_decode_symbol_eq_prob_asm
js SHORT DECODE_EQ3@LOOP2
or edi, esi ; binary_symbol |= (1<<k);
jmp SHORT DECODE_EQ3@LOOP2
align 16
DECODE_EQ3@RETURN:
; return (unsigned int) (symbol + binary_symbol);
lea esi, [edi+ebp+8]
pop ebp
ret 0
align 16
SYMBOL_ZERO_RETURN:
; return symbol is in esi
pop ebp
ret 0
_unary_exp_golomb_mv_decode3 ENDP
_TEXT ENDS
_TEXT SEGMENT
_unary_bin_decode1 PROC
; _ctx$ = eax
; _dep_dp$ = edx
push edi
mov edi, eax
call _biari_decode_symbol_map ; biari_decode_symbol(dep_dp, ctx );
test eax, eax ; if (symbol)
jne SHORT $LN5@unary_bin_@2
mov eax, 2
shr eax, 1
pop edi
ret 0
align 16
$LN5@unary_bin_@2:
xor esi, esi ; symbol = 0;
$LL3@unary_bin_@2:
inc esi ; ++symbol;
lea eax, DWORD PTR [edi+4] ; ctx + ctx_offset
call _biari_decode_symbol_map ; biari_decode_symbol(dep_dp, ctx);
test eax, eax ; while( l != 0 );
jne SHORT $LL3@unary_bin_@2
lea eax, [esi + 2]; return symbol+2;
shr eax, 1
pop edi
ret 0
_unary_bin_decode1 ENDP
_TEXT ENDS
PUBLIC _readDquant_CABAC
_TEXT SEGMENT
_currSlice$ = 4 ; first parameter
_dep_dp$ = 8 ; second parameter
_readDquant_CABAC PROC
STACKOFFSET=0
; 815 : MotionInfoContexts *ctx = currSlice->mot_ctx;
; 816 : short dquant;
; 817 : int act_ctx = ((currSlice->last_dquant != 0) ? 1 : 0);
; 818 : int act_sym = biari_decode_symbol(dep_dp,ctx->delta_qp_contexts + act_ctx );
mov edx, DWORD PTR _dep_dp$[esp+STACKOFFSET]
push esi
push edi
STACKOFFSET = STACKOFFSET + 8
mov edi, DWORD PTR _currSlice$[esp+STACKOFFSET]
mov esi, DWORD PTR [edi+mot_ctx@Slice]
xor eax, eax
cmp DWORD PTR [edi+last_dquant@Slice], eax
setne al
lea eax, DWORD PTR [esi+eax*4+332]
; pass dep in edx and ctx in eax. edx retains dep on exit
call _biari_decode_symbol_map
test eax, eax ; if (!act_sym)
jz SHORT $LN2@readDquant
lea eax, DWORD PTR [esi+340] ; unary_bin_decode(dep_dp,ctx->delta_qp_contexts + 2,1);
call _unary_bin_decode1
jnc SHORT $LN2@readDquant ; lsb is signed bit
neg eax ; dquant = -dquant;
movzx eax, ax
$LN2@readDquant:
movsx edx, ax
mov DWORD PTR [edi+last_dquant@Slice], edx ; currSlice->last_dquant = dquant;
pop edi
pop esi
;mov ax, cx ; return dquant;
ret 0
_readDquant_CABAC ENDP
_TEXT ENDS
PUBLIC _readIntraPredMode_CABAC
_TEXT SEGMENT
_currSlice$ = 4 ; first parameter
_dep_dp$ = 8 ; second parameter
_readIntraPredMode_CABAC PROC
; 720 : TextureInfoContexts *ctx =
STACKOFFSET=0
mov eax, DWORD PTR _currSlice$[esp + STACKOFFSET]
push esi
mov esi, DWORD PTR [eax+100] ; currSlice->tex_ctx;
STACKOFFSET=4
; 721 : int act_sym;
; 722 :
; 723 : // use_most_probable_mode
; 724 : act_sym = biari_decode_symbol(dep_dp, ctx->ipr_contexts);
mov edx, DWORD PTR _dep_dp$[esp+STACKOFFSET]
lea eax, DWORD PTR [esi+12]
call _biari_decode_symbol_map
; remaining_mode_selector
test eax, eax ; if (act_sym == 0)
jz SHORT $LN2@readIntraP
or eax, -1 ; return -1;
pop esi
ret 0
align 16
$LN2@readIntraP:
push ebx
add esi, 16 ; 00000010H
mov eax, esi
call _biari_decode_symbol_map
mov ebx, eax
; 735 : pred_mode |= (biari_decode_symbol(dep_dp, ctx->ipr_contexts+1) << 1);
mov eax, esi
call _biari_decode_symbol_map
lea ebx, [ebx+2*eax]
; 736 : pred_mode |= (biari_decode_symbol(dep_dp, ctx->ipr_contexts+1) << 2);
mov eax, esi
call _biari_decode_symbol_map
lea eax, [ebx+4*eax] ; return pred_mode;
pop ebx
pop esi
ret 0
_readIntraPredMode_CABAC ENDP
_TEXT ENDS
PUBLIC _readMB_skip_flagInfo_CABAC
_TEXT SEGMENT
_currMB$ = 4 ; first parameter
_dep_dp$ = 12 ; size = 4
_readMB_skip_flagInfo_CABAC PROC
; 406 : Slice *currSlice = currMB->p_Slice;
STACKOFFSET=0
mov ecx, DWORD PTR _currMB$[esp + STACKOFFSET]
push ebp
xor eax, eax
push esi
mov esi, DWORD PTR [ecx + p_Slice@Macroblock] ; esi: currSlice
cmp DWORD PTR [esi+slice_type@Slice], 1 ; int bframe=(currSlice->slice_type == B_SLICE);
push edi
mov edi, DWORD PTR [esi+mot_ctx@Slice] ; edi: ctx = currSlice->mot_ctx;
sete al ; int bframe=(currSlice->slice_type == B_SLICE);
; 409 : int a = (currMB->mb_left != NULL) ? (currMB->mb_left->skip_flag == 0) : 0;
xor edx, edx
mov ebp, eax
mov eax, DWORD PTR [ecx+104]
test eax, eax
je SHORT READ_B
cmp DWORD PTR [eax+348], edx
sete dl
; 410 : int b = (currMB->mb_up != NULL) ? (currMB->mb_up ->skip_flag == 0) : 0;
READ_B:
mov ecx, DWORD PTR [ecx+100]
xor eax, eax
test ecx, ecx
je SHORT $LN9@readMB_ski
cmp DWORD PTR [ecx+348], eax
sete al
$LN9@readMB_ski:
; 414 : if (bframe)
; 415 : {
; 416 : act_ctx = 7 + a + b;
; 418 : skip = biari_decode_symbol (dep_dp, &ctx->mb_type_contexts[2][act_ctx]);
add eax, edx
test ebp, ebp
mov edx, DWORD PTR _dep_dp$[esp+8]
je SHORT $LN3@readMB_ski
lea eax, DWORD PTR [edi+eax*4+116]
jmp SHORT $LN11@readMB_ski
align 16
$LN3@readMB_ski:
; 422 : act_ctx = a + b;
; 424 : skip = biari_decode_symbol(dep_dp, &ctx->mb_type_contexts[1][act_ctx]);
lea eax, DWORD PTR [edi+eax*4+44]
$LN11@readMB_ski:
call _biari_decode_symbol_map
test eax, eax ; if (!skip)
je SHORT $LN1@readMB_ski
; 429 : currSlice->last_dquant = 0;
mov DWORD PTR [esi + last_dquant@Slice], 0
$LN1@readMB_ski:
pop edi
pop esi
pop ebp
ret 0
_readMB_skip_flagInfo_CABAC ENDP
_TEXT ENDS
PUBLIC _set_chroma_qp
_TEXT SEGMENT
_currMB$ = 4 ; first parameter
_set_chroma_qp PROC
mov eax, DWORD PTR _currMB$[esp] ; eax: currMB
mov ecx, DWORD PTR [eax+4] ; ecx: currMB->p_Vid
mov edx, DWORD PTR [ecx+bitdepth_chroma_qp_scale@VideoParameters] ; edx: p_Vid->bitdepth_chroma_qp_scale;
push edi
mov edi, DWORD PTR [ecx+dec_picture@VideoParameters] ; edi: p_Vid->dec_picture
mov ecx, DWORD PTR [edi+chroma_qp_offset@StorablePicture] ; ecx: dec_picture->chroma_qp_offset[0]
add ecx, DWORD PTR [eax+qp@macroblock] ; ecx: dec_picture->chroma_qp_offset[0] + currMB->qp
neg edx ; edx: -p_Vid->bitdepth_chroma_qp_scale;
cmp ecx, edx
cmovl ecx, edx
cmp ecx, 51
cmovg ecx, DWORD PTR _51 ; cmov doesn't allow for immediates
test ecx, ecx
cmovge ecx, DWORD PTR _QP_SCALE_CR[ecx*4]
mov DWORD PTR [eax+64], ecx
sub ecx, edx; currMB->qpc[0] + p_Vid->bitdepth_chroma_qp_scale;
mov DWORD PTR [eax+qp_scaled@Macroblock + 4], ecx ; currMB->qp_scaled[1]
mov ecx, DWORD PTR [edi+chroma_qp_offset@StorablePicture + 4]
add ecx, DWORD PTR [eax+qp@macroblock]
cmp ecx, edx
cmovl ecx, edx
cmp ecx, 51
cmovg ecx, DWORD PTR _51 ; cmov doesn't allow for immediates
test ecx, ecx
cmovge ecx, DWORD PTR _QP_SCALE_CR[ecx*4]
mov DWORD PTR [eax+64+4], ecx
sub ecx, edx
pop edi
mov DWORD PTR [eax+72 + 8], ecx
ret 0
_set_chroma_qp ENDP
_TEXT ENDS
PUBLIC _decodeMVD_CABAC
_TEXT SEGMENT
_dep_dp$ = 4 ; first parameter
_mv_ctx$ = 8 ; second parameter
_act_ctx$ = 12; third parameter
_err$ = 16 ; 4th parameter
_decodeMVD_CABAC PROC
STACKOFFSET = 0
mov eax, DWORD PTR _act_ctx$[esp+STACKOFFSET]
push edi
STACKOFFSET = STACKOFFSET + 4
mov edi, DWORD PTR _mv_ctx$[esp+STACKOFFSET]
lea edi, [edi+eax*4] ; mv_ctx[0][act_ctx]
mov eax, DWORD PTR _err$[esp+STACKOFFSET]
lea eax, DWORD PTR [edi+eax*4] ; &mv_ctx[0][act_ctx+err]
mov edx, DWORD PTR _dep_dp$[esp+STACKOFFSET]
call _biari_decode_symbol_map ; int act_sym = biari_decode_symbol(dep_dp,&mv_ctx[0][act_ctx+err] );
test eax, eax ; if (act_sym != 0)
je SHORT SYMBOL_ZERO
push esi
STACKOFFSET = STACKOFFSET + 4
lea edi, [edi + 40] ; mv_ctx[1]+act_ctx
call _unary_exp_golomb_mv_decode3 ; act_sym = unary_exp_golomb_mv_decode3(dep_dp,mv_ctx[1]+act_ctx);
inc esi ; ++act_sym;
call _biari_decode_symbol_eq_prob_asm ; mv_sign = biari_decode_symbol_eq_prob(dep_dp);
js SHORT SKIP_NEGATE; if(mv_sign)
neg esi ; act_sym = -act_sym;
SKIP_NEGATE:
mov eax, esi
pop esi
SYMBOL_ZERO:
pop edi
ret 0
_decodeMVD_CABAC ENDP
_TEXT ENDS
END
|