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 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565
|
<pre>INDRA Note 1185 INDRA
Feb. 1982 Working
Paper
<a href="./rfc809">RFC 809</a>
UCL FACSIMILE SYSTEM
Tawei Chang
ABSTRACT: This note describes the features of
the computerised facsimile system
developed in the Department of
Computer Science at UCL. First its
functions are considered and the
related experimental work are
reported. Then the disciplines for
system design are discussed.
Finally, the implementation of the
system are described, while detailed
description are given as appendices.
Department of Computer Science
University College, London</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'> NOTE: Figures 5 and 6 may be obtained by sending a request to
Ann Westine at USC-Information Sciences Institute, 4676 Admiralty
Way, Marina del Rey, California, 90291 (or WESTINE@ISIF) including
your name and postal mailing address. Please mention that you are
requesting figures 5 and 6 from <a href="./rfc809">RFC 809</a>.
OR: You can obtain these two figures online from the files
<NETINFO>RFC809a.FAX and <NETINFO>RFC809b.FAX
from the SRI-NIC online library. These files are in the format
described in <a href="./rfc769">RFC 769</a>.
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Contents
<a href="#section-1">1</a>. INTRODUCTION...........................................<a href="#page-1">1</a>
<a href="#section-2">2</a>. SYSTEM FUNCTIONS.......................................<a href="#page-2">2</a>
<a href="#section-2.1">2.1</a> Communication......................................<a href="#page-4">4</a>
<a href="#section-2.2">2.2</a> Interworking with Other Equipment..................<a href="#page-8">8</a>
<a href="#section-2.2.1">2.2.1</a> Facsimile machines............................<a href="#page-8">8</a>
<a href="#section-2.2.2">2.2.2</a> Output Devices................................<a href="#page-9">9</a>
<a href="#section-2.3">2.3</a> Image Enhancement..................................<a href="#page-11">11</a>
<a href="#section-2.4">2.4</a> Image Editing......................................<a href="#page-15">15</a>
<a href="#section-2.5">2.5</a> Integration with Other Data Types..................<a href="#page-16">16</a>
<a href="#section-3">3</a>. SYSTEM ARCHITECTURE....................................<a href="#page-17">17</a>
<a href="#section-3.1">3.1</a> System Requirements................................<a href="#page-17">17</a>
<a href="#section-3.2">3.2</a> Hierarchical Model.................................<a href="#page-19">19</a>
<a href="#section-3.3">3.3</a> Clean and Simple Interface.........................<a href="#page-20">20</a>
<a href="#section-3.3.1">3.3.1</a> Principles....................................<a href="#page-21">21</a>
<a href="#section-3.3.2">3.3.2</a> Synchronisation and Desynchronisation.........<a href="#page-21">21</a>
<a href="#section-3.3.3">3.3.3</a> Data Transfer.................................<a href="#page-22">22</a>
<a href="#section-3.4">3.4</a> Control and Organisation of the Tasks..............<a href="#page-22">22</a>
<a href="#section-3.4.1">3.4.1</a> Command Language..............................<a href="#page-23">23</a>
<a href="#section-3.4.2">3.4.2</a> Task Controller...............................<a href="#page-23">23</a>
<a href="#section-3.5">3.5</a> Interface Routines.................................<a href="#page-26">26</a>
<a href="#section-3.5.1">3.5.1</a> Sharable Control Structure....................<a href="#page-26">26</a>
<a href="#section-3.5.2">3.5.2</a> Buffer Management.............................<a href="#page-27">27</a>
<a href="#section-4">4</a>. UCL FACSIMILE SYSTEM...................................<a href="#page-28">28</a>
<a href="#section-4.1">4.1</a> Multi-Task Structure...............................<a href="#page-29">29</a>
<a href="#section-4.2">4.2</a> The Devices........................................<a href="#page-29">29</a>
<a href="#section-4.3">4.3</a> The Networks.......................................<a href="#page-30">30</a>
<a href="#section-4.4">4.4</a> File System........................................<a href="#page-31">31</a>
<a href="#section-4.5">4.5</a> Data Structure.....................................<a href="#page-32">32</a>
<a href="#section-4.6">4.6</a> Data Conversion....................................<a href="#page-34">34</a>
<a href="#section-4.7">4.7</a> Image Manipulation.................................<a href="#page-35">35</a>
<a href="#section-4.8">4.8</a> Data Transmission..................................<a href="#page-39">39</a>
<a href="#section-5">5</a>. CONCLUSION.............................................<a href="#page-41">41</a>
<a href="#section-5.1">5.1</a> Summary............................................<a href="#page-41">41</a>
<a href="#section-5.2">5.2</a> Problems...........................................<a href="#page-42">42</a>
<a href="#section-5.3">5.3</a> Future Study.......................................<a href="#page-46">46</a>
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
<a href="#appendix-I">Appendix I</a>: Devices
<a href="#appendix-I">Appendix I</a>I: Task Controller and Task Processes
<a href="#appendix-I">Appendix I</a>II: Utility and Data Formats
Reference
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'> 1. INTRODUCTION
The object of a facsimile system is to reproduce
faithfully a document or image from one piece of paper
onto another piece of paper sited remotely from the
first one. Up to now, the main method of facsimile
communication has been via the telephone network. Most
facsimile machines permit neither the storage of image
page nor their modification before transmission. With
such machines, it is almost impossible to communicate
between different makes of facsimile machines. In this
respect, facsimile machines fall behind other
electronic communication services.
Integration of a facsimile service with computer
communication techniques can bring great improvements
in service. Not only is the reliability and efficiency
improved but, more important, the system can be
integrated with other forms of data communication.
Moreover, the computer enables the facsimile machine to
fit into a complete message and information processing
environment. The storage facilities provided by the
computer system make it possible to store large amounts
of facsimile data and retrieve them rapidly. Data
conversion allows facsimile machines of different types
to communicate with each other. Furthermore, the
facsimile image is edited and/or combined with other
forms of data, such as text, voice and graphics, to
construct a multi-media message, which can be widely
distributed over computer networks.
In the Department of Computer Science at UCL, a
computerised facsimile system has been developed in
order to fully apply computer technology, especially
communication, to the facsimile field. Some work has
been done to improve the facsimile service in several
areas.
(1) Adaptation of the facsimile machine for use with
computer networks. This permits more reliable and
accurate document transmission, as well as
improving the normal point-to-point transfers.
(2) Storage of facsimile pages. This permits the
queueing of pages, so saving operator time. Also,
standard documents can be kept permanently and
transmitted at any time.
(3) Interworking with other facsimile machines. This
permits different makes of facsimile machines to
- 1 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
exchange images.
(4) Compression of the facsimile images. This allows
more efficient transmission to be achieved.
Different compression schemes are investigated.
(5) Display of images on other devices. A colour
display is used so that the result of image
processing can be shown very vividly.
(6) Improvement of the images. The ability to 'clean'
the facsimile images not only allows for even
higher compression ratio, but also provide a
better result at the destination.
(7) Editing of facsimile pages. This includes the
ability to change pictures, alter the size of
images and merge two or more images, all
electronically.
(8) Integration of the facsimile service with other
data types. For the time being, coded character
text can be converted into facsimile format and
mixed pages containing pictures and text can be
manipulated.
This note first considers the functions of the
facsimile system, the related experimental work being
reported. Then the discipline for the system design is
discussed. Finally, the implementation of the UCL
facsimile system is described. As appendices, detailed
description of the system are given, namely
I. Devices
II. Task controller and task processes
III. Utility routines and Data format
2. SYSTEM FUNCTIONS
The computerised facsimile system we have developed
is composed of an LSI-11 micro-computer running the MOS
operating system [<a href="#ref-14" title=""MOS User Guide"">14</a>] with two AED62 floppy disk drives
[<a href="#ref-17" title=""AED 6200LP Floppy Disk Storage System"">17</a>], a Grinnell colour display [<a href="#ref-18" title=""The User Manual for Grinnelll Colour Display"">18</a>], a DACOM facsimile
machine [<a href="#ref-16" title=""DACOM 6450 Computerfax Transceiver Operator Instructions"">16</a>], and a VDU as the system console. This
LSI-11 is also attached to several networks, including
the ARPANET/SATNET [<a href="#ref-21" title=""The ARPA Computer Network"">21</a>], [<a href="#ref-22" title=""General Purpose Satellite Network"">22</a>] and the UCL Cambridge
Ring. A schematic of the system is shown in Fig. 1.
- 2 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
facsimile machine bit-map display
+------+ +------+
! ! ! !
+------+ +------+
+------+ \ / VDU
! disk ! +----------+ +-----+
+------+ ---- ! LSI-11 ! -- ! !
! disk ! +----------+ +-----+
+------+ |
+------+
! NI !
+------+
Network Interface
Fig. 1 Schematic of UCL facsimile system
In this system, a page is read on the facsimile
machine and the image data produced is stored on the
floppy disk. This data can be processed locally in the
micro-computer and then sent to a file store of a
remote computer across the computer network. At the
remote site, the image data may be processed and
printed on a facsimile machine.
On the other hand, we can receive image data which is
sent by a remote host on the network. This data can be
manipulated in the same way, including being printed on
the local machine.
<a href="#section-2.1">Section 2.1</a> dicusses the problems concerned with
transmission of facsimile image data over a network,
while the following sections deal with those of local
manipulation of image data.
In order to interwork with other facsimile machine,
we have to convert the image data from one
representation format to another. Interworking with
other output devices requires that the image be scaled
to fit the dimension of the destination device. These
are described in <a href="#section-2.2">section 2.2</a>.
Being able to process the image by computer opens the
door to many possibilities. First, as considered in
<a href="#section-2.3">section 2.3</a>, an image can be enhanced, so that the
quality of the image may be improved and more efficient
storage and transmission can be achieved. Secondly, a
facsimile editing system can be supported whereby a
picture can be changed and/or combined with other
- 3 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
pictures. This is described in <a href="#section-2.4">section 2.4</a>.
In our system, coded character text can be converted
into its bit-map representation format so that it can
be handled as a facsimile image and merged with
pictures. This provides an environment where multi-type
information can be dealt with. This is discussed in
<a href="#section-2.5">section 2.5</a>.
2.1 Communication
The first goal of our computerised facsimile system
is to use a computer network to transmit data between
facsimile machines which are geographically separated.
Normally, facsimile machines are used in association
with telephone equipment, the data being sent along
telephone lines. Placing the facsimile machines on a
computer network presents a problem as the facsimile
machine does not have the ability to use a computer
network directly. To perform the network tasks a
computer is required, and so the first phase was to
attach the facsimile machine to a computer.
The facsimile machine is not like a standard piece of
computer equipment. We required a special hardware
interface to enable communication between the facsimile
machine and a small computer. This interface was made
to appear exactly like the telephone system to the
facsimile machine. Furthermore, the computer was
programmed to act exactly as if it were another
facsimile machine on the end of a telephone line. Thus
the local facsimile machine could transmit data to the
computer quite happily, believing that it was actually
talking to a remote facsimile machine on the other end
of a telephone wire. Because of the property of the
DACOM 6450 used in the experiment [<a href="#ref-16" title=""DACOM 6450 Computerfax Transceiver Operator Instructions"">16</a>], the interface
could be identical to one developed for connecting to
an X25 network. The binary synchronous mode of the chip
used (SMC COM5025) was appropriate to drive the DACOM
machine.
At the other side of the computer network there was a
similar computer with an identical facsimile machine.
The problem of transmitting a facsimile picture now
appeared simple: data was taken from the facsimile
machine into the computer, transmitted over the network
as if it was normal computer data, and then sent from
the computer to the facsimile machine at the remote
end. The data being sent over the network appears
- 4 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
exactly as any other computer data; there is nothing
special about it to signify that it came from a
facsimile machine. The schematic of such facsimile
transfer system is shown in Fig. 2.
facsimile
machine
+---+ interface
! ! +--+ +-----+
! ! == ! ! == ! ! computer
+---+ +--+ +-----+
|
- - - - - - computer
/ \ network
\ / facsimile
- - - - - - machine
| interface +---+
+-----+ +--+ ! !
computer ! ! == ! ! == ! !
+-----+ +--+ +---+
Fig. 2 Facsimile transfer system
The experimental system was used to perform a joint
experiment between UCL and two groups in the United
States. Pictures were exchanged via the ARPANET/SATNET
[<a href="#ref-21" title=""The ARPA Computer Network"">21</a>], [<a href="#ref-22" title=""General Purpose Satellite Network"">22</a>] between UCL in London, ISI in Los Angeles,
and COMSAT in Washington D.C. (Fig. 3). This
environment was chosen because no equivalent group was
available in the UK.
One problem concerned with such image data
transmission is the quantity of data. Even with data
compression, a single page of facsimile data can
produce as much computer data as would normally be
sufficient for sending over 20,000 alphabetic
characters - or over a dozen typed pages. Thus for a
given number of pages put into the system, an immense
amount of computer data is produced. This means that
the transmission will be slower than for sending text,
and that far more storage will be required to hold the
data.
Another problem was encountered which became only too
apparent when we implemented this system. The network
we were using was often unable to keep up with the
speed of the facsimile machine. When this happened the
- 5 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
US UK
satellite
COMSAT __
+---+ +--+ / \
! ! -- ! ! / \
+---+ +--+ / \
| \ / \
+---+ \ / \ UCL
!fax! \+--+/ \+--+ +---+
+---+ ARPANET ! ! SATNET ! ! -- ! !
/+--+ +--+ +---+
/ |
ISI / +---+
+---+ +--+ !fax!
! ! -- ! ! +---+
+---+ +--+
|
+---+
!fax!
+---+
Fig. 3. The three participants of the facsimile experiments
computer tried to slow down the facsimile machine. The
facsimile machine would detect this 'slowness' as a
communication problem (as a telephone line would never
act in this manner), and would abandon the transfer
mid-way through the page.
This is because the the facsimile machine we were
using was never intended for use on a computer; it was
designed and built for use on telephone lines. Indeed,
being unaware that it was connected to a computer, the
facsimile machine transmitted data at a constant rate,
which exceeded the limit that the network could accept.
In other words, the computer network we were using was
not designed for the transfer rate that we were trying
to use over it.
Both these problems are surmountable. Facsimile
machines are coming on the market that are designed for
direct communication with a computer. These machines do
not mind the delays on the computer interface and are
tolerant of the stops and re-starts. On the other hand,
if there were a serious use of facsimile machines on a
computer network, the network could be designed for the
high data rate required. Our problem was aggravated by
- 6 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
using a network that was never designed for the data
rates required in our mode of usage.
Despite the problems we encountered being a result of
the experimental equipment we were working with, we
still had to improve the situation to permit more
extensive communications to take place. The easiest way
to do this was to introduce a local storage area in our
computer where the data could be held prior to
transmission. The transfer of a page is now done in
three stages. First, the facsimile data is read from
the facsimile machine and stored on a local disk. This
takes place at high speed as this is just a local
operation. When this is complete, the data is sent
over the network to a disk on the remote computer.
Finally, the data from that disk is output to the
remote facsimile machine. This improved system is
shown in Fig. 4.
computer network
fax computer - - - - computer fax
+---+ +-----+ / \ +-----+ +---+
! ! = ! ! = ==> = ! ! = ! !
+---+ +-----+ \ / +-----+ +---+
- - - + | - - - - | + - - >
| | + - - - - - - - - - + | |
| | | | | |
V | | V | |
+---+ +---+
! ! ! !
! ! ! !
+---+ +---+
disk disk
Fig. 4. The improved facsimile transfer system
The idea behind this method is to decouple the
facsimile machine from the network communications. The
data is read from the facsimile machine at full speed,
without the delays caused by the computer network.
This also has the effect of being more acceptable to
the human operators: each page is now read in less than
a minute. The transmission over the network then takes
place at whatever speed the network can sustain. This
does not affect the facsimile machines at all; they are
not involved in the sending or receiving. Only when all
the data has been received at the remote disk is the
remote facsimile machine told that the data is ready.
- 7 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
The facsimile machine is then given the data as fast as
it will accept it.
The disadvantage of such a system is that the person
sending the pages does not know how long it will be
before they are actually printed at the other side. If
several pages are input in quick succession by the
operator, they will be stored on disk; it may then be
some time before the last page is actually delivered to
the destination. This is not always a disadvantage;
where many operators are sending data to the same
destination, it is a definite advantage to be able to
input the pages and have the system deliver them when
the destination becomes free. Such a system is
preferable to use of the current telephone system where
the operator has to keep re-dialing the remote
facsimile machine until the call is answered.
2.2 Interworking with Other Equipment
2.2.1 Facsimile machines
As was mentioned earlier, facsimile machines produce
a large amount of data per page due to the way in which
the pages are encoded. To reduce the data that has to
be transmitted, various compression techniques are
employed. The manufacturers of facsimile machines have
developed proprietary ways in which the data is
compressed and encoded. Unfortunately this has meant
that interworking of different facsimile machines has
been impossible. In the system described in the last
section, exchange of pictures was only possible between
sites that had identical facsimile machines. The new
set of CCITT recommendations will reduce the extent to
which differences in equipment persist.
Having the data on a computer gives us the
opportunity to manipulate data in any way we wish. In
particular we could convert the data from the form used
in one facsimile machine to that required by another.
This means that interworking between different types of
facsimile machines can be achieved.
The development of this system took place in two
stages: the decompression of the facsimile data from
the coded form used in our machine into an internal
data form and the recompression of the data in the
internal form into the encoded form required for the
destination machine. Two programs were developed to
perform these two operations.
- 8 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
At the same time we were developing compression and
decompression programs for machines that use other
techniques. In particular, we developed programs to
handle the recently approved CCITT recommendation for
facsimile compression [<a href="#ref-15" title=""Recommendation T.4, Standardisation of Group 3 Facsimile Apparatus for Document Transmission"">15</a>]. The CCITT came up with two
varieties of compression, depending upon the resolution
being used.
Unfortunately there were no facsimile machines on the
network that use the CCITT compression technique.
However, the programming of the new methods achieved
two goals: it proved that the data could be converted
inside a small computer, so that machines of different
types could be supported on the network, and it enabled
us to compare the compression results. These are
described in more detail in [<a href="#ref-13" title=""Facsimile Compression"">13</a>]. Essentially, these
show that the DACOM technique used by our facsimile
machine is comparatively poor, and that considerably
less data need be transmitted if some other method is
used. This brings up another possibility: we could
change the compression of the data to reduce the volume
for transmission and then change the data back again at
the destination. This may save considerable
transmission time, especially if fast computers or
special hardware was easily available. This has not
been tried yet in our system, as none of the other
users on the network have the capability of changing
the data format back into that required by their
machines.
There are many other more efficient compression
schemes, e.g. block compression [<a href="#ref-7" title=""Block Coding of Graphics: A Tutorial Review"">7</a>] and predictive
compression [<a href="#ref-8" title=""Facsimile Data Compression by Predictive Encoding"">8</a>], but we have not yet incorporated them
into our system.
2.2.2 Output Devices
One area that we have explored is the use of devices
other than facsimile machines for outputting the data.
Facsimile machines are both expensive to buy and
relatively slow to operate. We have investigated the
use of a TV-like screen to display the data, just as
character VDUs are commonly used to display text. This
activity requires bit-map displays, with an address in
memory for each postion on the screen. Full colour and
multiple shades can be used with appropriately large
bit-map storage. Although simple in principle, the
implementation of the relevant techniques took
considerable effort.
- 9 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
The problems arise in the way that the facsimile
image is encoded. Raw facsimile images consist of rows
of small dots, each dot recorded as a black or white
space. When these dots are arranged together they build
up a picture in a similar manner to the way in which a
newspaper picture is made up. Unfortunately the number
of dots used in a facsimile page is not the same as the
number used on most screens. For instance, the DACOM
facsimile machine uses 1726 dots across each page, but
across a screen there are usually just 512 dots. Thus
to show the picture on the screen the 1726 dots must be
'squeezed' into just 512 dots; stated another way, 1214
dots must be thrown away without losing the picture!
It is in reducing the number of picture elements that
the problem arises. We could just every third dot or
so from the facsimile page and just display those.
Alternatively, we could take three or more at a time
and try to convert the group of them into a single
black or white dot. Unfortunately, in both these
cases, data can get lost that is necessary to the
picture. For instance, a facsimile encoding of an
architect drawing could easily end up with a complete
line removed, radically changing the presentation of
the image.
After much experimentation, we developed a method of
reducing the number of dots without destroying the
picture. This is a thinning technique, whereby key
elements of the picture are thinned, but not removed.
Occasionally, when the detail gets too fine, some
elements are merged, but under these circumstances the
eye would not have been able to see the detail anyway.
The details of this technique are described in [<a href="#ref-3" title=""Data Structure and Procedures for Facsimile Signal Processing"">3</a>] and
[<a href="#ref-4" title=""On Distorting Facsimile Image"">4</a>].
It may also be required that a picture be enlarged.
This enlargement can be done by simply duplicating each
pixel in the picture. For a non-integral ratio, the
picture can be expanded up to the nearest integer and
then shrunk to the correct size. However, this method
may degrade the image quality, e.g. the oblique contour
may become stepped, especially when the picture is
enlarged too much. This problem can be solved by using
an iterative enlargement algorithm. Each time a pixel
is replaced with a 2x2 array of pixels, whose pattern
depends on the original pixel and the pixels
surrounding it. This procedure is repeated until the
requested ratio is reached. If the ration is not a
power of 2's, the same method as that for non-integral
ratios is used.
- 10 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
As a side effect of developing this technique, we
could freely change the size and shape of an image.
The picture can be expanded or shrunk, or it can be
distorted. Distortion, whereby the horizontal and
vertical dimensions of the image may be changed by
different amounts, is often useful in image editing.
The immediate consequence of this ability to change
the image size meant that we could display the image on
a screen as well as output the image on a facsimile
machine. To a user of a computerised facsimile system
this could be a very useful feature: images can be
displayed on screen much faster than on a facsimile
machine, and displays are significantly cheaper than
the facsimile machines as well. It is possible that an
installation could have many screen displays where the
image could be viewed, but perhaps only one facsimile
machine would be available for hard copy. This would be
similar to many computer configurations today where the
number of printers is limited due to their cost, and
display screens are far more numerous.
2.3 Image Enhancement
One aspect of computer processing that we wanted to
investigate was that of image enhancement. Enhancing
the image is a very tricky operation; as the name
implies it means that the image is improved in some
sense. Under program control this is difficult to
achieve: what the program thinks is an improvement, the
human might judge to be distinctly worse.
Our enhancement attempts were aimed particularly at
printed documents and other forms of typed text. The
experiment was double pronged: we hoped to make the
image easier to read by humans while also making the
image easier for the computer to handle.
In our earlier experiments we had noticed that the
encoding of printed matter was often very poor. This
was especially noticeable when we enlarged an image.
Rather than each character having smooth edges as on
the original document, the edges were very rough,
unexpected notches and excrescences being caused by the
facsimile scanner. They not only degrade the image
quality but also decrease the compression efficiency. A
typical enlargement of several characters is shown in
Fig. 5.
- 11 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Fig 5. An enlargement of an typed text
The enhancement method we adopted was first employed
at Loughborough University [<a href="#ref-5" title=""A New Pre- Processing Techniques for Digital Facsimile Transmission"">5</a>]. This method has the
effect of smoothing the edges of the dark areas on the
image. The technique consists of considering each dot
in the image in turn. The dot is either left as it is
- 12 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
or changed to the opposite colour (white to black or
black to white) depending upon the eight dots that
surround it. The particular pattern of surrounding dots
that are required to change the inner dot's colour is
used to control the harshness of the algorithm [<a href="#ref-6" title=""Mask Scanning Algorithm and Its Application"">6</a>],
[<a href="#ref-8" title=""Facsimile Data Compression by Predictive Encoding"">8</a>].
In our first set of experiments the result was
definitely worse than the original. Although square-
like characters such as H, L, and T came out very well,
anything with slope (M, V, W, or S) became so bad that
the oblique contours were stepped. The method was
subsequently modified to produce a result that was far
more acceptable; the image looked a lot cleaner than
the original. Fig. 6 shows the same text as that in
Fig. 5, but after it has been cleaned.
- 13 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Fig. 6 A cleaned text
The effect of these can be difficult to see clearly.
We have used the colour on our Grinnell display to show
the original picture and the outcome of various picture
processing operations superposed in different colours.
This brings out the effect of the operations very
- 14 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
vividly.
It was mentioned above that the enhancement was done
not only to improve the image for reading but also for
easier processing by the computer. As described
earlier, the image from the facsimile machine is
compressed in order to reduce the amount of data. The
cleaning allows a higher compression rate so that more
efficient transmission and/or storage can be achieved.
We learned some important lessons from the
enhancement exercise. Originally we thought that the
main attraction in enhancement would be to improve the
readability. In the end, we found that improving the
readability was very difficult, especially because the
facsimile image was so poor. Instead we found that the
effect of reducing the compressed output was more
important. By reducing the data to be transmitted by a
quarter, significant savings could be made. But before
such a technique could be used in a live system, the
time it takes to produce the enhancement must be
weighed against the time that would be saved in
transmission.
2.4 Image Editing
By editing we mean that the facsimile picture can be
changed, or combined with other pictures, while it is
stored inside the computer. In previous sections it
was mentioned that we could change the size and shape
of a facsimile image. This technique was later combined
with an overlaying method that enabled one picture to
be combined with another [<a href="#ref-12" title=""The Facsimile Editor"">12</a>].
In order to perform any editing it is necessary to
have the picture displayed for the user to see. In our
case we displayed the picture on the bit-map screen.
The image took up the left-hand side of the screen, the
right side being reserved for the picture that was
being built. The user could select an area of the
left-hand screen and move it to a position on the
right-hand screen. Several images could be displayed
in succession on the left, and areas selected and moved
to the right. Finally, the right-hand screen could be
printed on the facsimile machine.
The selection of an area of the picture was done by
the use of a coloured rectangular subsection,
controlled by a program in the computer, that could be
moved around on the screen. The rectangular subsection
- 15 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
was moved with instructions typed in by the operator;
it could be moved up or down, and increased or
decreased in size. When the appropriate area of the
screen had been selected, the program remembered the
coordinates and moved the coloured rectangular
subsection to the right-hand side of the screen. The
user then selected an area again, in a similar manner.
When the user finished the editing, the program removed
the part of the picture selected from the left-hand
screen and converted it to fit the shape of the
rectangular subsection on the right-hand screen. The
result was then displayed for the user to see.
When an image was being edited, the editor had to
keep another scaled copy for display. This is due to
the fact that the screen had a different dimension to
that of the facsimile machine. The editing operations,
e.g. chopping and merging, were performed on the
original image data files with the full resolution
available on the facsimile machine.
2.5 Integration with Other Data Types
The facsimile machine can be viewed in a wider
context than merely a facsimile input/output device. It
can work as a printer for other data representation
types, such as coded character text and geometric
graphics. At present, text can be converted into
facsimile format and printed on the facsimile machine.
Moreover, mixed pages containing pictures and text can
be manipulated by our system. The integration of
facsimile images with geometric graphics is a topic of
future research.
In order to convert a character string into its
facsimile format, the system maintains a translation
table whereby the patterns of the characters available
in the system can be retrieved. The input character
string is translated into a set of scan lines, each of
which is created by concatenating the corresponding
patterns of the characters in the string.
The translation table is in fact a software font,
which can be edited and modified. Even though only one
font is available in our system for the time being, it
is quite easy to introduce other character fonts.
Furthermore, it is also possible for a font to be
remotely loaded from a database via the communication
network.
- 16 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
This allows for more interesting applications of the
facsimile machine. For example, it could serve as a
Teletex printer, provided that the Teletex character
font is included in our system. In this case, the text
images may be distorted to fit the presentation format
requested by the Teletex service. Similarly, Prestel
viewdata pages could be displayed on the Grinnell
screen.
Moreover, pictures can be mixed with text by
combining this text conversion with the editing
described in the previous section. This should be
regarded as a notable step towards multi-type
processing.
Not only does this support a local multi-type
environment but multi-type information can be
transmitted over a network. So far as this facsimile
system is concerned, a mixed page containing text and
pictures can be sent only when it has been represented
in a bit-map format. However, much more efficient
transmission would be achieved if one could transmit
the text and pictures separately and reproduce the page
at the destination site. This requires that a multi-
type data structure be designed which is understood by
the two communication sites.
3. SYSTEM ARCHITECTURE
Now let us discuss the general disciplines for design
and implementation of a computerised facsimile system
which carries out the functions described in the
previous sections. Having discussed the requirements
of the system, a hierarchical model is introduced in
which the modules of different layers are implemented
as separate processes. The Clean and Simple interface,
which is adopted for inter-process communication, is
then described. The task controller, which is
responsible for organising the tasks involved in a
requested job, is discussed in detail. Some efforts
have been made in our experimental work to provide a
more convenient user programming environment and a more
efficient data transfer method. This is finally
described.
3.1 System Requirements
In a computerised facsimile system, the images are
represented in a digital form. To carry out this
- 17 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
conversion, a page is scanned by the optical scanner of
the facsimile machine, a digital number being produced
to represent the darkness of each pixel. As high
resolution has to be adopted to keep the detail of the
image, the facsimile data files are usually rather
large. In order to achieve efficient storage and
transmission, the facsimile data must be compressed as
much as possible.
Currently, the facsimile machines made by different
manufacturers h different properties, such as
different compression methods and different resolution.
There are also some international standards for
facsimile data compression, which are employed for the
facsimile data to be transferred over the public data
network. These require that the facsimile data be
converted from one representation form to another, so
that users who are separated geographically and use
different machines can communicate with each other.
More sophisticated applications, e.g. image editing,
request processing facilities of the system as well.
When being processed, the facsimile image should be
represented in a common format or internal data
structure, which is used to pass the information
between different processing routines. For the sake of
convenience and efficiency, the internal data structure
should be fairly well compressed and its format should
be easy for the computer to manipulate. In our
experimental work, the line vector is chosen as a
standard unit, a simple run-length compression being
employed [<a href="#ref-3" title=""Data Structure and Procedures for Facsimile Signal Processing"">3</a>]. Some processing routines may use other
data formats, e.g. bit-map, but it is the
responsibility of such routines to perform the
conversion between those formats and the standard one.
The system should contain several processing
routines, each of which performs one primitive task,
such as chopping, merging, and scale-changing. An
immense variety of processing operations can be carried
out as long as those task modules can be organised
flexibly. The capability for flexible task organisation
should be thought of as one of the most important
requirements of the system.
One possibility is for the processing routines
involved to be executed separately, temporary files
being used as communication media. Though very simple,
this method is far too inefficient.
- 18 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
As described above, the information unit for the
communication between the processing routines is the
line vector, so that the routines can be organised as
embedded loops, where a processing routine takes the
input line from its source routine located in the inner
loop, and passes the output line to the destination
routine located in the outer loop [<a href="#ref-3" title=""Data Structure and Procedures for Facsimile Signal Processing"">3</a>]. Obviously this
method is quite efficient. But it is not realistic for
our system, because it is very difficult to build up
different processing loops at run-time and flexible
task organisation is impossible.
In a real-time operating system environment, the
primitive tasks can be implemented as separate
processes. This method, which is discussed in detail in
the following sections, provides the required
flexibility.
3.2 Hierarchical Model
As shown in Fig. 7, the modules in a single computer
fall into three layers.
+---------+
! ! task controller
+---------+
tasks
+---+ +---+ +---+ +---+ +---+
! ! ! ! ! ! ! ! !
+---+ +---+ +---+ +---+ +---+
| | |
+---+ +---+ +---+
! ! ! ! device drivers ! !
+---+ +---+ +---+
- - - | - - | - - - - - - - - - | - - - -
+---+ +---+ +---+
! ! ! ! physical | !
! ! ! ! devices ! !
+---+ +---+ +---+
Fig. 7 The hierarchical model
These are:
(1) Device Drivers, which constitute the lowest layer
in the model. The modules in this layer deal with
I/O activities of the physical devices, such as
- 19 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
facsimile machine, display and floppy disk. This
layer frees the task modules of upper layer from
the burden of I/O programming.
(2) Tasks, which perform all processing primitives and
handle different data structures. Above the driver
of each physical device, there are one or more
such device-independent modules, which work as
information source or sink in the task chain (see
below). A file system module allows other modules
to store and retrieve information on the secondary
storage device such as floppy disk. Decompression
and recompression routines convert data structures
of facsimile image information so that the
facsimile machines can communicate with the rest
of the system. Processing primitives, e.g.
chopping, merging, scaling, are implemented as
task modules in this layer. They are designed such
that they can be concatenated to carry out more
complex jobs. So far as the system is concerned,
the protocols for data transmission over computer
networks are also regarded as task modules in this
layer.
(3) Task Controller, which organises the task
processes to perform the specified job. It
provides the users of the application layer with a
procedure-oriented language whereby the requested
job can be defined as a chain of task modules.
Literally, the chain is represented by a character
string:
<source_task>|{<processing_task>|}<sink_task>
According to such a command, the task controller
selects the relevant task modules and concatenates
them in proper order by means of logical links.
Then the tasks on the chain are executed under its
control, so that the data taken from the source
are processed and the result is put into the sink.
3.3 Clean and Simple Interface
It is important, in this application, to develop the
software in a modular way. It is desirable to put
together a set of modules to carry out the different
image processing tasks. Another set of transport
modules must be developed for shipping data over the
- 20 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
different networks to which the UCL system is attached.
In our computerised facsimile system, these task
modules are implemented as separate processes. The
operation of the system relies on the communication
between these processes. The interface which is used
for such communication has been designed to be
universal; it is independent of these modules, and has
been termed the Clean and Simple interface [<a href="#ref-20" title=""Clean and Simple Interface under MOS"">20</a>]. This
interface is discussed in this section.
3.3.1 Principles
The Clean and Simple interface is concerned with the
synchronisation and transfer of full-duplex data
streams between two communicating processes. Thus the
interface has three major components: connection
synchronisation, data transfer and connection
desynchronisation. These components are discussed
below.
The connection between two processes is initiated by
one of them, which, generally speaking, belongs to a
higher layer. For example, the interface between
protocols of different layers is always initiated by
the higher layer, though, sometimes, the connection is
initiated passively by the primitive 'listen'. It will
be seen in the next section that task processes can
communicate with each other via the connections to the
higher layer (task controller) and this makes it
possible to achieve flexible task organisation.
The process initiating the connection is called the
'master' process, while the other is called the 'slave'
process. The 'master' process is also responsible for
resource allocation for the two communicating
processes. Here 'resource' refers mainly to the memory
areas for the message structure and data buffer. This
asymmetric definition of the interface eliminates any
possible confusion in resource allocation.
The interface is implemented by using the signal-wait
mechanism provided by the operating system. A data
structure called CSB (Clean and Simple Block), which
contains function, data buffer, and other information,
is sent as the event message, when one process signals
another [<a href="#ref-20" title=""Clean and Simple Interface under MOS"">20</a>].
- 21 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
3.3.2 Synchronisation and Desynchronisation
The procedure for connection synchronisation is
composed of two steps. First, the two processes
exchange their identifiers for the specific connection
by means of a getcid primitive. Usually, the pointer
to the task control structure of the process is used as
the connection identifier.
Then, the 'master' sends an open CSB with appropriate
parameter string passing the initialisation
information. This information, which can also be called
open parameter, is process dependent, or more
accurately, task dependent. For example, the parameters
for the file system should be the file name and the
access mode. Provided the 'slave' accepts the request,
the connection is established successfully and data can
be transferred via the interface.
In order to desynchronise the connection, the
'master' initiates a 'close' action. On the other hand,
an error state or EOF (end of file) state can be
reported by the 'slave' to request a connection
desynchronisation.
The listen primitive in our system is reserved for
the processes that receive a request from the remote
hosts on the networks.
3.3.3 Data Transfer
While the Clean and Simple interface is asymmetric in
relation to connection synchronisation, data transfer
is completely symmetric so long as the connection has
been established. Data flows in both directions are
permitted, though the operations are quite different.
The interface provides two primitives for data
transfer -- read and write. To transfer some data to
the 'slave', the 'master' signals it with a CSB
containing the write function and a buffer filled with
the data to be transferred. Having consumed the data,
the 'slave' returns the CSB to report the result status
of the transmission.
On the other hand, in order to receive some data from
the 'slave', the 'master' uses a read CSB with an empty
buffer. Having received the CSB, the 'slave' fills the
buffer with the data requested and, then, returns the
CSB.
- 22 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
3.4 Control and Organisation of the Tasks
Another important aspect of the multi-process
architecture of the UCL facsimile system, is the need
to systematise the control and organisation of the
tasks. This activity is the function of the task
controller, whose operations are discussed in this
section.
3.4.1 Command Language
As mentioned earlier, the task controller supports a
procedure-oriented language by means of which the user
or the routines of the upper layers can define the jobs
requested. A command should contain the following
information:
1. the names of the task processes which are involved
in the job.
2. the open parameters for these task processes.
3. the order in which the tasks are to be linked.
The last item is quite important, though, usually,
the same order as that given in the command is used.
A command in this language is presented as a zero-
ended character string. In the task name strings and
the attribute strings of the open parameters, '|', '"',
and ',' must be excluded as they will be treated as
separators. The definition is shown below, where '|',
which is the separator of the command strings in the
language, does not mean 'OR'.
<command_string> ::= <task_string>
<command_string> ::= <task_string>|<command_string>
<task_string> ::= <task_name>
<task_string> ::= <task_name>"<open_parameter>
<open_parameter> ::= <attribute>
<open_parameter> ::= <attribute>,<open_parameter>
3.4.2 Task Controller
In our experimental work, the task controller module
is called fitter. This name which is borrowed from
UNIX hints how the module works. According to the
command string, it links the specified tasks into a
chain, along which the data is processed to fulfil the
- 23 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
job requested (Fig. 8).
tasks
+-----+ +-----+ +-----+
! a ! -> ! b ! -> ! c !
+-----+ +-----+ +-----+
Fig. 8 The task chain
Since all modules, including fitter itself, are
implemented as processes, the connections between
modules should be via the Clean and Simple interfaces.
Upon receiving the command string, the fitter parses
the string to find each task process involved and opens
a connection to it. Formally, the task processes are
chained directly, but, logically, there is no direct
connection between them. All of them are connected to
the fitter (Fig. 9).
fitter
+-------------+
+-- ! ! --+
| +-------------+ |
| | |
V V V
+-----+ +-----+ +-----+
! a ! ! b ! ! c !
+-----+ +-----+ +-----+
Fig. 9 The connection initiated by the fitter
For each of the processes it connects, the fitter
keeps a table called pipe. When the command string is
parsed, the pipe tables are double-linked to represent
the specified order of data flow. So far as one process
is concerned, its pipe table contains two pointers: a
forward one pointing to its destination and a backward
one pointing to its sources. Besides the pointers, it
also maintains the information to identify the task
process and the corresponding connection.
- 24 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Fig. 10 illustrates the chain of the pipe tables for
the job "a|b|c". Note that the forward (output) chain
ends at the sink, while the backward (input) chain ends
at the source. In this sense, the task processes are
chained in the specified order via the fitter (Fig.
11). The data transfer along the chain is initiated and
controlled by the fitter, each process getting the
input from its source and putting the output to its
destination.
+-----+ +-----+ +-----+
! * -+--> ! * -+--> ! 0 !
+-----+ +-----+ +-----+
! 0 ! <--+- * ! <--+- * !
+-----+ +-----+ +-----+
! a ! ! b ! ! c !
+-----+ +-----+ +-----+
! ! ! ! ! !
! ! ! ! ! !
+-----+ +-----+ +-----+
Fig. 10 The pipe chain
fitter
+-------------+
+-> ! * -> * -> * ! --+
| +-------------+ |
| | A |
| V | V
+-----+ +-----+ +-----+
! a ! ! b ! ! c !
+-----+ +-----+ +-----+
Fig. 11 The data flow
This strategy makes the task organisation so flexible
that only the links have to be changed when a new task
chain is to be built up. In such an environment, each
task process can be implemented independently, provided
the Clean and Simple interface is supported. This also
makes the system extension quite easy.
- 25 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
The fitter manipulates one job at a time. But it must
maintain a command queue to cope with the requests,
which come simultaneously from either the upper level
processes or other hosts on the network.
3.5 Interface Routines
In a modular, multi-process system such as the UCL
facsimile system, the structure of the interface
routines is very important. The CSI of section 3.3 is
fundamental to the modular interface; a common control
structure is also essential. This section gives some
details both about the sharable control structure and
the buffer management.
3.5.1 Sharable Control Structure
Though the CSI specification is straightforward, the
implementation of the inter-process communication
interface may be rather tedious, especially in our
system, where there are many task processes to be
written. Not only does each process have to implement
the same control structure for signal handling, but
also the buffer management routines must be included in
all the processes.
For the sake of simplicity and efficiency, a package
of standard interface routines is provided which are
shared by the task processes in the system. These
routines are re-entrant, so that they can be shared by
all processes.
The 'csinit' primitive is called for a task process
to check in. An information table is allocated and the
pointer to the table is returned to the caller as the
task identifier, which is to be used for each call of
these interface routines.
Then, each task process waits by invoking the
'csopen' primitive which does not return until the
calling process is scheduled. When the connection
between the process and the fitter is established, the
call returns the pointer to the open parameter string
of the task, the corresponding task being started. A
typical structure of the task process (written in c) is
shown below. After the task program is executed, the
process calls the 'csopen' and waits again. It can be
seen that the portability of the task routines is
improved to a great extent. Only the interface routines
- 26 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
should be changed if the system were to run in a
different operating environment.
static int mytid; /* task identifier */
task()
{
char *op; /* open parameter */
mytid = csinit();
for(;;) {
op = csopen(mytid);
... /* the body of the task */
}
}
3.5.2 Buffer Management
The package of the interface routines also provides a
universal buffer management, so that the task processes
are freed from this burden. The allocation of the data
buffers is the responsibility of the higher level
process, the fitter. If the task processes allocated
their own buffers, some redundant copying would have to
be done. Thus, the primitives for data transfer,
'csread' and 'cswrite', are designed as:
char *csread(tid, need);
char *cswrite(tid, need);
where 'tid' is the identifier of the task and 'need' is
the number of data bytes to be transferred. The
primitives return the pointer to the area satisfying
the caller's requirement. The 'csread' returns an area
containing the data required by the caller. The
'cswrite' returns an area into which the caller can
copy the data to be transferred. The copied data will
be written to its destination at a proper time without
the caller's interference. Obviously the unnecessary
copy operations can be avoided. It is recommended that
the data buffer returned by the primitives be used
directly to attain higher performance.
- 27 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
In order to implement this strategy, each time a
piece of data is required, the size of the buffer
needed is compared with that of the unused buffer area
in the current CSB. If the latter is not less than the
former, the current buffer pointer is returned.
Otherwise, a temporary buffer has to be employed. The
data is copied into the buffer until the requested size
is reached. In this case, instead of a part of the
current buffer, the temporary buffer will be returned.
A 'cswrite' call with the 'need' field set to zero
tells the interface routine that no more data will be
sent. It causes a 'close' CSB to be sent to the
destination routine.
If there is not enough data available, 'csread'
returns zero to indicate the end of data.
4. UCL FACSIMILE SYSTEM
Now we discuss the implementation of the computerised
facsimile system developed in the Department of
Computer Science at UCL.
This system has several components. Since the total
system is a modular and multi-process one, a specific
system must be built up for a specific application. The
way that this is done is discussed in <a href="#section-4.1">section 4.1</a>. The
specific devices and their drivers are described in
section 4.2. The system can be attached to a number of
networks. In the UCL configuration, the network
interface can be direct to SATNET [<a href="#ref-22" title=""General Purpose Satellite Network"">22</a>], SERC NET [<a href="#ref-23" title=""Design fo an SRC/NERC Computer Network"">23</a>],
PSS [<a href="#ref-24" title=""Non-Voice Network Services - Future Plans"">24</a>], and the Cambridge Ring. The form of network
connection is discussed further in <a href="#section-4.3">section 4.3</a>. The
system must transfer data between the facsimile devices
and the disks, and between the networks and the disks.
For this a filing system is required which is discussed
in <a href="#section-4.4">section 4.4</a>.
A key aspect of the UCL system is flexibility of
devices, networks, and data formats. The flexibility of
device is achieved by the modular nature of the device
drivers (section 4.2). The flexibility of network is
discussed in <a href="#section-4.8">section 4.8</a>. The additional flexibility of
data structure is described in section 4.5. The
flexibility can be utilised by incorporating conversion
routines as in <a href="#section-4.6">section 4.6</a>. An important aspect of the
UCL system is the ability to provide local manipulation
facilities for the graphics files. The facilities
implemented for the local manipulation are discussed in
- 28 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
<a href="#section-4.7">section 4.7</a>. In order to transfer files over the
different networks of <a href="#section-4.3">section 4.3</a>. a high level data
transmission protocol must be defined. The procedures
used in the UCL system are discussed in <a href="#section-4.8">section 4.8</a>.
4.1 Multi-Task Structure
The task controller and processing tasks are
implemented as MOS processes. A number of utility
routines are provided for users to build new task
processes and modules at application level.
In the environment of MOS, a process is included in a
system by specifying a Process Control Table when the
system is built up. The macro 'setpcte' is used for
this purpose, the meaning of its parameters being
defined in [<a href="#ref-14" title=""MOS User Guide"">14</a>].
#define setpcte(name,entry,pridev,prodev,stklen,
relpid,relopc)
{0,name,entry,pridev,prodev,stklen,relpid,relopc}
A Device Control Table (DCT) has to be specified for
each device when the system is built up. A DCT can be
defined anywhere as devices are referenced by the DCT
address. The macro 'setdcte' is designed to declare
devices, the meanings of its parameters being specified
in [<a href="#ref-14" title=""MOS User Guide"">14</a>]. This method is used in the device
descriptions.
#define setdcte(name,intvec,devcsr,devbuf,devinit,
ioinit,intrpt,mate)
{04037,intrpt,0,0,name,mate,intvec,devinit,
devcsr,devbuf,ioinit}
4.2 The Devices
As mentioned in <a href="#section-2">section 2</a>, apart from the general
purpose system console, there are three devices in the
system to support the facsimile service. These are:
(1) AED62 Floppy Disk, which is used as the secondary
memory storing the facsimile image data. Above its
driver, a file system is implemented to manage the
data stored on the disks, so that an image data
- 29 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
file can be accessed through the Clean and Simple
interface. This file system is dicussed in detail
in the next section. For some processing jobs, the
image data has to buffered on a temporary file
lest time-out occurs on the facsimile machine.
(2) DACOM Facsimile Machine, which is used to input
and output image data. It reads an image and
creates the corresponding data stream. On other
hand, it accepts the image data and reproduces the
corresponding image. Above its driver, there is a
interface task to fit the facsimile machine into
the system, the Clean and Simple interface being
supported. The encoding algorithm for the DACOM
machine is described in [<a href="#ref-19" title=""An Adaptive Run Length Encoding Algorithm"">19</a>].
(3) Grinnell Colour Display, which is used as the
monitor of the system. Above its driver, an
interface task is implemented so that the image
data in standard format can be accepted through
the Clean and Simple interface.
The detailed description of these devices can be
found in Appendix 1. The interface task and the
description for each device are listed in the following
table. The interface tasks can be directly used as data
source or sink in a task string.
Device Interface Task Description
AED62 Floppy Disk fs() aed62(device)
DACOM fax Machine fax() dacom(device)
Grinnell Display grinnell() grinnell(device)
Note that the DCTs for the facsimile machine and
Grinnell display have been included in the
corresponding interface tasks, so that there is no need
to declare them if these tasks are used.
4.3 The Networks
There are three relevant wide-area networks
terminating in the Department of Computer Science at
the end of 1981. These are:
(1) A British Telecom X25 network (PSS, [<a href="#ref-24" title=""Non-Voice Network Services - Future Plans"">24</a>]).
(2) A private X25 network (SERC NET, [<a href="#ref-23" title=""Design fo an SRC/NERC Computer Network"">23</a>])
- 30 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
(3) A Defence network (ARPANET/SATNET, [<a href="#ref-21" title=""The ARPA Computer Network"">21</a>], [<a href="#ref-22" title=""General Purpose Satellite Network"">22</a>])
In addition there is a Cambridge Ring as a local
network.
For the time being, the UCL facsimile system is
directly attached to the various networks at the point
NI (Network Interface) of Fig. 1.
As mentioned earlier, pictures can be exchanged via
the SATNET/ARPANET, between UCL in London, ISI in Los
Angeles, and COMSAT in Washington D.C.. The Network
Independent File Transfer Protocol (NIFTP, [<a href="#ref-9" title=""A Network Independent File Transfer Protocol"">9</a>]) is used
to transfer the image data. This protocol has been
implemented on LSI under MOS [<a href="#ref-10" title=""The Implementation of NIFTP on LSI-11"">10</a>]. In addition, we at
UCL have put NIFTP on an ARPANET TOPS-20 host, which
can act as an Internet File Forwader (IFF). In this
case, TCP/IP ([<a href="#ref-28" title=""DoD Standard Transmission Control Protocol"">28</a>], [<a href="#ref-29" title=""DoD Standard Internet Protocol"">29</a>]) is employed as the underlying
transport service. Since TCP provides reliable
communication channels, the provision of checkpoints
and error-recovery procedures are not included in our
NIFTP implementations.
In the X25 network, the transport procedure is
NITS/X25 ([<a href="#ref-25" title=""UK-US Collaborative Computing"">25</a>], [<a href="#ref-26" title=""A Network Independent Transport Service"">26</a>]). Though pictures can be
transferred to the X25 networks, no experimental work
has been done, because:
(1) There is at present no collaborative partner on
these networks.
(2) The LSI-11, on which our system is implemented,
has no direct connection to these networks.
Locally, image data can be transmitted to the
PDP11-44s running the UNIX time-sharing operating
system. At present, the SCP ring-driver software uses
permanent virtual circuits (PVCs) to connect the
various computers on the ring.
4.4 File System
A file system has been designed, based on the AED62
double density floppy disk, for use under MOS. It is
itself implemented as a MOS process supporting the
Clean and Simple interface. The description of this
task, fs(fax), can be found in Appendix 2.
- 31 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
In a command string, the file system task can only
serve as either data source or data sink. In other
words, it can only appear at the first or last position
on a command string. In the former case, the file
specified is to be read, while the file is to be
written in the latter case.
Three access modes are allowed which are:
* Read a file
* Create a file
* Append a file
The file name and access mode are specified as the
open parameters.
Let us consider an example. If a document is to be
read on the facsimile machine and the data stream
created is to be stored on the file system, the command
string required is:
fax"r|fs"c,doc
where: fax - interface task for facsimile machine
r - read from facsimile machine
fs - file system task
c - create a new file
doc - the name of the file to be created.
In order to dump a file, a task process od() is
provided which works as a data sink in a command
string.
4.5 Data Structure
Facsimile image data is created using a high-
resolution raster scanner, so that the original picture
can be reproduced faithfully. The facsimile data
represents binary images, in monochrome, with two
levels of intensity, belonging to the data type of
bit-mapped graphics.
The simplest representation is the bit-map itself.
The bits, each of which corresponds to a single picture
element, are arranged in the same order as that in
which the original picture is scanned, 1s standing for
- 32 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
black pixels and 0s for white ones. Operations on the
picture are easily carried out. For example, two images
represented in the bit-map format can be merged
together by using a simple logic OR operation. Any
specific pixel can be retrieved by a simple
calculation. However, its size is usually large because
of the high resolution. This makes it almost
unrealistic for storage or transmission.
Facsimile image data should therefore be compressed
to reduce its redundancy, so that the efficient storage
and transmission can be achieved.
Run-length encoding is a useful compression scheme.
Instead of the pattern, the counts of consecutive black
and white runs are used to represent the image.
Vector representation, in which the run-lengths are
coded as integers or bytes, is a useful internal
representation of images. Not only is it reasonably
compressed, but it is also quite easy for processing.
Chopping, scaling and mask-scanning are examples of the
processing operations which may be performed.
Furthermore, a conversion between different compression
schemes may have to be carried out in such a way that
the data is first decompressed into the vector format
and then recompressed. The difficulty in retrieval can
be overcome by means of line index, which gives the
pointers to each lines of the image.
A higher compression rate leads to a more efficient
transmission. But this is at the expense of ease of
processing. An example of this is the use of Huffman
Code in the CCITT 1-dimensional compression scheme.
While the data can be compressed more efficiently, it
is rather difficult to manipulate the data direcltly.
Taking the correlation between adjacent lines into
account, 2-dimensional compression can achieve an even
higher compression rate. CCITT 2-dimensional
compression and the DACOM facsimile machine use this
method.
It is desirable to integrate facsimile images with
other data types, such as text and geometric graphics;
the structure of these other types must then be
incorporated in the system. At present, only text
structure is available, while the structure for
geometric graphics is a topic for the further study.
- 33 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
In the facsimile system, the following data
structures are supported. The corresponding
descriptions, if any, are listed as well and they can
be found in Appendix 3 (except of dacom(device)).
type structure compression description
bit-map bit-map - -
vector 1D run-length vector(fax)
dacom block 2D run-length dacom(device)
CCITT T4 1D run-length t4(fax)
2D run-length t4(fax)
text text - text(fax)
As an internal data structure, vector format is
widely used for data transfer between task processes.
The set of interface routines has been extended by
introducing two subroutines, namely getl() and putl(),
which read and write line vectors directly through the
Clean and Simple interface. These two routines can be
found in Appendix 3 (getl(fax) and putl(fax))
In order to check the validity of a vector file, a
check task process check() is provided which works as a
data sink in a command string. It can also dump the
vector elements of the specific lines.
4.6 Data Conversion
In order to convert one data structure into another,
several conversion modules are provided in this system.
These modules fall into two categories, task processes
and subroutines. The task processes are MOS processes
which can only be used in the environment described in
this note, while the subroutines which are written in c
and compatible under UNIX are more generally usable.
Character strings or text can be converted into
vector format, so that an integrated image combining
picture and text can be formed.
The following table lists these conversion modules,
including their functions and descriptions (which can
be found in Appendix 3).
- 34 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
module type from to description
decomp process dacom vector decomp(fax)
recomp process vector dacom recomp(fax)
ccitt process vector t4 ccitt(fax)
t4 vector
bitmap subroutine vector bitmap bit-map(fax)
tovec subroutine bitmap vector tovec(fax)
ts subroutine ASCII string vector ts(fax)
string process ASCII string vector string(fax)
tf process text vector tf(fax)
Since each DACOM block contains a Cyclic Redundancy
Check (CRC) field, the system supplies a subroutine
crc() to calculate or check the CRC code. (see
crc(fax))
If a vector file is to be printed on the DACOM
facsimile machine, the image data should be re-
compressed into the DACOM-block format, the required
command string being shown below.
fs"e,pic|recomp|fax"w
where fs - file system task
e - read an existing file
ic - file name
recomp - re-compression task
fax - interface task for facsimile machine
w - print an image on facsimile machine
4.7 Image Manipulation
Four processing task processes are provided in the
system. These are:
(1) Chop, which applies a defined window to the input
image.
(2) Scale, which enlarges or shrinks the input image
to the defined dimensions.
(3) Merge, which puts the input image on the specified
area of a background image.
- 35 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
(4) Clean, which removes the noise on the input image.
The Clean and Simple interfaces are supported in
these processing tasks so that the tasks can be used in
command strings. However, these tasks can be neither
source nor sink in a command string. The data format
of their input and output is vector.
For example, a facsimile page can be cleaned and then
printed on the facsimile machine. Note that the image
data must be recompressed before being sent to the
facsimile machine. If the original data is the form of
DACOM block, it has to be decompressed as the
processing tasks only accept line vectors. The
required command string is shown below.
fs"e,page|clean|recomp|fax"w
where fs - file system task
e - read an existing file
page - file name
clean - cleaning task
recomp - re-compression task
fax - interface task for facsimile machine
w - print an image on facsimile machine
The descriptions of these processing tasks can be
found in Appendix 2 (chop(fax), scale(fax), merge(fax),
and clean(fax)).
In tasks 'chop' and 'merge', a window is set by
giving the coordinates of its vertices. However, it is
usually rather difficult for a human user to decide the
exact coordinates. The system supplies a subroutine
choice() which specifies a rectangular subsection of an
image by interactive manipulations of a rectangular
subsection on the screen of the Grinnell display
displaying the image. It provides a set of interactive
commands whereby a user can intuitively choose an area
he is interested in. Note that this subroutine must be
called by a MOS process and the Grinnell display must
be included in the system.
By means of these image processing modules, the image
editing described in <a href="#section-2.4">section 2.4</a> can be carried out.
Let us consider an example. An image abstracted from a
picture 'a' is to be merged onto a specified area of
another picture 'b'. First of all, the two pictures 'a'
- 36 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
and 'b' should be displayed on the left half and right
half of the screen, respectively. Assume that the two
pictures are standard DACOM pages whose dimensions are
1726x1200. They have to be shrunk to fit the dimension
of the half screen (256x512). Note that if the data
format is not vector, conversion should be carried out
first. the required command strings are:
e,a|scale"1726,1200,256,512|grinnell"0,511,255,0,z,g
fs"e,b|scale"1726,1200,256,512|grinnell"256,511,511,0,z,b
where fs - file system task
e - read an existing file
a - file name
b - file name
scale - scale task
1726,1200 - old dimension
256,512 - new dimension
grinnell - grinnell display interface task
0,511,255,0 - presentation area (the left half)
256,511,511,0 - presentation area (the right half)
z - zero write mode
g - green
b - blue
In an application process, the subroutine choice() is
called in the following ways for the user to choose the
areas on both pictures.
- 37 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
choice(r, 1726, 1200, 1, 0, 0);
/* choice the area on 'a' */
/* r - red
1726 - width of the original picture
1200 - height of the original picture
1 - left half of the screen
0 - the subsection can be of any width
0 - the subsection can be of any height
*/
choice(r, 1726, 1200, 2, 0, 0);
/* choice the area on 'b' */
/* r - red
1726 - width of the original picture
1200 - height of the original picture
2 - right half of the screen
0 - the subsection can be of any width
0 - the subsection can be of any height
*/
When the user finishes editing, the coordinates of
the chosen rectangular areas are returned. An example
is given in the table below. The widths and heights
listed in the table are actually calculated from the
coordinates returned and they indicate that the source
image has to be enlarged to fit its destination.
(0, 0)
+-------------------------------> x
|
| (x0, y0) w
| +--------------------+
| ! !
| ! !
| ! ! h
| ! !
| ! !
| +--------------------+
| (x1, y1)
V
y
original x0 y0 x1 y1 w h
a 30 40 100 120 70 80
b 100 100 1100 1100 1000 1000
- 38 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
At this stage, our final goal can be achieved by
performing a job specified below. It is assumed that
the result image is to be stored as a new file 'c'.
fs"e,a|chop"30,40,100,120|scale"70,80,1000,1000
|merge"b,0,100,100,1100,1100|fs"c,c
where fs - file system task
e - read an existing file
a - file name
chop - chop task
30,40,100,120 - the area to be abstracted
scale - scale task
70,80 - old dimension
1000,1000 - new dimension
merge - merge task
b - file name of the background image
0 - to be overlaid
100,100,1100,1100 - the area to be overlaid
fs - file system task
c - create a new file
c - the name of the file to be
created
4.8 Data Transmission
In order to transmit facsimile image data over
computer networks, using the configuration of Fig. 1,
the Network Independent File Transfer Protocol [<a href="#ref-9" title=""A Network Independent File Transfer Protocol"">9</a>] is
implemented as a MOS task process, the Clean and Simple
interface of <a href="#section-3.3">section 3.3</a> being supported [<a href="#ref-10" title=""The Implementation of NIFTP on LSI-11"">10</a>]. Thus
this module can be used in a command string directly.
In this case, the module always works in the initiator
mode, though the server mode is supported as well. Its
description can be found in Appendix 2 (ftp(fax)).
As a network-independent protocol, it employs a
transport service to communicate across the networks.
The Clean and Simple interface is also used for the
communication between the module and transport service
processes.
Suppose that an image file stored in a remote file
system is to be printed on the local facsimile machine.
Assume that the data is transmitted via the ARPANET
[<a href="#ref-21" title=""The ARPA Computer Network"">21</a>], Transport Control Protocol (TCP) [<a href="#ref-28" title=""DoD Standard Transmission Control Protocol"">28</a>] being used
as the underlying transport service. As was described
- 39 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
before, since the delay caused by the network may
result in a time-out on the local facsimile machine,
the job should be divided into two subjobs.
(1) The remote file is transmitted by using NIFTP
module. However, instead of being put on the
facsimile machine directly, the received data is
store in a temporary file.
ftp"r,b,ucl,fax,pic;tcp:1234,10,3,3,42,4521|fs"c,tmp
where ftp - NIFTP task
t - receive
b - binary
ucl - remote user name
fax - remote password
pic - remote file name
tcp - transport service process
parameters for the transport service:
1234 - local channel number
10,3,3,42 - remote address
4521 - channel reserved for the
remote server
fs - local file system task
c - create a new file
tmp - the name of the file to be created
(2) The temporary file is read and the image is sent
to the facsimile machine for printing. Here it is
assumed the data received is in the form of DACOM
block so that no conversion is needed.
fs"e,tmp|fax"w
where fs - file system task
e - read an existing file
tmp - file name
fax - interface task for facsimile machine
w - print an image on facsimile machine
We are able to exchange image data with ISI and
COMSAT. At present DACOM block is the only format that
can be used as all the three participants in this
experiment possess DACOM facsimile machines and no
- 40 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
other data format is available in both ISI and COMSAT.
However, it is the intention of the ARPA-Facsimile
community to adopt the CCITT standard for future work.
As mentioned earlier, UCL already has this facility.
Above NIFTP, a simple protocol was used to control
the transmission of facsimile data. In this protocol,
the format of a facsimile data file was defined as
follows: Each DACOM block was recorded with a 2-byte
header at the front. This header was composed of a
length-byte indicating the length of the block
(including the header) and a code-byte indicating the
type of the block. This is shown in the following
diagram.
|<--- header ---->|<------ 74 bytes ------->|
+--------+--------+-------------------------+
! length ! code ! DACOM block !
+--------+--------+-------------------------+
The Length-byte is 76 (decimal) for all DACOM blocks.
The code-byte for a setup block is 071 (octal) and 072
for a data block. A special EOP block was used to
indicate the end of a page. This block had only the
header with the length-byte set to 2 and the code-byte
undefined. A facsimile data file could contain several
pages, which were separated by EOP blocks.
5. CONCLUSION
5.1 Summary
Though techniques for facsimile transmission were
invented in 1843, it was not until the recent years
that integration with computer communication systems
gave rise to "great expectation". The system described
in this note incarnates the compatibility and
flexibility of computerised facsimile systems.
In this system, facsimile no longer refers simply to
the transmission device, but rather to the function of
transferring hard copy from one place to another. Not
only does the system allow for more reliable and
accurate document transmission over computer networks
but images can also be manipulated electronically.
Image is converted from one representation format to
another, so that different makes of facsimile machines
can communicate with each other. It is possible for a
- 41 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
picture to be presented on different bit-map devices,
e.g. TV-like screen, as it can be scaled to overcome
the incompatibilities. Moreover, the system provides
windowing and overlaying facilities whereby a
sophisticated editor can be supported.
One of the most important aspects of this system is
that text can be converted into its bit-mapped
representation format and integrated with pictures.
Geometric graphics could also be included in the
system. Thus, the facsimile machine may serve as a
printer for multi-type documents. It is clear that
facsimile will play an important role in future
information processing system.
As far as the system per se is concerned, the
following advantages can be recognised. Though our
discussion is concentrated on the facsimile system,
many features developed here apply equally well to
other information-processing systems.
(1) Flexibility: The user jobs can be easily
organised. The only thing to be done for this
purpose is to make the logical links for the
appropriate task processes.
(2) Simplicity: The interface routines are responsible
for the operations such as signal handling and
buffer management. By avoiding this burden, the
implementation of the task processes becomes very
"clean and simple".
(3) Portability: The interface routines also makes the
task processes totally independent of the
operating environment. Only these routines should
be modified if the environment were changed.
(4) Ease of extension: The power of the system can be
simply and infinitely extended by adding new task
processes.
(5) Distributed Environment: This approach can be
easily extended to a distributed environment,
where limitless hardware and software resources
can be provided.
5.2 Problems
As discussed earlier, the network we were using for
the experimental work was not designed for image data
- 42 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
transmission. The data transfer is so slow that a
time-out may be caused on the facsimile machine. Though
this problem was solved by means of local buffering and
pictures were successfully exchanged over the network,
the slowness is rather disappointing because of the
quantity of image data. The measurement showed that the
throughput was around 500 bits/sec. In other words, it
took at least 5 minutes to transfer a page. This was
caused by the network but not our system. The situation
has been improved recently. However, It is nevertheless
required that more efficient compression schemes be
developed.
At present, the system must be directly attached to
the network to be accessed. However, the network ports
are much demanded, so that frequent reconfiguration is
required.
The facsimile system can be connected only to the
local network, the Cambridge Ring, while the foreign
networks are connected via gateways to the ring. This
is shown in Fig. 12. Now the X25 network is attached to
the Ring via an X25 gateway, XG [<a href="#ref-25" title=""UK-US Collaborative Computing"">25</a>], while SATNET is
connected by another gateway, SG [<a href="#ref-25" title=""UK-US Collaborative Computing"">25</a>]. Both network are
at the transport level; XG and SG support the relevant
transport procedures. In the case of XG, this is
NITS/X25 ([<a href="#ref-26" title=""A Network Independent Transport Service"">26</a>], [<a href="#ref-27" title="X25">27</a>]); in the case of SATNET, it is
TCP/IP ([<a href="#ref-28" title=""DoD Standard Transmission Control Protocol"">28</a>], [<a href="#ref-29" title=""DoD Standard Internet Protocol"">29</a>]).
UCL facsimile
system - - - - - - - -
+--------+ / \ +------+
! ! ---- Cambridge Ring ---- ! PE !
+--------+ \ / +------+
- - - - - - - - |
/ \ |
+------+ +------+ |
! XG ! ! SG ! --- SATNET
+------+ +------+
/ \
PSS SERC NET
Fig. 12 Schematic of UCL network connection
When the network software runs in the same machine as
the application software, the Clean and Simple
interface of section 3.5 was used as an interface
between the modules. When the gateway software was
removed to a separate machine, an Inter-Processor Clean
- 43 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
and Simple [<a href="#ref-30" title=""The Orgainisation of the Current IPCS System"">30</a>] was required. The appropriate
transport process is transferred to the relevant
gateway, and appropriate facilities are implemented for
addressing the relevant gateway. Otherwise, the
software has to be little altered to cater for the
distributed case.
In our experimental work, the following problems were
also encountered.
(1) The primary memory of the LSI-11 is so small that
we cannot build up a system to include all the
modules we have developed. In order to transfer
an edited picture using the NIFTP module, we have
to first load an editor system to input and
process the picture, and then an NIFTP system is
then loaded to transmit it.
(2) The execution of an image processing procedure
becomes very slow. For example, it takes several
minutes to shrink a picture to fit the screen of
the Grinnell display. This prevents the system
from being widely used in its present form.
(3) As secondary storage, floppy disks are far from
adequate to keep image data files. At present, we
have two double-density floppy disk drives, the
capacity of each disk being about 630K bytes.
However, an image page contains at least 50K bytes
and, sometimes, this number may be doubled for a
rather complex picture. Only a limited number of
pages can be stored.
On the other hand, in our department, we have two
PDP11-44s running UNIX together with large disks
supplying abundant file storage. Their processing speed
is much higher than that of the LSIs. The UNIX file
system supports a very convenient information-
management environment. This inspired the idea that the
UNIX file system could pretend to be a file server
responsible for storing and managing the image data, so
that all the processing tasks may be carried out on
UNIX. Not only does this immediately solve the problems
listed above, but the following additional advantages
immediately accrue.
(1) UNIX provides a far better software-development
environment than LSI MOS ever can or will.
(2) The facsimile service can be enhanced to be able
- 44 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
to support many users at a time.
(3) The UNIX file system is so sophisticated that more
complex data entities can be handled.
In fact the 44s and the LSI-11, to which the
facsimile machine and Grinnell display are attached,
are all connected to the UCL Cambridge Ring. A
distributed processing environment can be built up
where a job in one computer can be initiated by another
and then the job will be carried out by cooperation of
both computers.
In such a distributed system, the LSI-11 micro-
computer, together with the facsimile machine,
constitutes a totally passive facsimile server
controlled by a UNIX user. A page is read on the
facsimile machine and the image data stream produced is
transmitted to the UNIX via the ring. The image data is
stored as a UNIX file and may be processed if
necessary. It can also be sent via the ring to the
facsimile server where it will be reprinted on the
facsimile machine.
In order to build up such a distributed environment,
IPCS [<a href="#ref-30" title=""The Orgainisation of the Current IPCS System"">30</a>] is far from adequate for this purpose, as it
does not provide any facility for a remote job to be
organised. In our system, the task controller can be
modified so that the command strings can be supplied
from a remote host on the network. Having accepted the
request, the task controller organises the relevant
task chain and the requested job is executed under its
control. The execution of the distributed job may
require synchronisation between the two computers.
These problems are discussed in detail in [<a href="#ref-31" title=""Distributed Processing for LSIs under MOS"">31</a>].
Generally speaking, a distributed system based on a
local network, which supplies cheap, fast, and reliable
communication, could be the ultimate solution of the
operational problems discussed in this section. In such
a system, different system operations are carried out
in the most suitable places.
For the time being, only a procedure-oriented task-
control language is available in this system. The
command string of the fitter can be typed from the
system console directly, the corresponding job being
organised and executed. Theoretically, this is quite
enough to cope with any requirement of a user.
However, when the job is complex, command typing
becomes very tedious and prone to error.
- 45 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Above the task-controller, a job-controller layer is
required which provides a problem-oriented language
whereby the user can easily put forward his requirement
to the system. On receipt of such a command, the job
controller translates it into a command string of the
task controller and passes the string to the task
controller so that operation request can be done.
Sometimes, one job has to be divided into several
subjobs, which are to be dealt with separately. The
job controller should be also responsible for high
level calculation and management, so that the user need
not be concerned with system details.
In the system supporting facsimile service under
UNIX, a set of high-level command is provided, while
the command strings for the facsimile station are
arranged automatically and they are totally hidden from
a UNIX user.
5.3 Future Study
At the next stage, our attention should be moved to a
higher-level, more sophisticated system which supports
a multi-type environment. In such a system, not only
does the facsimile machine work as an facsimile
input/output device, but it should also play the role
of a printer for the multi-type document. This is
because other data types, e.g. coded character text and
geometric graphics can be easily converted into bit-
mapped graphics format which the facsimile machine is
able to accept.
First of all, a data structure should be designed to
represent multi-type information. In a distributed
environment, such a structure should be understood all
over the system, so that multi-media message can be
exchanged.
In a future system, different services should be
supported, including viewdata, Teletex, facsimile,
graphics, slow-scan TV and speech. The techniques
developed for facsimile will be generalised for use of
other bit-mapped image representations, such as slow-
scan TV.
To improve the performance of the facsimile system,
we are investigating how we could use an auxiliary
special purpose processor to perform some of the image
processing operations. Such a processor will be
essential for the higher data rate involved in slow-
- 46 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
scan TV.
- 47 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Reference
[<a id="ref-1">1</a>] P. T. Kirstein, "The Role of Facsimile in Business
Communication", INDRA Note 1047, Jan. 1981.
[<a id="ref-2">2</a>] T. Chang, "A Proposed Configuration of the
Facsimile station", INDRA Note 922, May, 1980.
[<a id="ref-3">3</a>] T. Chang, "Data Structure and Procedures for
Facsimile Signal Processing", INDRA Note 923, May,
1980.
[<a id="ref-4">4</a>] S. Treadwell, "On Distorting Facsimile Image",
INDRA Note No 762, June, 1979.
[<a id="ref-5">5</a>] M. G. B. Ismail and R. J. Clarke, "A New Pre-
Processing Techniques for Digital Facsimile
Transmission", Dept. of Electronic Engineering,
University of Technology, Loughborough.
[<a id="ref-6">6</a>] T. Chang, "Mask Scanning Algorithm and Its
Application", INDRA Note 924, June, 1980.
[<a id="ref-7">7</a>] M. Kunt and O. Johnsen, "Block Coding of Graphics:
A Tutorial Review", Proceedings of the IEEE,
special issue on digital encoding of graphics,
Vol. 68, No 7, July, 1980.
[<a id="ref-8">8</a>] T. Chang, "Facsimile Data Compression by
Predictive Encoding", INDRA Note No 978, May.
1980.
[<a id="ref-9">9</a>] High Level Protocol Group, "A Network Independent
File Transfer Protocol", HLP/CP(78)1, alos INWG
Protocol Note 86, Dec. 1978.
[<a id="ref-10">10</a>] T. Chang, "The Implementation of NIFTP on LSI-11",
INDRA Note 1056, Mar. 1981.
[<a id="ref-11">11</a>] T. Chang, "The Design and Implementation of a
Computerised Facsimile System", INDRA Note No.
1184, Apr. 1981.
[<a id="ref-12">12</a>] T. Chang, "The Facsimile Editor", INDRA Note 1085,
Apr. 1981.
[<a id="ref-13">13</a>] K. Jackson, "Facsimile Compression", Project
Report, Dept. of Computer Science, UCL, June,
1981.
- 48 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
[<a id="ref-14">14</a>] R. Cole and S. Treadwell, "MOS User Guide", INDRA
Note 1042, Jan. 1981.
[<a id="ref-15">15</a>] CCITT, "Recommendation T.4, Standardisation of
Group 3 Facsimile Apparatus for Document
Transmission", Geneva, 1980.
[<a id="ref-16">16</a>] "DACOM 6450 Computerfax Transceiver Operator
Instructions", DACOM, Mar. 1977.
[<a id="ref-17">17</a>] "AED 6200LP Floppy Disk Storage System", Technical
Manual, 105499-01A, Advanced Electronics Design,
Inc. Feb. 1977.
[<a id="ref-18">18</a>] "The User Manual for Grinnelll Colour Display".
[<a id="ref-19">19</a>] D. R. Weber, "An Adaptive Run Length Encoding
Algorithm", ICC-75.
[<a id="ref-20">20</a>] R. Braden and P. L. Higginson, "Clean and Simple
Interface under MOS", INDRA Note No. 1054, Feb.
1981.
[<a id="ref-21">21</a>] L. G. Roberts et al, "The ARPA Computer Network",
Computer Communication Networks, Prentice Hall,
Englewood, pp485-500, 1973.
[<a id="ref-22">22</a>] I. M. Jacobs et al: "General Purpose Satellite
Network", Proc. IEEE, Vol. 66, No. 11,
pp1448-1467, 1978.
[<a id="ref-23">23</a>] J. W. Burren et al, "Design fo an SRC/NERC
Computer Network", RL 77-0371A, Rutherford
Laboratory, 1977.
[<a id="ref-24">24</a>] P. T. F. Kelly, "Non-Voice Network Services -
Future Plans", Proc. Conf. Business
Telecommunications, Online, pp62-82, 1980.
[<a id="ref-25">25</a>] P. T. Kirstein, "UK-US Collaborative Computing",
INDRA Note No. 972, Aug. 1980.
[<a id="ref-26">26</a>] "A Network Independent Transport Service", PSS
User Forum, Study Group 3, British Telecom,
London, 1980.
[<a id="ref-27">27</a>] CCITT, Recommendation X3, X25, X28 and X29 on
Packet Switched Data Services", Geneva 1978.
[<a id="ref-28">28</a>] "DoD Standard Transmission Control Protocol",
<a href="./rfc761">RFC761</a>, Information Sciences Inst., Marina del
- 49 -</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
Rey, 1979.
[<a id="ref-29">29</a>] "DoD Standard Internet Protocol", <a href="./rfc760">RFC760</a>,
Information Sciences Inst., Marina del Rey, 1979.
[<a id="ref-30">30</a>] P. L. Higginson, "The Orgainisation of the Current
IPCS System", INDRA Note No. 1163, Oct. 1981.
[<a id="ref-31">31</a>] T. Chang, "Distributed Processing for LSIs under
MOS", INDRA Note No. 1199, Jan. 1982.
- 50 -
UCL FACSIMILE SYSTEM INDRA Note 1185
<a href="#appendix-I">Appendix I</a>: Devices
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>AED62(DEV) AED62(DEV)
NAME
aed62 - double density floppy disk
SYNOPSIS
DCT aed62
setdct("aed62", 0170, 0170450, 0170450,
aedini, aedsio, aedint, 0);
DESCRIPTION
The Double Density disks contain 77 tracks numbered from 0
to 76. There are 16 sectors (sometimes called blocks) per
track, for a total of 1232 sectors on each side of the disk.
These are numbered 0 to 1231. Each sector contains 512
bytes, for a total of 630,784 bytes on each side of the
floppy.
Only one side of the floppy can be accessed at a time. There
is only one head per drive, and it is located on the under-
side of the disk. To access the other side, the disk must be
manually removed and inserted the other way up.
Each block is actually two blocks on the disk: an adddress
ID block and the data block. The address ID block is used
by the hardware and contains the track number, the block
number and the size of the data block that follows. When an
operation is to take place, the seek mechanism first locates
the block by reading the address ID blocks and literally
'hunting' for the correct one. It will hunt for up to 2
seconds before reporting a failure.
Both the address ID and the data blocks are followed by a
checksum word that is maintained by the hardware and is hid-
den from the user. On writing, the checksum is calculated
and appended to the block. On reading it is verified (both
on reading the ID and data blocks) and any error is reported
as a Data Check. No checking on the data block takes place
on a write, and the hardware has no idea if it was written
correctly. The only way to verify it is to read it.
Although there are two drives in the unit, they cannot be
used simultaneously. If an operation is in progress on one,
no access can be made to the other until the first operation
is complete. The driver will queue requests for both drives
however, and ensure that are performed in order.
The MOS driver is called aed62.obj. It operates on the fol-
lowing IORB entries:
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>AED62(DEV) AED62(DEV)
irfnc
The operation to be performed, as follows:
0 - Read
1 - Write
2 - Verify
3 - Seek
Read and Write cause data to be transferred to and from
disk. Verify does a hardware read without transferring
the data to memory and is used for verifying that the
data can be successfully read. The checksum at the end
of the block of each sector is verified by the
hardware. The seek command is used to move the disk
heads to a specified track.
irusr1
The drive number. Only Zero or One is accepted. This is
matched against the number dialed on the drive. If the
number is specified on both drives, or neither, a
hardware error will be reported.
irusr2
The Sector or Block Number. Must be in the range 0 to
1231 inclusive. irusr2 specifies the block number that
the transfer is to begin at for Read and Write, the be-
ginning of the verified area for the Verify command,
and the position of the head for the Seek command. In
the latter case the head will be positioned to the
track that contains the block.
iruva
This specifies the data adress, which must be even
(word boundary). If an odd address is given, the low
order bit is set to zero to make it even. Not required
for the Seek or Verify commands.
irbr
Transfer length as a positive number of bytes. Not re-
quired for the seek command, bit IS used by Verify com-
mand so that the correct number of blocks may be veri-
fied. The disk is only capable of transferring an even
number of bytes. If an odd length is given the low ord-
er bit is made zero to reduce the length to the lower
even value. The length is NOT restricted to the sector
size of 512 bytes. If the length is greater than 512,
successive blocks are read/written until the required
transfer
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>AED62(DEV) AED62(DEV)
length has been satisfied. If the length is not an ex-
act multiple of 512 bytes, only the specified length
will be read/written. Note that the hardware always
reads and writes a complete sector, so specifying a
shorter length on a read will cause the remainder of
the block to be skipped. On a write, the hardware will
repeat the last specified word until the sector is
full.
The driver will attempt to recover from all soft errors.
There is no automatic write/read verify as on mag tapes, so
that data that is incorrectly written will not be detected
as such until a read is attempted. For this reason, the ver-
ify feature can be used (see above) to force the checking of
written data. When an error is detected while performing a
read, the offending block will be re-read up to 16 times and
disk resets will be attempted during this time too. If all
fails a hardware error indication is returned to the user.
Other errors possible are Protection Error (attempt to write
to a read-only disk) and User Error, which indicates that
the parameters in the IORB were incorrect. Errors such as
there being no disk loaded, or the drive door being open are
NOT detectable by the program. The interface sees these as
Seek Errors (i.e. soft errors), and thus the driver will re-
try several times before returning a Hardware Error indica-
tion to the user. It should be noted that error recovery can
take a long time. As mentioned above, there is a 2 second
delay before a seek error is reported by the hardware, for
instance.
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>GRINNELL(DEV) GRINNELL(DEV)
NAME
grinnell - colour display
SYNOPSIS
DCT grndout
setdct("grndout", 03000, 0172520, 0172522,
grnoi, grnot, grnoti, &grndin);
DCT grndin
setdct("grndin", 03000, 0172524, 0172526,
grnoi, grnot, grnoti, &grndout);
DESCRIPTION
The Grinnell colour display has a screen of 512x512 pels.
Three colours (red, green and blue) can be used, but no grey
scale is supported. Three graphics modes are available.
These are:
(1) Alphanumeric: The input ASCII characters are displayed
at the selected positions on the screen.
(2) Graphic: Basic geometric elements, such as line and
rectangle, are drawn by means of graphics commands.
(3) Image: The input data is interpreted as bit patterns,
the corresponding images being illustrated.
The values used to construct commands are described in the
Grinnell User Manual. They are also listed below.
#define LDC 0100000 /* Load Display Channels */
#define LSM 0010000 /* Load Subchannel Mask */
#define RED 0000010 /* Read Subchannel */
#define GREEN 0000020 /* Green subchannel */
#define BLUE 0000040 /* Blue subchannel */
#define WID 0000000 /* Write Image Data */
#define WGD 0020000 /* Write Graphic Data */
#define WAC 0022000 /* Write AlphanumCh */
#define LWM 0024000 /* Load Write Mode */
#define REVERSE 0200 /* Reverse Background */
#define ADDITIVE 0100 /* Additive (not Replace) */
#define ZEROWRITE 040 /* Dark Write */
#define VECTOR 020 /* Select Vector Graph */
#define DBLEHITE 010 /* Double Height write */
#define DBLEWIDTH 004 /* Double Width write */
#define CURSORAB 002 /* Cursor (La+Lb,Ea+Eb) */</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>GRINNELL(DEV) GRINNELL(DEV)
#define CURSORON 001 /* Cursor On */
#define LUM 0026000 /* Load Update Mode */
#define Ec 001 /* Load Ea with Ec */
#define Ea_Eb 002 /* Load Ea with Ea + Eb */
#define Ea_Ec 003 /* load Ea with Ea + Ec */
#define Lc 004 /* Load La with Lc */
#define La_Lb 010 /* Load La with La + Lb */
#define La_Lc 014 /* Load La with La + Lc */
#define SRCL_HOME 020 /* Scroll dsiplay to HOME */
#define SRCL_DOWN 040 /* Scroll down one line */
#define SCRL_UP 060 /* Scroll up one line */
#define ERS 0030000 /* Erase */
#define ERL 0032000 /* Erase Line */
#define SLU 0034000 /* Special Location Update */
#define SCRL_ZAP 0100 /* unlimited scroll speed */
#define EGW 0036000 /* Execute Graphic Write */
#define LER 0040000 /* Load Ea relative */
#define LEA 0044000 /* Load Ea */
#define LEB 0050000 /* Load Eb */
#define LEC 0054000 /* Load Ec */
#define LLR 0060000 /* Load La Relative */
#define LLA 0064000 /* Load La */
#define LLB 0070000 /* Load Lb */
#define LLC 0074000 /* Load Lc */
#define LGW 02000 /* perform write */
#define NOP 0110000 /* No-Operation */
#define SPD 0120000 /* Select Special Device */
#define LPA 0130000 /* Load Peripheral Address */
#define LPR 0140000 /* Load Peripheral Register */
#define LPD 0150000 /* Load Peripheral Data */
#define RPD 0160000 /* ReadBack Peripheral Data */
#define MEMRB 00400 /* SPD - Memory Read-Back */
#define DATA 01000 /* SPD - Byte Unpacking */
#define ALPHA 06000 /* LPR - Alphanumeric data */
#define GRAPH 04000 /* LPR - Graphic data */
#define IMAGE 02000 /* LPR - Image data */
#define LTHENH 01000 /* take lo byte then hi byte */
#define DROPBYTE 0400 /* drop last byte */
#define INTERR 02000 /* SPD - Interrupt Enable */
#define TEST 04000 /* SPD - Diagnostic Test */
The MOS driver is called grin.obj. It operates on the fol-
lowing IORB entries.
iruva
This is a pointer to the buffer where the data is
stored.
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>GRINNELL(DEV) GRINNELL(DEV)
This data must be ready formtatted for the Grinnell,
since no conversion is performed by the driver.
irbr
This transfer length as a positive number of bytes.
Addressing the grinnell. Rows consist of elments numbered 0
to 511 running left to right. The lines are number from 0 to
511 running from bottom to top. It is thus addressed as a
conventional X-Y coordinate system. Note that this coordi-
e system is different the one used for the image.
X A
|
| (511, 511)
511 +-------------------------------+
| |
| |
| |
| |
| (x, y) |
| + |
| |
| |
| |
| |
| |
+-------------------------------+----->
0 511 Y
SEE ALSO
grinnell(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>DACOM(DEV) DACOM(DEV)
NAME
dacom - facsimile machine
SYNOPSIS
DCT faxinput
setdct("faxin", 0350, 0174750, 0174740,
faxii, faxin, faxini, &faxoutput);
DCT faxoutput
setdct("faxout", 0354, 0174752, 0174742,
faxoi, faxot, faxoti, &faxinput);
DESCRIPTION
The DACOM facsimile machine can read a document, creating
the corresponding image data blocks. It can also accept the
data of relevant format, printing the correponding image.
Each data block consists of 585 bits, and is stored in a
block of 74 bytes starting on a byte boundary. The final 7
bits of the last byte are not used and they are undefined.
The 585 bits in each block need to be read as a bit stream:
the bits in each byte run from the high orger end of the
byte to the low order end. The last 12 bits of the 585 bits
in each block consistute the CRC field whereby the block can
be validated.
There are two kinds of blocks: SETUP blocks and DATA blocks.
The first of block of an image data file should be a single
SETUP block. All following blocks in the file must be DATA
blocks. Note that the second block is a DATA block that con-
tains ZERO samples, i.e. a dummy data blocks. Form the third
block, the DATA blocks store the reall image data.
A standard dacom page contains about 1200 scan lines, each
of which has 1726 pels. One can choose</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
<a href="#appendix-I">Appendix I</a>I: Task Controller and Task Processes
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CCITT(FAX) CCITT(FAX)
NAME
ccitt - conversion between vector and CCITT T4 format
SYNOPSIS
ccitt() - a MOS task
command string (task name is defined as ccitt):
ccitt"<function>
DESCRIPTION
This routine operates as a MOS pipe task to convert the vec-
tors to CCITT T4 format or inversely.
The parameter function specifies what the task is to do.
value function
1c one-dimensional compression
1d one-dimensional decompression
2c[<k>] two-dimensional compression
2d two-dimensional decompression
Note k is the maximun number of lines to be coded two-
dimensionally before a one-dimensionally coded line is in-
serted. If k is omitted, the default value 2 is adopted.
SEE ALSO
vector(fax), t4(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CHECK(FAX) CHECK(FAX)
NAME
check - check the validity of a vector file.
SYNOPSIS
check() - a MOS task
command string (the task name is defined as check):
check"<function>,<width>,<height>,[<from>,<to>]
DESCRIPTION
This routine operates as a MOS pipe task checking the vali-
dity of the input vector file.
The number of lines to be checked is specified by the param-
eter height. If the height of the image is less than the
parameter, the actual height is printed. Thus, one can set
the parameter height to a big number in order to count the
number of lines of the input image.
The run lengths in each of these lines are accumulated and
the sum is compared with the parameter width.
These are the basic functions which are performed whenever
the task is invoked. However, there are several options one
can choose by setting the one-character parameter function.
value function
'n' basic function only
'c' print the count of each line
'l' print all lines
's' print the lines in the interval
specified by parameter from and to
DIAGNOSTICS
A bad line will be reported and it will cause the job abort-
ed.
SEE ALSO
vector(fax), getl(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CHOP(FAX) CHOP(FAX)
NAME
chop - extract a designated rectangular area from an image
SYNOPSIS
chop() - a MOS task
command string (task name is defined as chop):
chop"<x0>,<y0>,<x1>,<y1>
DESCRIPTION
This routine operates as a MOS pipe task extracting a desig-
nated rectangular area from an input image. Input and out-
put are image data files in the form of vectors.
The following diagram shows the coordinate system being
used. Note that the lengths are measured in number of pels.
(0, 0) width X
+-------------------------+---->
| |
| |
| (x0, y0) |
| +---------+ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| +---------+ |
| (x1, y1) |
| |
| |
| |
| |
height +-------------------------+
|
|
Y V
As can be seen in the diagram, the rectangular area to be
extracted is specified by the parameters x0, x1, y0, y1,
which are decimal strings.
BUGS
One has to make sure that</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CHOP(FAX) CHOP(FAX)
0 < x0 < width
0 < y0 < height
0 < x1 < width
0 < y1 < height
SEE ALSO
vector(fax), getl(fax), putl(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CLEAN(FAX) CLEAN(FAX)
NAME
clean - clean an image.
SYNOPSIS
clean() - a MOS task
command string (task name is defined as clean):
clean"<width>,<height>
DESCRIPTION
This routine operates as a MOS pipe task cleaning an image
by means of mask scanning. Input and output are image data
files in the form of vectors.
The width and height should be given as the parameters.
SEE ALSO
vector(fax), getl(fax), putl(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>DECOMP(FAX) DECOMP(FAX)
NAME
decomp - decompress DACOM blocks
SYNOPSIS
decomp() - a MOS task
command string (task name is defined as decomp):
decomp
DESCRIPTION
This task takes DACOM blocks from the Clean and Simple in-
terface, and decompresses them into vector format. Then it
writes the vectors to the Clean and Simple interface.
SEE ALSO
dacom(dev), vector(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>FAX(FAX) FAX(FAX)
NAME
fax - interface process for DACOM facsimile machine
SYNOPSIS
fax() - a MOS task
command string (task name is defined as fax):
fax"<function>
DESCRIPTION
This task uses the Clean and Simple interface to read or
write facsimile image data.
The one character parameter function specifies whether the
data is to be read or written. Character w is for writing.
In this case, 74 byte DACOM blocks contaning correct CRC
fields are expected. On the other hand, character r is for
reading. In this case, a document is read on the facsimile
machine, the DACOM blocks being created.
SEE ALSO
dacom(dev), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>FITTER(FAX) FITTER(FAX)
NAME
fitter - fit processes together to form a data pipe
SYNOPSIS
fitter() - the MOS task controller
DESCRIPTION
According to the command string typed on the console, fitter
links the specified processes together to form a task chain.
The name of the processes is the name given in the PCB. The
processes must communicate using the C+S interface. Only one
C+S interface is opened per process - data is pushed in with
a cswrite and pulled out with a csread. The fitter does not
inspect the data in any way but merely passes it from one
process to another.
The format of command string is:
A | B | C.
The fitter takes data from the process called A, write it to
the process called B, reads data from the process B and
write that data to the process C. Note that all middle
processes are both read and written, while the first one in
the list is only read from and the last in the list is only
written to.
A double quote is used as the separator between the task
name and the open parameter string, e.g.
A"500 | B"n,xyz | C,
where the strings '500' and 'n,xyz' are the open parameter
stings for tasks A and B, respectively. The parameter
stirng is passed to the corresponding task routine when the
csopen call returns.
DIAGNOSTICS
The command string containing undefined task will be reject-
ed.
SEE ALSO
csinit(fax), csopen(fax), csread(fax), cswrite(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>FS(FAX) FS(FAX)
NAME
fs - file system for use under MOS
SYNOPSIS
fs() - a MOS task
command string (task name is defined as fs):
fs"<funciton>,<file_name>
DESCRIPTION
This is a file system, based on the Double Density floppy
disk, for use under MOS. The fs task is used for manipulate
the files, managed by the file system. This task can only
appear at the first or last position on a command string. In
the former case, the file specified is to be read, while the
file is to be written in the latter case.
The <function> field contains only one character indicating
the function to be performed. The possible values are:
e - open an existing file (for reading).
c - open an existing file, and set the length
to zero (for rewriting).
a - append to an existing file.
If the capitals A, C, and E are used, the functions are the
same as described above but the specified file is created if
it does not exist.
BUGS
This task is for reading and writing only. As for the other
facilities, e.g. seek, delete, status and sync, one has to
use C+S interface directly.
Note that only 15 files are permitted per disk, only drive 0
is supported at present, and no hierarchical directory is
allowed.
SEE ALSO
aed62(dev), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>FTP(FAX) FTP(FAX)
NAME
ftp, pftp - NIFTP task processes
SYNOPSIS
ftp(), pftp() - MOS tasks
command string (task name is defined as ftp):
ftp"<function>,<code>,<user_name>,<password>,<file_name>;
<trasport_service_process>:<transport_service_parameters>
DESCRIPTION
These tasks are implementation of Network Independent File
Transfer Protocol (NIFTP) for LSIs under MOS. They employ a
transport service for communication with a remote host on
the network, where the same protocol must be supported. They
communicate with the user process and transport service
processes thourgh the Clean and Simple interface, so that
they can be used in a fitter command chain directly.
The code is available in two versions: ftp which is a P+Q
version supporting both server and intitiator and pftp which
is a P version working only as an initiator. Both of them
are capable of sending and receiving.
This implementation of NIFTP is just a subset of the proto-
col as its main purpose is to provided the facsimile system
with a data transmission mechanism. For the sake of simpli-
city, only the necessary facilities are included in the
module, while more complex facilities, such as data compres-
sion and error recovery are not implemented. The following
table shows the transfer control parameters being used.
Attribute Value Mod. Remarks
Mode of access 0001 EQ Creating a new file
8002 EQ Retrieving file
Codes - - Text file, any parity
1002 EQ Binary file
Format effector 0000 EQ No interpretation
Binary mapping 0008 EQ Default byte size
Max record size 00FC EQ Default record size
Transfer size 0400 LE Default transfer size
Facilities 0000 EQ Minimum service
The meanings of the parameters in the command string are
listed below:
function is the NIFTP function of our site. Any ASCII string
beginning
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>FTP(FAX) FTP(FAX)
beginning with 't' means the file is to be transmitted to
the remote site. Otherwise, the file will be retrieved from
the remote site.
code specifies the type of the file to be transferred. Any
ASCII string beginning with 'b' means it is a binary file,
while others mean text file.
user_name is the login name of the server site.
password is the password of the server site.
file_name is the name of the file to be transmitted.
transport_service_process is the process name of the tran-
sport service to be used.
transport_service_parameters are the parameter string re-
quired by the transport service. They are network dependent
and specified by the corresponding transport service.
SEE ALSO
fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>GRINNELL(FAX) GRINNELL(FAX)
NAME
grinnell - task to convert and display fax vector data
SYNOPSIS
grinnell() - a MOS task
command string (task name is defined as string):
grinnell"<x0>,<y0>,<x1>,<y1>,<mode>,<colour>
DESCRIPTION
This task takes the vector data from a Clean and Simple in-
terface and displays it on the Grinnell screen. The Grinnell
screen is viewed as an X-Y plane with (0,0) being the lower
left hand corner, (512, 0) being the lower right hand
corner, etc.
The parameters x0, y0, x1, y1 are decimal strings defining
the rectangular space on the screen where the image is to be
displayed. If the image is smaller than this area, it is ar-
tificially expanded to the size of this area. If the image
is larger than this area it is truncated to the size of the
area.
The colour field consists of any combination of the charac-
ters r,g or b to define the colours red, green and blue
respectively. For instance "gb" would write the image as
yellow.
The mode defines how the image is to be displayed. Any com-
bination of the characters r,a and z may be used, to the
following effect:
r = reverse image
a = additive image
z = zerowrite image.
There are three bit planes to define the three colours. Nor-
mally the bit planes corresponding to the selected colours
have either zero bits or one bits written to them depending
upon whether the image or the background is being written.
For zerowrite, all non-selected bit planes (i.e. colours)
are always set to zero, thus erasing any unselected colours
in the area. Additive mode means that in the selected colour
planes the new bits are ORed in, rather than just written.
Thus the image is added to. In reverse mode, the image writ-
ten as one bits is written as zero bits and the bits written
as zero bits are written as one bits, i.e. the bits are
flipped before being used.</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>GRINNELL(FAX) GRINNELL(FAX)
SEE ALSO
grinnell(dev), vector(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>MERGE(FAX) MERGE(FAX)
NAME
merge - merge two images together
SYNOPSIS
merge() - a MOS task
command string (task name is defined as merge):
merge"<file_name>,<action>,<x0>,<y0>,<x1>,<y1>
DESCRIPTION
This routine operates as a MOS pipe task merging two images
together to form the result image. Input and output are im-
age data files in the form of vectors.
One of the two input images is called background which is to
be copied directly. This is specified by the parameter
file_name. The image data of the back ground is read via a
'tunnel', maintained by this task. Another input image is
taken form the Clean and Simple interface managed by the
fitter. As shown in the following diagram, the position
where it is to be put on the background image is specified
by the parameters x0, y0, x1, y1, which are decimal strings.
This implies that the dimension of the image is x1 - x0 and
y1 -y0.
(0, 0) width X
+-------------------------+---->
| |
| (x0, y0) |
| +---------+ |
| | | |
| | | |
| | | |
| | | |
| | | |
| +---------+ |
| (x1, y1) |
| |
| |
| (back ground) |
height +-------------------------+
|
|
Y V
The parameter action indicates how the two images are
merged. If it set to 0, The second image is simply overlaid
on the back ground image. On the other hand any non-zero
value
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>MERGE(FAX) MERGE(FAX)
causes the second image to replace the specified area of the
back ground image.
BUGS
One has to make sure that
0 < x0 < width_of_back_ground
0 < y0 < height_of_back_ground
0 < x1 < width_of_back_ground
0 < y1 < height_of_back_ground
In addition, x0, y0, x1, y1 must be consistent with the di-
mension of the image
SEE ALSO
vector(fax), getl(fax), putl(fax), chop(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>OD(FAX) OD(FAX)
NAME
od - dump the input data
SYNOPSIS
od() - a MOS task
command string (task name is defined as od):
od"<format>
DESCRIPTION
This routine operates as a MOS pipe task dumping the input
data in a selected format. The input data is taken from the
Clean and Simple interface.
The meanings of the one character parameter format are:
value format
'd' words in decimal
'o' words in octal
'c' bytes in ASCII
'b' bytes in octal
SEE ALSO
fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>RECOMP(FAX) RECOMP(FAX)
NAME
recomp - compress the vectors to form the DACOM blocks
SYNOPSIS
recomp() - a MOS task
command string (task name is defined as recomp):
recomp
DESCRIPTION
This task takes vectors from the Clean and Simple interface,
and recompresses them into DACOM blocks. Then it writes the
blocks to the Clean and Simple interface.
SEE ALSO
dacom(dev), vector(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>SCALE(FAX) SCALE(FAX)
NAME
scale - scale an image to a specified dimension
SYNOPSIS
scale() - a MOS task
command string (task name is defined as scale):
scale"<old_width>,<old_height>,<new_width>,<new_height>
DESCRIPTION
This routine operates as a MOS pipe task scaling the input
image to the specified dimension. Input and output are im-
age data files in the form of vectors.
The dimension of the input image is given by the parameters
old_width and old_height, while the dimension of the output
is specified by the parameters new_width and new_height.
SEE ALSO
vector(fax), getl(fax), putl(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>STRING(FAX) STRING(FAX)
NAME
string - convert an ASCII string to the vector format
SYNOPSIS
string() - a MOS task
command string (task name is defined as string):
string"<s>
DESCRIPTION
This routine operates as a MOS pipe task converting the
parameter string s to the corresponding vectors.
SEE ALSO
vector(fax), ts(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>TF(FAX) TF(FAX)
NAME
tf - convert a text to the vector format.
SYNOPSIS
tf() - a MOS task
command string (task name is defined as tf):
tf"<width>,<line_sp>,<upper>,<left>
DESCRIPTION
This routine operates as a MOS pipe task converting the in-
put text to the corresponding vectors. The input text, taken
from the Clean and Simple interface should be in the format
defined in text(fax).
+-------------------------+
| |
| upper |
| |
| XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| left XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| XXXXXXXXXXXX |
| width |
| |
+-------------------------+
As shown in the diagram, the parameters give the information
for the formating. The parameter width is the maximum width
of the text lines.
Every vector will be padded to fit this width. White pels
may be padded to the left of each vectors, and the number of
pel to be padded is specified by the parameter left.
Empty lines may also be inserted. They are defined by param-
eters upper and line_sp, the number of pels being used as
the unit.
SEE ALSO
vector(fax), text(fax), ts(fax), fitter(fax)</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>UCL FACSIMILE SYSTEM INDRA Note 1185
<a href="#appendix-I">Appendix I</a>II: Utility Routines and Data Formats
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>BITMAP(FAX) BITMAP(FAX)
NAME
bitmap - convert vector format to core bit map
SYNOPSIS
int bitmap(ivec, cnt, buff);
int *ivec;
int cnt;
char *buff;
DESCRIPTION
Bitmap converts the fax vector format into a bit map, using
each bit of the area pointed to by buff. The number of ele-
ments in ivec is given by cnt, and the first element of ivec
is taken as a white pel count, the second as a black pel
count, etc. The resultant bit map is placed in the area
pointed to by buff. The actual number of bits stored is re-
turned from the function. The bits in buff are stored in
byte order, with the highest value bit of the byte taken as
the first bit of the byte.
BUGS
You have to make sure that buff is big enough for all the
bits.
SEE ALSO
vector(fax), tovec(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>TOVEC(FAX) TOVEC(FAX)
NAME
tovec - convert bitmap to vector format
SYNOPSIS
int *tovec(buff, nbits);
char *buff;
int nbits;
DESCRIPTION
The bitmap in the buffer pointed to by buff is converted to
vector format. The length of the bitmap in bits is passed in
nbits. As the caller would normally not know how many vec-
tor elements are going to be needed, the tovec routine allo-
cates this area for the user.
Buff is assumed to be organised in byte order with the
highest value bit of each byte being the first bit of the
byte. The counts of white and black pels are placed into an
integer vector, the first element of which is the length of
the rest of the vector. The vector information proper starts
in the second element which is the count of the number of
leading white pels. This is followed by the count of the
numbr of black pels, etc.
The routine goes to great lengths to make sure only enough
vector storage is allocated. Temporary storage is allocated
in small chunks and then, when the length of the whole vec-
tor is known, the chunks are contacenated into a contiguous
vector. The pointer to this vector is returned to the user.
SEE ALSO
vector(fax), bitmap(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CHOICE(FAX) CHOICE(FAX)
NAME
choice - specify a rectangular area on Grinnell
SYNOPSIS
struct square {
int x0, y0;
int x1, y1;
};
struct square *choice(colour, height, width, area, fw, fh)
char colour;
int height, width, area, fw, fh;
DESCRIPTION
This subroutine is called by a MOS task. to specify a rec-
tangular area of an image by manipulating a square on the
Grinnel display being illustrating the image. The dimension
of the original image is defined as height and width. The
area on which the original image is shown is specified by
the parameter area.
value area dimension coordinates
0 the whole screen 512x512 0,511,511,0
1 the left half 256x512 0,511,255,0
2 the right half 256x512 256,511,511,0
The square will be drwan in a colour defined by the parame-
ter colour, which can only be:
value colour
'r' red
'g' green
'b' blue
There are two modes being supported:
(1) Fixed: The square will have a fixed dimension specified
by the parameters fw and fh. The operator can move the
square around as a whole within the predetermined area
by using following commands, each of which is invoked
by typing the corresponding characer on the keyboard of
the system console.
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CHOICE(FAX) CHOICE(FAX)
command function
'u' move the square up one step
'd' move the square down one step
'l' move the square one step left
'r' move the square one step right
'f' move fast - set the step to 8 pel
'o' move slowly - set the step to 1 pel
<CR> ok - the area has been chosen, and
return its coordinates
(2) Arbitrary: This mode is set up when the subroutine is
called with the parameters fw and fh set to 0. Any
edge of the square can be selected to be moved on its
own by using the same commands described above. The
following commands are required to select the relevant
edge as well as switching the operation mode.
command function
'e' select the right ('east') edge.
'w' select the left ('west') edge.
'n' select the upper ('north') edge.
's' select the lower ('south') edge.
'a' move the square as a whole
As soon as the user types <CR>, the coordinates of the
current square, which are accommodated in a square struc-
ture, are returned. Note these are concerned with the coor-
dinate system defined for the image but not for the grin-
nell.
BUGS
Currently, only three working areas can be used.
SEE ALSO
vector(fax), grinnell(dev), grinnell(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CRC(FAX) CRC(FAX)
NAME
crc - calculate or check the DACOM CRC code
SYNOPSIS
int crc(buff, insert);
char *buff;
int insert;
DESCRIPTION
This routine will check/insert the 12-bit CRC code for a
DACOM block, pointed to by buff. The block contains 585
bits, the last 12 bits being the CRC code. The block is
checked only when the parameter insert is set to 0, other-
wise the CRC code is created and inserted into the block.
When the block is checked, the routine returns the result: 0
means OK and any non-zero value means the block is bad. On
the other hand, when the CRC code is inserted, the routine
returns the CRC code it has created.
This routine uses a tabular approach to determine the CRC
code, processing a whole byte at a time and resulting in a
high throughput.
BUGS
Do not forget to supply enough space when the 12-bit CRC
code is to be inserted.
SEE ALSO
dacom(dev)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CSINIT(FAX) CSINIT(FAX)
NAME
csinit - initiate the Clean and Simple interface
SYNOPSIS
int csinit();
DESCRIPTION
This routine is called to initiate the Clean and Simple in-
terface for the calling process. Its code is re-entrant, so
that only one copy is needed for all processes in a system.
This routine returns the task identifier, which must be used
on all subsequent interface calls.
SEE ALSO
csopen(fax), csread(fax), cswrite(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CSOPEN(FAX) CSOPEN(FAX)
NAME
csopen - establish the Clean and Simple connection
SYNOPSIS
char *csopen(tid);
int tid;
DESCRIPTION
A process calls this routine, waiting to be scheduled. Its
code is re-entrant, so that only one copy is needed for all
processes in a system.
The task identifier tid is the word returned from the csinit
call. When the fitter process has established the Clean and
Simple connection for the process, this routine returns the
pointer to the parameter string of the corresponding task
command.
SEE ALSO
csinit(fax), csread(fax), cswrite(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CSREAD(FAX) CSREAD(FAX)
NAME
csread - read data from the Clean and Simple interface
SYNOPSIS
char *csread(tid, need);
int tid, need;
DESCRIPTION
This routine is called to read data from the Clean and Sim-
ple interface. Its code is re-entrant, so that only one copy
is needed for all processes in a system.
The task identifier tid is the word returned from the csinit
call. The need parameter indicates the number of bytes that
are required. This routine returns a pointer to a buffer
with this much data in it. This is usually more efficient as
it means that the data does not have to be reblocked.
DIAGNOSTICS
If the returned value is 0, the end of data is reached.
BUGS
Funnies happen at the end of data to be read. The csread()
call has no way of saying that the final buffer is partly
filled. Thus if you ask for more data, you hang forever.
But if the data structures are working correctly, this
should never happen.
SEE ALSO
csinit(fax), cswrite(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>CSWRITE(FAX) CSWRITE(FAX)
NAME
cswrite - write data to the Clean and Simple interface
SYNOPSIS
char *cswrite(tid, need);
int tid, need;
DESCRIPTION
This routine is call to write data to the Clean and Simple
interface. Its code is re-entrant, so that only one copy is
needed for all processes in a system.
The task identifier tid is the word returned from the csinit
call. The need parameter indicates the number of bytes that
are to be written. This routine returns a write buffer of
the required length, to which the user data can be copied.
The subsequent cswrite() call automatically releases the
previous write buffer.
The cswrite() call with need set to 0 indicates the end of
data, closing the current Clean and Simple connection.
BUGS
As indicated, the write buffer must be filled up before the
next cswrite() call.
SEE ALSO
csinit(fax), csread(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>GETL(FAX) GETL(FAX)
NAME
getl - get a line vector from the Clean and Simple interface
SYNOPSIS
int *getl(tid);
int tid, need;
DESCRIPTION
This routine is called to read a line vector from the Clean
and Simple interface. Its code is re-entrant, so that only
one copy is needed for all processes in a system.
The task identifier tid is the word returned from the csinit
call. The routine returns the pointer to the buffer where
the line vector is stored.
DIAGNOSTICS
0 will be returned when end of file is reached.
BUGS
Any memory violation causes the whole task chain to be
aborted.
SEE ALSO
vector(fax), putl(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>PUTL(FAX) PUTL(FAX)
NAME
putl - put a line vector to the Clean and Simple Interface
SYNOPSIS
putl(tid, buf);
int tid, *buf;
DESCRIPTION
This routine is called to write a line vector to the Clean
and Simple interface. Its code is re-entrant, so that only
one copy is needed for all processes in a system.
The task identifier tid is the word returned from the csinit
call. The line vector is stored in a buffer pointed by buf.
SEE ALSO
vector(fax), getl(fax), fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>T4(FAX) T4(FAX)
NAME
t4 - the data format defined in CCITT recommendation T4
DESCRIPTION
Dimension and Resolution: In vertical direction the resolu-
tion is defined below.
Standard resolution: 3.85 line/mm
Optional higher resolution: 7.70 line/mm
In horizontal direction, the standard resolution is defined
as 1728 black and white picture elements along the standard
line length of 215 mm. Optionally, there can be 2048 or
2432 picture elements along a scan line length of 255 or 303
mm, respectively. The input documents up to a minimum of ISO
A4 size should be accepted.
One-Dimensional Coding: The one-dimensional run length data
compression is accomplished by the popular modified Huffman
coding scheme. In this scheme, black and white runs are re-
placed by a base 64 codes representation. Compression is
achieved since the code word lengths are invertly related to
the probability of the occurrence of a particular run. A
special code (000000000001), known as EOL (End of Line),
follows each line of data. This code starts the facsimile
message phase, while the control phase is restored by a com-
bination of six contiguous EOLs (RTC). The data format of a
facsimile message is shown below.
start of the facsimile data
|
v
+---+------+---+------+-/
!EOL! DATA !EOL! DATA !
+---+------+---+------+-/
end of the facsimile data
|
v
/-+---+------+---+---+---+---+---+---+
!EOL! DATA !EOL!EOL!EOL!EOL!EOL!EOL!
/-+---+------+---+---+---+---+---+---+
|<------ RTC ------->|
Two-Dimensional Coding: The two-dimensional coding scheme is
labeled as the Modified READ Code. It codes one line with
reference to the line above,correlation between adja-
cent lines allowing for more efficient compression. In order
to limit the disturbed area in the event of transmission er-
rors,
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>T4(FAX) T4(FAX)
a one-dimensionally coded line is transmitted after one or
more two-dimensionally coded lines. A bit, following the
EOL, indicates whether one- or two-dimensional coding is
used for the next line:
EOL1: one-dimensional coding;
EOL0: two-dimensional coding.
start of the facsimile data
|
v
+----+--------+----+--------+-/
!EOL1!DATA(1D)!EOL0!DATA(2D)!
+----+--------+----+--------+-/
end of the facsimile data
|
v
/-+----+--------+----+----+----+----+----+----+
!EOL0!DATA(2D)!EOL1!EOL1!EOL1!EOL1!EOL1!EOL1!
/-+----+--------+----+----+----+----+----+----+
|<--------- RTC --------->|
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>TEXT(FAX) TEXT(FAX)
NAME
text - the text format for use in the facsimile system
DESCRIPTION
This is the representation structure for coded character
text. It is used in the facsimile system.
The text structure consists of a series of character
strings, each of which represents a text line. However no
control characters, e.g. <CR> and <LF>, are used in the
structure. Each text line is proeeded by a count byte, indi-
cating the number of characters on the line. The character
sting follows after the the count byte. A zero count indi-
cates the end of file.
EXAMPLES
Here is an example text shown below:
This is a text.
This is a picture.
It can be represented as:
<017> T h i s <040> i s <040> a <040> t e x t .
<022> T h i s <040> i s <040> a <040> p i c t u
r e . <0>
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>TS(FAX) TS(FAX)
NAME
ts - translate an ASCII string into vector format
SYNOPSIS
ts(ar_in, left, right, tid)
char *ar_in;
int left, right, tid;
DESCRIPTION
This routine will convert a zero-ended ASCII string pointed
to by ar_in into the corresponding vecter format. As the
character font being used is a set of 12x20 matrices, there
will be 20 line vectors created. These vectors are written
to the Cleans and Simple interface by calling cswrite. The
callers task identifier tid has to be provided.
At the two ends of the text line, blanks can be padded that
are specified as left and right. Note that they are meas-
ured in pels.
Consequently, the result should be a image, whose dimension
is:
width = left + 12*length + right;
height = 20;
where length is the number of characters in the input
string.
As an intermediate result the bitmap is first created which
is then converted into the vector format, by calling tovec.
BUGS
The input string must be ended with a zero field.
SEE ALSO
vector(fax), tovec(fax), csinit(fax), cswrite(fax),
fitter(fax)
</pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'>VECTOR(FAX) VECTOR(FAX)
NAME
vector - the internal data structure for a facsimile image
DESCRIPTION
This is the representation structure for binary images, a
simple run length compression algorithm being used. Most of
the image files are kept in vector format for ease of pro-
cessing.
The vector format consists of a series of integer vectors,
one vector for each row of pels in the image. Each vector is
proceeded by a count word which indicates the number of in-
teger words in the vector. The next element of the vector
after the count field is the number of white pels in the
first run of the line. The second word then gives the
number of pels that follow the initial white run, and so on
t the end of the vector. Note the first run length element
must refer to a white run. It should be set to 0 if the
first run is black.
EXAMPLES
A line consists of 20 pels as follows:
00011111111011100000
It can be represented as:
5, 3, 8, 1, 3, 5
The inverse of the line:
11100000000100011111
should be represented as:
6, 0, 3, 8, 1, 3, 5
</pre>
|