NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
SAP30100-B01 SAP703000-B01 SAP705100-B01 SAP70732-B01 U10338EJ4V0UM00 VR4100 - Datasheet Archive
µSAP30100-B01 µSAP703000-B01 µSAP705100-B01 µSAP70732-B01 MH/MR/MMR Middleware Applicable devices
User's Manual µSAP30100-B01 SAP30100-B01 µSAP703000-B01 SAP703000-B01 µSAP705100-B01 SAP705100-B01 µSAP70732-B01 SAP70732-B01 MH/MR/MMR Middleware Applicable devices µSAP30100-B01 SAP30100-B01 : µSAP703000-B01 SAP703000-B01 : µSAP705100-B01 SAP705100-B01 : µSAP70732-B01 SAP70732-B01 : Document No. U10338EJ4V0UM00 U10338EJ4V0UM00 (4th edition) Date Published September 1998 J CP(K) © Printed in Japan 1995, 1996 VR4100 VR4100 SeriesTM V850 FamilyTM V830 FamilyTM V810 FamilyTM [MEMO] 2 SUMMARY OF CONTENTS CHAPTER 1 OVERVIEW .19 CHAPTER 2 SPECIFICATIONS OF LIBRARIES .41 CHAPTER 3 INSTALLATION . 117 CHAPTER 4 SAMPLE SYSTEMS . 133 APPENDIX A SAMPLE MH/MR/MMR SOURCE LISTINGS (AP30100-B01 AP30100-B01) . 149 APPENDIX B SAMPLE MH/MR/MMR SOURCE LISTINGS (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 169 APPENDIX C GENERAL INDEX . 185 3 V800 series, V810 family, V810, V821, V830 family, V830, V831, V850 family, V852, V853, V854, V55PI V55PI, VR4100 VR4100 series, VR4100 VR4100, VR4102 VR4102, and VR4111 VR4111 are trademarks of NEC Corporation. Green Hills Software and MULTI are trademarks of Green Hills Software, Inc. U.S.A. UNIX is a trademark licensed by X/Open Company Limited in the US and other countries. Windows is a trademark of Microsoft Corporation in the United States and/or other countries. Sun4 is a trademark of Sun Microsystems, Inc. 4 The information in this document is subject to change without notice. No part of this document may be copied or reproduced in any form or by any means without the prior written consent of NEC Corporation. NEC Corporation assumes no responsibility for any errors which may appear in this document. NEC Corporation does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from use of a device described herein or any other liability arising from use of such device. No license, either express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of NEC Corporation or of others. M7A 96. 10 5 Regional Information Some information contained in this document may vary from country to country. Before using any NEC product in your application, please contact the NEC office in your country to obtain a list of authorized representatives and distributors. They will verify: · Device availability · Ordering information · Product release schedule · Availability of related technical literature · Development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, AC supply voltages, and so forth) · Network requirements In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. NEC Electronics Inc. (U.S.) NEC Electronics (Germany) GmbH NEC Electronics Hong Kong Ltd. Santa Clara, California Tel: 408-588-6000 800-366-9782 Fax: 408-588-6130 800-729-9288 Benelux Office Eindhoven, The Netherlands Tel: 040-2445845 Fax: 040-2444580 Hong Kong Tel: 2886-9318 Fax: 2886-9022/9044 NEC Electronics Hong Kong Ltd. Velizy-Villacoublay, France Tel: 01-30-67 58 00 Fax: 01-30-67 58 99 Seoul Branch Seoul, Korea Tel: 02-528-0303 Fax: 02-528-4411 NEC Electronics (France) S.A. NEC Electronics Singapore Pte. Ltd. Milton Keynes, UK Tel: 01908-691-133 Fax: 01908-670-290 Spain Office Madrid, Spain Tel: 01-504-2787 Fax: 01-504-2860 United Square, Singapore 1130 Tel: 65-253-8311 Fax: 65-250-3583 NEC Electronics Italiana s.r.1. NEC Electronics (Germany) GmbH Milano, Italy Tel: 02-66 75 41 Fax: 02-66 75 42 99 Scandinavia Office Taeby, Sweden Tel: 08-63 80 820 Fax: 08-63 80 388 NEC Electronics (France) S.A. NEC Electronics (Germany) GmbH Duesseldorf, Germany Tel: 0211-65 03 02 Fax: 0211-65 03 490 NEC Electronics (UK) Ltd. NEC Electronics Taiwan Ltd. Taipei, Taiwan Tel: 02-2719-2377 Fax: 02-2719-5951 NEC do Brasil S.A. Electron Devices Division Rodovia Presidente Dutra, Km 214 07210-902-Guarulhos-SP Brasil Tel: 55-11-6465-6810 Fax: 55-11-6465-6829 J98. 8 6 Major Changes Page Description Throughout Addition of µSAP30100-B01 SAP30100-B01 (MH/MR/MMR middleware for VR4100 VR4100 series) P.21 Correction of Section 1.2.2. P.45 Correction of Section 2.1.2 (2). P.110 Addition of description to Section 2.3.2 (8). P.147 Correction of Figure 4-12. The mark * shows major revised points. 7 [MEMO] 8 PREFACE Users This manual is intended for those users who design and develop application systems of the V800 seriesTM and VR4100 VR4100 series. Purpose This manual explains the functions of the µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, and µSAP70732-B01 SAP70732-B01. Organization This manual includes the following: · · · · · Overview Library specifications Installation Sample systems Appendixes How to read this manual In this manual, the µSAP30100-B01 SAP30100-B01 is referred to as AP30100-B01 AP30100-B01. The µSAP703000B01 SAP703000B01 is referred to as AP703000-B01 AP703000-B01. The µSAP705100-B01 SAP705100-B01 is referred to as AP705100-B01 AP705100-B01. The µSAP70732-B01 SAP70732-B01 is referred to as AP70732-B01 AP70732-B01. It is assumed that the readers of this manual have general knowledge on electric engineering, logic circuits, microcontrollers, and the C language. To learn the hardware functions of the V800 series Refer to User's Manual, Hardware for each product. To learn the instruction functions of the V800 series Refer to User's Manual, Architecture for each product. To learn the hardware function and instruction function of the VR4100 VR4100 series Refer to User's Manual for each product. Notation Data signification Memory map address Note Caution Remark Numeric value : : : : : : Left: higher digit, right: lower digit Top: higher, bottom: lower Explanation of item indicated in the text Information to which the user should afford special attention Supplementary information Binary : xxxx or xxxxB Decimal : xxxx Hexadecimal : xxxxH or 0x xxxx Units for representing powers of 2 (address space or memory space): K (kilo) : 210 = 1,024 M (mega) : 220 = 1,0242 9 Related documents Some related documents may be preliminary versions. Note, however, that whether a related document is preliminary is not indicated in this manual. Documents related to the V810 family Document name User's manual Data sheet Product name Hardware V810 TM µPD70732 PD70732 U10691E U10691E U10661E U10661E V821 TM µPD70741 PD70741 U11678E U11678E Architecture U10077E U10077E U10082E U10082E Documents related to the V830 family Document name User's manual Data sheet Product name Hardware V830 TM µPD705100 PD705100 U11483E U11483E U10064E U10064E V831 TM µPD705101 PD705101 U12979E U12979E Architecture U11483E U11483E U12496E U12496E Documents related to the V850 family Document name User's manual Data sheet Product name Hardware U11827E U11827E µPD703003 PD703003 U12261E U12261E U13188E U13188E µPD70F3003 PD70F3003 U12036E U12036E µPD70F3003A PD70F3003A, 70F3025A 70F3025A U13189E U13189E µPD70F3008 PD70F3008 U12756E U12756E µPD70F3008Y PD70F3008Y V854 TM U11826E U11826E µPD703003A PD703003A, 703004A, 703025A V853 TM µPD703002 PD703002 µPD70P3002 PD70P3002 V852 TM Architecture U12755E U12755E U10038E U10038E U10243E U10243E U10913E U10913E U11969E U11969E Documents related to the VR4100 VR4100 Document name Data sheet User's manual Application note Product name V R4100 R4100 TM U10428E U10428E U10050E U10050E V R4102 R4102 TM µPD30102 PD30102 U12543E U12543E U12739E U12739E V R4111 R4111 TM 10 µPD30100 PD30100 µPD30111 PD30111 U13211E U13211E U13137E U13137E Programming guide (U10710E U10710E) Documents related to development tools for V810 family (User's manual) Document name Document No. U11013E U11013E U11068E U11068E Assembly language U11016E U11016E C language U11010E U11010E Basic U10346E U10346E Nucleus installation U10347E U10347E Technical RX732 RX732 (Real-time OS) Operation (UNIXTM-based) Operation (WindowsTM-based) CA732 CA732 (C compiler) U10490E U10490E Documents related to development tools for V830 family (User's manual) Document name Document No. IE-705100-MC-EM1 IE-705100-MC-EM1 (In-circuit emulator for V830) U11869E U11869E IE-70000-MC-NW IE-70000-MC-NW (In-circuit emulator for V831) U12476E U12476E CA830 CA830 (C compiler) Operation (UNIX-based) U11013E U11013E Operation (Windows-based) U11068E U11068E Assembly language U11014E U11014E C language U11010E U11010E Project manager U11991E U11991E Operation (UNIX-based) U12024E U12024E Operation (Windows-based) U12206E U12206E Installation (UNIX-based) U12023E U12023E Basic U11730E U11730E Installation U11731E U11731E Technical U11713E U11713E ID830 ID830 (C source debugger) RX830 RX830 (Real-time OS) 11 Documents related to development tools for V850 family (User's manual) Document name Document No. IE-703002-MC IE-703002-MC (In-circuit emulator for V852, V853, V854) U11595E U11595E IE-703003-MC-EM1 IE-703003-MC-EM1 (Peripheral I/O board for V853) U11596E U11596E IE-703008-MC-EM1 IE-703008-MC-EM1 (Peripheral I/O board for V854) U12420E U12420E CA850 CA850 (C compiler package) Operation (UNIX-based) U12839E U12839E Operation (Windows-based) U12827E U12827E C language U12840E U12840E Assembly language U10543E U10543E Basic U13430E U13430E Technical U13431E U13431E Installation U13410E U13410E Windows-based U11158E U11158E AZ850 AZ850 (System performance analizer) Windows-based U11181E U11181E ID850 ID850 (C source debugger) U11196E U11196E RX850 RX850 (Real-time OS) RD850 RD850 (Task debugger) Operation (Windows-based) Documents related to tools produced by Green Hills SoftwareTM, Inc. (GHS) For more information about GHS tools and related documents, contact: Green Hills Software, Inc. One Cramberry Hill Lexington, MA02173 MA02173 USA 12 Telephone (617) 862-2002 Fax (617) 863-2633 CONTENTS CHAPTER 1 OVERVIEW . 19 1.1 MIDDLEWARE . 19 1.2 MH/MR/MMR . 19 1.2.1 Run-Length Encoding . 19 1.2.2 MH Method . 21 1.2.3 MR Method . 25 1.2.4 MMR Method . 30 PRODUCT OVERVIEW . 32 1.3.1 Features . 32 1.3.2 Functions . 33 1.3.3 Operating Environment . 33 1.3.4 Packages . 36 1.3.5 Targeted Performance . 40 SPECIFICATIONS OF LIBRARIES . 41 2.1 PROCESSING OUTLINE . 41 2.1.1 Library Organization . 41 2.1.2 Pixel Data and Code Data . 45 SPECIFICATIONS OF FUNCTIONS (AP30100-B01 AP30100-B01) . 48 2.2.1 Structures of AP30100-B01 AP30100-B01 (Parameters) . 48 2.2.2 External Interface (AP30100-B01 AP30100-B01) . 59 SPECIFICATIONS OF FUNCTIONS (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 88 1.3 CHAPTER 2 2.2 * 2.3 2.3.1 2.3.2 CHAPTER 3 Structures of AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, and AP70732-B01 AP70732-B01 (Parameters) . 88 External Interface (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 95 INSTALLATION . 117 3.1 3.2 * LINK METHODS . 117 LINKING SAMPLE PROGRAMS . 118 3.2.1 Sample Programs for VR4100 VR4100 series . 118 3.2.2 Sample Programs for V810 Family . 121 3.2.3 Sample Programs for V830 Family . 125 3.2.4 Sample Programs for V850 Family . 129 13 CHAPTER 4 SAMPLE SYSTEMS . 133 4.1 COMPRESSION SYSTEMS . 133 4.1.1 4.1.2 MMR Method . 137 4.1.4 4.2 MR Method . 135 4.1.3 * MH Method . 133 MR Method with API Library Used (AP30100-B01 AP30100-B01 Only) . 139 EXPANSION SYSTEMS . 140 4.2.1 4.2.2 MR Method . 141 4.2.3 * MH Method . 140 MMR Method . 142 4.2.4 MR Method with API Library Used (AP30100-B01 AP30100-B01 Only) . 143 SAMPLE MEMORY MAP . 144 4.4 *APPENDIX A 4.3 RULES OF SYMBOLIC NAME . 148 SAMPLE MH/MR/MMR SOURCE LISTINGS (AP30100-B01 AP30100-B01) . 149 APPENDIX B SAMPLE MH/MR/MMR SOURCE LISTINGS (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 169 *APPENDIX C 14 GENERAL INDEX . 185 LIST OF FIGURES (1/2) Figure No. Title Page 1-1. 20 1-2. Bit Mapped Data. 20 1-3. Strings of Run-Length Codes . 21 1-4. Encoding a Sample Line . 24 1-5. MH Codes of a Single Page . 25 1-6. Correlation of Image Patterns in the Vertical Direction . 25 1-7. Reference Points in Encoding . 26 1-8. Example of the Pass Mode . 27 1-9. Example of the Vertical Mode (a1 is the Second Pixel to the Right of b1) . 27 1-10. Example of the Horizontal Mode . 28 1-11. Sample Processing of the Beginning of a Line . 28 1-12. Sample Processing of the End of a Line . 29 1-13. K Parameter (K = 4) . 29 1-14. MR Codes of a Single Page . 30 1-15. MMR Codes of a Single Page . 31 1-16. Sample Restructuring of a Changing Point Table after Midway Run-Length 0 is Detected . 32 2-1. Encoding a Single Line . 42 2-2. Decoding a Single Line . 43 2-3. Encoding of Specified Number of Lines (when API library is used) . 44 2-4. Decoding of Specified Number of Lines (when API library is used) . 44 2-5. When the Size of Odd Code Data during Processing Plus Send Code Data Is Smaller Than 32 Bits . 46 When the Size of Odd Code Data during Processing Plus Send Code Data Is 32 Bits or More . 46 Relationship between Odd Code Data during Processing and the Number of Data Bits . 47 Relationship between Odd Code Data during Processing and the Number of Data Bits in Compression Libraries (AP30100-B01 AP30100-B01) . 49 Relationship between Odd Code Data during Processing and the Number of Data Bits in Expansion Libraries (AP30100-B01 AP30100-B01) . 53 2-10. Format of Changing Point Table (AP30100-B01 AP30100-B01) . 63 2-11. * * Sample Picture . Outline of Changing Point Table Rebuild Processing (AP30100-B01 AP30100-B01). 74 2-12. Processing of Illegal Codes (AP30100-B01 AP30100-B01) . 77 2-13. Relationship between Odd Code Data during Processing and the Number of Data Bits in Compression Libraries (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 89 2-6. 2-7. 2-8. 2-9. * 15 LIST OF FIGURES (2/2) Figure No. 2-14. Title Page Relationship between Odd Code Data during Processing and the Number of Data Bits in Expansion Libraries (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 93 2-15. Format of Changing Point Table (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 99 2-16. Outline of Changing Point Table Rebuild Processing (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 110 2-17. Processing of Illegal Codes (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) . 113 4-1. MH Encoding Flowchart . 134 4-2. MR Encoding Flowchart . 136 4-3. MMR Encoding Flowchart . 138 *4-4. 4-5. MR Encoding Flowchart with API Library Used . 139 4-6. MR Decoding Flowchart . 141 4-7. MMR Decoding Flowchart . 142 *4-8. *4-9. MR Encoding Flowchart with API Library Used . 143 MH Decoding Flowchart . 140 Memory Map of a Sample Compression/Expansion Program (AP30100-B01 AP30100-B01): VR4100 VR4100 . 144 4-10. Memory Map of a Sample Compression/Expansion Program (AP703000-B01 AP703000-B01): V851 . 145 4-11. Memory Map of a Sample Compression/Expansion Program (AP705100-B01 AP705100-B01): V830 . 146 *4-12. Memory Map of a Sample Compression/Expansion Program (AP70732-B01 AP70732-B01): V810 Family . 147 16 LIST OF TABLES (1/1) Table No. Title Page 1-1. 22 1-2. Codes of the Vertical Mode . 27 2-1. Compression Library . 41 2-2. * Run-Length Codes . Expansion Library . 41 2-3. API Library . 41 17 [MEMO] 18 CHAPTER 1 OVERVIEW 1.1 * MIDDLEWARE Middleware is a group of software programs tuned to deliver the entire performance of a processor and implements the processing that was implemented by the hardware. High-performance reduced instruction set computer (RISC) processors have been introduced, and environments that allow the RISC processors to be easily incorporated into systems have become available. Now, the concept of the middleware can be realized. NEC will provide middleware for voice codecs, image data compression/expansion, or other fundamental technologies for implementing multimedia systems with the VR4100 VR4100 series and V800 series at just the right time in order to support customers' system development. AP30100-B01 AP30100-B01, AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, and AP70732-B01 AP70732-B01 are middleware products that provide FAX codec functions. 1.2 MH/MR/MMR MH (Modified Huffman), MR (Modified Relative element address designate), and MMR (Modified MR) are methods of encoding (compressing) binary image information, specified in recommendations of the ITU-T (International Telecommunications Union). Decoding (expansion) is the reverse of encoding. For details of the recommendations of the ITU-T, refer to these documents: "ITU-T T.4 Standardization of Group 3 Facsimile Apparatus for Document Transmission" "ITU-T T.4 Amend. 1 Standardization of Group 3 Facsimile Apparatus for Document Transmission" "ITU-T T.6 Facsimile Coding Schemes and Coding Control Functions for Group 4 Facsimile Apparatus" 1.2.1 Run-Length Encoding When a scanner reads the picture shown in Figure 1-1 as binary image information, for example, the bit mapped data indicated in Figure 1-2 is placed into memory. A white pixel is represented by a zero-bit while a black pixel is represented by a one-bit. 19 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL Figure 1-1. Sample Picture Figure 1-2. Bit Mapped Data Scanning direction Remarks 20 : 0-bit : 1-bit CHAPTER 1 OVERVIEW When the picture is scanned in the direction indicated in Figure 1-2, the first one-bit (changing point) is found after a series of zero-bits. Then, another changing point from the one-bit to zero-bit is detected. Run-length encoding is to convert the number of consecutive pixels with identical colors (white or black) between two changing points (referred to as run length) into a code. If the run length is used as a code, for example, the bit mapped data in Figure 1-2 is converted to numerical character strings indicated in Figure 1-3. The encoding compresses the original data of 40-by-40 pixels (= 1,600 bits = 200 bytes) into tens of bytes. The difference in amount of data can be increased by using a scanner with higher resolution. Figure 1-3. Strings of Run-Length Codes 341 1 38 1 39 1 38 2 37 3 36 4 36 5 37 8 30 11 27 13 25 15 23 18 20 21 18 22 18 23 16 24 16 24 16 24 17 22 18 22 20 19 23 16 25 14 28 11 31 7 259 If the color of the scanning start point and the horizontal dimension of the image are provided, the original image can be easily reproduced from the codes through the reverse of encoding. The reproduced image is a complete copy of the original image. This is the concept of run-length encoding. Different encoding methods recommended by the ITU-T described in subsequent sections are based on this run-length encoding. 1.2.2 MH Method The MH method is also referred to as one-dimensional coding method. In this method, the run length is counted on each horizontal line of the image data. Table 1-1 lists the runlength codes used in this method. The codes are divided into two types: terminate and make-up. A run length below 64 is assigned a terminate code. A run length of 64 or above is assigned a combination of a makeup code and terminate code. (See Examples 1 and 2.) Example 1. Run length 231 231 = 64 x 3 + 39 = 192 + 39 Terminate code Make-up code Example 2. Run length 128 128 = 64 x 2 + 0 = 128 + 0 Terminate code Make-up code 21 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL Table 1-1. Run-Length Codes (a) Terminate codes Coded word for white run-length Coded word for black run-length Coded word for white run-length Coded word for black run-length 0 00110101 0000110111 32 00011011 000001101010 1 000111 010 33 00010010 000001101011 2 0111 11 34 00010011 000011010010 3 1000 10 35 00010100 000011010011 4 1011 011 36 00010101 000011010100 5 1100 0011 37 00010110 000011010101 6 1110 0010 38 00010111 000011010110 7 1111 00011 39 00101000 000011010111 8 10011 000101 40 00101001 000001101100 9 10100 000100 41 00101010 000001101101 10 00111 0000100 42 00101011 000011011010 11 01000 0000101 43 00101100 000011011011 12 001000 0000111 44 00101101 000001010100 13 000011 00000100 45 00000100 000001010101 14 110100 00000111 46 00000101 000001010110 15 110101 000011000 47 00001010 000001010111 16 101010 0000010111 48 00001011 000001100100 17 101011 0000011000 49 01010010 000001100101 18 0100111 0000001000 50 01010011 000001010010 19 0001100 00001100111 51 01010100 000001010011 20 0001000 00001101000 52 01010101 000000100100 21 0010111 00001101100 53 00100100 000000110111 22 0000011 00000110111 54 00100101 000000111000 23 0000100 00000101000 55 01011000 000000100111 24 0101000 00000010111 56 01011001 000000101000 25 0101011 00000011000 57 01011010 000001011000 26 0010011 000011001010 58 01011011 000001011001 27 0100100 000011001011 59 01001010 000000101011 28 0011000 000011001100 60 01001011 000000101100 29 00000010 000011001101 61 00110010 000001011010 Run length Run length 30 00000011 000001101000 62 00110011 000001100110 31 00011010 000001101001 63 00110100 000001100111 22 CHAPTER 1 OVERVIEW (b) Make-up codes Coded word for white run-length Coded word for black run-length 64 11011 0000001111 1792 00000001000 128 10010 000011001000 1856 00000001100 192 010111 000011001001 1920 00000001101 256 0110111 000001011011 1984 000000010010 320 00110110 000000110011 2048 000000010011 384 00110111 000000110100 2112 000000010100 448 01100100 000000110101 2176 000000010101 512 01100101 0000001101100 2240 000000010110 576 01101000 0000001101101 2304 000000010111 640 01100111 0000001001010 2368 000000011100 704 011001100 0000001001011 2432 000000011101 768 011001101 0000001001100 2496 000000011110 832 011010010 0000001001101 2560 000000011111 896 011010011 0000001110010 960 011010100 0000001110011 1024 011010101 0000001110100 1088 011010110 0000001110101 1152 011010111 0000001110110 1216 011011000 0000001110111 1280 011011001 0000001010010 1344 011011010 0000001010011 1408 011011011 0000001010100 1472 010011000 0000001010101 1536 010011001 0000001011010 1600 010011010 0000001011011 1664 011000 0000001100100 1728 010011011 0000001100101 EOL 000000000001 000000000001 Run length Run length Coded word (common to white run-length and black run-length) 23 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL Figure 1-4 indicates an example of encoding a single line. When a line beginning with a black pixel is encoded, it is postulated that a virtual white pixel precedes the first black pixel. Figure 1-4. Encoding a Sample Line Image data White 0 Black 15 White 139 White Black 18 14 Black 640 White 902 Total 1728 bits Encoded data White 0 Black 15 White 128 White 11 Black 0 Black 640 00110101 000011000 10010 01000 0000001001010 White 14 Black 18 0000110111 110100 0000001000 White 896 White 6 011010011 1110 Total 79 bits The data of a single page is encoded in these steps: * First, the EOL (end of line) code of the code table is output. A single line is encoded. If necessary, fill bits, which are two or more 0-bits, are added to keep the minimum transmission timeNote. The EOL code is added. Steps to are repeated. After the codes of the last line of the page (or fill bits following the codes of the last line), the RTC (return to control) code is added to indicate the end of the page. Note that: RTC = EOL x 6 Note Minimum transmission time In facsimile transmission, allowable reception speeds vary between receiving machines. The allowable reception speed generally depends on the size of the reception buffer and print-out speed. The amount of encoded data depends on the pattern of the original image data and determines the transmission speed. If short line codes are sent at short intervals to a machine with low reception speed, the machine must receive a line code before completing the output of the image of the previous line. The machine may fail to receive some data. Each model has its own minimum time to receive the codes of a single line (minimum transmission time). If a machine sending the codes of a single line cannot keep the minimum transmission time, fill bits should be inserted. Before starting code transmission, machines should exchange their own minimum transmission time. 24 CHAPTER 1 OVERVIEW Through those steps, the image data of the page is encoded as indicated in Figure 1-5. Figure 1-5. MH Codes of a Single Page EOL Codes of a single line EOL EOL Codes of a single line Codes of a single line Fill bit EOL RTC Remark RTC = EOL x 6 1.2.3 MR Method In the MR method, attention is given to the correlation of image data in the vertical direction. Each line is compared with the previous line and encoded according to the result of the comparison. A document image containing characters and pictures basically consists of vertical, horizontal, and slanting lines. There is a high probability that an image pattern found on a line is similar to another pattern found on the previous or subsequent line, as on lines 1 and 2 in Figure 1-6. On the contrary, it is also highly probable that two consecutive lines have completely different image patterns, as on lines 3 and 4 in Figure 1-6. This method assigns short codes to these two cases and is expected to provide a higher compression ratio than the MH method. Figure 1-6. Correlation of Image Patterns in the Vertical Direction Line 1 Line 2 Line 3 Line 4 25 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL First, the terms and symbols used in the description of this method are defined. A line before the line to be encoded is referred to as a reference line. Changing points on the line to be encoded and reference line are labeled a1, a2, b1, and b2 as indicated in Figure 1-7. The positional relationships among those four pixels are divided into three modes and encoded. a0 is a reference point from which scanning starts. The five pixels are defined as indicated below: a0 : Label to a virtual white pixel placed immediately before the first pixel of a line when the line is encoded. After a range of a line beginning with a0 is encoded, another a0 is placed after the encoded area. a1 : Label to the first changing point after a0 on the line to be encoded a2 : Label to the first changing point after a1 on the line to be encoded b1 : Label to the first pixel that has a color opposite to the color of a0 and that is to the right of a point corresponding to a0 on the reference line b2 : Label to the first changing point after b1 on the reference line Figure 1-7. Reference Points in Encoding Beginning of a line b1 b2 Reference line a0 a1 a2 Line to be encoded Virtual white pixel These three encoding modes are considered: · Pass mode · Vertical mode · Horizontal mode The modes are detailed below: (1) Pass mode The pass mode represents an instance in which b2 is to the left of the point corresponding to a1. On the line to be encoded, the next changing point after a0 is not found to the left of the point corresponding to b2 (Figure 1-8). An example of this mode is the combination of lines 3 and 4 in Figure 1-6. The line is encoded as follows: The code of pass mode, P (= 0001), is output. New reference point a0' is placed at the point corresponding to b2. a0' functions as a0 in the subsequent encoding. 26 CHAPTER 1 OVERVIEW Figure 1-8. Example of the Pass Mode b1 b2 Reference line a0 a1 Line to be encoded New reference point a0' Code: P = 0001 (2) Vertical mode The vertical mode represents an instance in which a1 is within an area of three pixels to the right and left of the point corresponding to b1 (Figure 1-9). An example is the combination of lines 1 and 2 in Figure 1-6. The line is encoded as follows: A code indicating the relative position of a1 against b1 (right or left) and the distance between a1 and b1 (number of pixels) is output (Table 1-2). A new reference point a0' is placed at a1. a0' functions as a0 in the subsequent encoding. Table 1-2. Codes of the Vertical Mode Type Positional relationship between a1 and b1 Code V (0) a1 is just below b1. 1 VL (1) a1 is the first pixel to the left of b1. 010 VL (2) a1 is the second pixel to the left of b1. 000010 VL (3) a1 is the third pixel to the left of b1. 0000010 VR (1) a1 is the first pixel to the right of b1. 011 VR (2) a1 is the second pixel to the right of b1. 000011 VR (3) a1 is the third pixel to the right of b1. 0000011 Figure 1-9. Example of the Vertical Mode (a1 is the Second Pixel to the Right of b1) b1 Reference line a0 a1 Line to be encoded 2 New reference point a0' Code: VR (2) = 000011 27 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL (3) Horizontal mode The horizontal mode represents an instance that does not correspond to the pass mode nor vertical mode. That is, b2 is to the right of the point corresponding to a1 and the distance between a1 and b1 is greater than three pixels (Figure 1-10). The line is encoded as follows: The code of the horizontal mode, H (= 001), is output. The run length from a0 to a1 is encoded according to the MH code table (Table 1-1). The run length from a1 to a2 is encoded according to the MH code table (Table 1-1). A new reference point a0' is placed at a2. a0' functions as a0 in the subsequent encoding. Figure 1-10. Example of the Horizontal Mode b1 b2 Reference line a0 a1 a2 Line to be encoded New reference point a0' Code: 001 + 001111 + 011 H White 10 Black 4 Special processing is necessary for the special relationship between a0-a2 and b1-b2 at the beginning or end of each line. If a line begins with a black pixel, it is postulated that a virtual white pixel precedes the first pixel of the line. The virtual pixel is labeled as a0. When the line beginning with a black pixel is encoded, as shown in Figure 1-11, code H is followed by a code of run-length 0. Figure 1-11. Sample Processing of the Beginning of a Line Beginning of a line b2 b1 Reference line a0 a2 Line to be encoded New reference point a0' Code: 001 + 00110101 + 0010 H White 0 Black 6 a0: Virtual white pixel At the end of a line, it is postulated that the last pixel of a line is followed by a virtual pixel of the opposite color. The pixels including the virtual pixel are encoded (Figure 1-12). 28 CHAPTER 1 OVERVIEW Figure 1-12. Sample Processing of the End of a Line b1 End of a line b2 Reference line a1 a0 Line to be encoded Code: 001 + 10011 + 000110111 Black 0 H White 8 b2: Virtual white pixel a1: Virtual black pixel This encoding is referred to as the two-dimensional coding method. When the data of a single page is encoded, a K parameter and a combination of the one-dimensional and two-dimensional coding methods are used (Figure 1-13). The encoding procedure is as follows: The first line is encoded in the one-dimensional coding method. The second and subsequent lines are encoded in the two-dimensional coding method. The (K + 1)-th line is encoded in the one-dimensional coding method. Steps to are repeated. In other words, every K-th line is encoded in the one-dimensional coding method. In the two-dimensional coding method, a line is compared to the preceding line and encoded. If a code of a line is converted to a wrong code because of a transmission error or other reasons, this line and all subsequent lines will be decoded into wrong images. In order to prevent this trouble, every K-th line is encoded in the onedimensional coding method. Generally, the K value depends on the vertical resolution, as indicated below: · 100 LPI (lines per inch): K = 2 · 200 LPI (lines per inch): K = 4 Figure 1-13. K Parameter (K = 4) One-dimensional coding Reference Two-dimensional coding Reference Two-dimensional coding Reference Two-dimensional coding One-dimensional coding Reference Two-dimensional coding 29 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL Delimiters are added to distinguish between lines coded in the one-dimensional coding method and lines coded in the two-dimensional coding method. · Immediately before one-dimensional coding: EOL + 1 · Immediately before two-dimensional coding : EOL + 0 At the end of a page, this code is added: RTC = (EOL + 1) x 6 Through this coding, the image data of a single page is converted as indicated in Figure 1-14. Figure 1-14. MR Codes of a Single Page EOL + 1 One-dimensional coding EOL + 1 One-dimensional coding EOL + 0 Two-dimensional coding EOL + 0 Fill bit Two-dimensional coding EOL + 1 RTC Remark RTC = (EOL + 1) x 6 1.2.4 MMR Method In the MMR method, all lines are subjected to two-dimensional coding. The first line of a page can be coded in the two-dimensional coding method by assuming that a virtual line of white pixels precedes the first line. The MR method has been specified on the premise that the encoded data is transmitted on an ordinary telephone line. The method uses the K parameter to prevent the effect of a transmission error from spreading. On the other hand, the MMR method has been specified on the precondition of error-free transmission over a digital line. The value of the K parameter used in the MMR method is infinite. The procedure for encoding the data of a single page is as follows: It is postulated that a virtual line of white pixels precedes the first line of the page. Starting from the first line, all lines are subjected to two-dimensional coding. No delimiters are used to separate the codes of lines. As a code indicating the end of the page, the EOFB (end of facsimile block) code is added after the codes of the last line. Note that: EOFB = EOL x 2 If the encoded data of a single page must have a specified number of bytes or must exceed a predetermined size, the remaining space after the EOFB code is padded with a string of zero-bits. 30 CHAPTER 1 OVERVIEW Figure 1-15 shows how the image data of a single page is encoded in this method. Figure 1-15. MMR Codes of a Single Page Two-dimensional coding Two-dimensional coding Two-dimensional coding Two-dimensional coding Two-dimensional coding EOFB Pad bit Remark EOFB = EOL x 2 31 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL 1.3 1.3.1 PRODUCT OVERVIEW Features This middleware uses an interface equivalent to codec instructions of the V55PITM V55PITM. The detailed internal information including suppression information is made public. Suppression information: Returned from the library when the processing is halted after compressed data is entirely written or read into the transmission or reception buffer The middleware can be called from the C language of a C compiler produced by NEC/GHS (Green Hills Software). The middleware supports the real-time OS for NEC/GHS (reentrant). The middleware supports the restructuring of a changing point table when midway run-length 0 is detected during decoding. The restructuring of a changing point table in encoding is not supported. Midway run-length 0 : Instance in which a white or black pixel has run length 0 at a point except the beginning of a line, detected in decoding Changing point table : Run-length information of a single line Figure 1-16 shows how a changing point table is restructured after midway run-length 0 is detected. Figure 1-16. Sample Restructuring of a Changing Point Table after Midway Run-Length 0 is Detected Changing point table (before restructuring) 5 (White) 7 (Black) White run-length Changing point table (after restructuring) 5 (White) 7 (Black) 3 (White) 0 (Black) 2 (White) Midway run-length 0 5 (White) 4 (Black) The run lengths before and after the midway run-length 0 are added. 32 4 (Black) CHAPTER 1 OVERVIEW 1.3.2 Functions * (1) Core library The core library realizes the features of MH/MR/MMR by using nine functions. These functions is used in combination to perform MH/MR/MMR compression/expansion processing. · Compression system This system creates a changing point table for a single line of data in a specified pixel data buffer area, compresses the data by applying the MH/MR/MMR method, then outputs the code data to the send buffer. · Expansion system This system creates a changing point table for a single line of data, read from a specified receive buffer area by means of the MH/MR/MMR method, and expands that data. Then, the system outputs the resulting pixel data to the print buffer. * (2) API library (APplication user Interface, AP30100-B01 AP30100-B01 only) The API library facilitates interfacing between the user application and middleware. It performs MH/MR/ MMR compression/expansion by calling a core library for compression or expansion. 1.3.3 * Operating Environment · Applicable CPU: VR4100 VR4100 series (AP30100-B01 AP30100-B01)Note V850 family (AP703000-B01 AP703000-B01) V830 family (AP705100-B01 AP705100-B01) V810 family (AP70732-B01 AP70732-B01) Note Operation mode : 32-bit mode Endian : Little endian 33 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · Necessary memory size (AP30100-B01 AP30100-B01) * Memory type ROM (about 100K bytes) Contents Program Core library Compression: About 6K bytes Expansion: About 12K bytes API library Compression: About 11K bytes (5K bytes + 6K bytes)Note 1 Expansion: About 17K bytes (5K bytes + 12K bytes)Note 1 Encoding/decoding table Encoding table Decoding table RAM About 21K bytes About 33K bytes Changing point table Note 2 Necessary memory size differs depending on image size and transmission/reception buffer size. Buffer Pixel data storage buffer Transmission/ reception buffer Print buffer I/O parameter area Core library Compression: 58 bytes Expansion: 60 bytes API library Note 1 Compression: 106 bytes (48 bytes + 58 bytes) Expansion: 108 bytes (48 bytes + 60 bytes) Stack area Core library Compression: About 100 bytes Expansion: About 150 bytes API library Note 1 Compression: About 250 bytes (150 bytes + 100 bytes) Expansion: About 300 bytes (150 bytes + 150 bytes) Notes 1. Size of API library = Size of API library + Size of core library 2. Minimum size of changing point table: Per line = (Number of pixels on 1 line + 3) x 2 bytes Caution The memory size may be changed without notice. 34 CHAPTER 1 OVERVIEW · Necessary memory size (AP703000-B01 AP703000-B01, AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) Memory type Contents ROM Program (core library) (about 64K bytes) Compression: About 3K bytes Expansion: About 4K bytes Encoding/decoding table Encoding table Decoding table RAM About 22K bytes About 35K bytes Buffer Changing point table Note Necessary memory size differs depending on image size and Pixel data storage buffer transmission/reception buffer size. Transmission/reception buffer Print buffer I/O parameter area + Internal information area Compression: 94 bytes Expansion 92 bytes (AP705100-B01 AP705100-B01, AP70732-B01 AP70732-B01) 96 bytes (AP703000-B01 AP703000-B01) Note Minimum size of changing point table: Per line = (Number of pixels on 1 line + 1) x 2 bytes Caution The memory size may be changed without notice. · Support tools * VR4100 VR4100 Series (AP30100-B1 AP30100-B1) C Compiler/Assembler (GHS) CC-MIPE (Windows version, SUN4TM version) (Ver.1.8.8 or later) V850 Family (AP703000-B01 AP703000-B01) C Compiler/Assembler (NEC) CA850 CA850 (Windows version, SUN4 version) (Ver.1.00 or later) C Compiler/Assembler (GHS) CC850 CC850 (Windows version, SUN4 version) (Ver.1.8.7B or later) V830 Family (AP705100-B01 AP705100-B01) C Compiler/Assembler (NEC) CA830 CA830 (Windows version, SUN4 version) (Ver.1.00 or later) C Compiler/Assembler (GHS) CC830 CC830 (Windows version, SUN4 version) (Ver.1.8.8 or later) V810 Family (AP70732-B01 AP70732-B01) C Compiler/Assembler (NEC) CA732 CA732 (Windows version, SUN4 version) (Ver.2.00 or later) C Compiler/Assembler (GHS) CC810 CC810 (Windows version, SUN4 version) (Ver.1.8.7B or later) 35 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL 1.3.4 Packages The contents of packages are indicated below: * (1) AP30100-B01 AP30100-B01 (V 4100 series) R 36 : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c mre_api.c : : : : : : : : crt4100.s codec_vr.h makenorm makeapi ghstools libmhmr.a mrd_api.c / : : : : Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample main source for MR-method compression (API library used) Sample main source for MR-method expansion (API library used) Sample startup routine Header file Make file (API library not used) Make file (API library used) CHAPTER 1 OVERVIEW (2) AP703000-B01 AP703000-B01 (V850 family) The packages for NEC and GHS are available. The two packages have different object formats. root nectools ghstools libmhmr.a : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c crt850.s codec850.h makefile mr_enc.lnk mr_dec.lnk : : : : : : : : : : : libmhmr.a : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c crt850.s reset.s codec850.h makefile : : : : : : : : : : Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample startup routine Header file Make file Link file Link file Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample startup routine Reset vector Header file Make file 37 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL (3) AP705100-B01 AP705100-B01 (V830 family) The packages for NEC and GHS are available. The two packages have different object formats. root nectools ghstools : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c crt830.s codec830.h makefile mr_enc.lnk mr_dec.lnk : : : : : : : : : : : libmhmr.a 38 libmhmr.a : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c crt830.s reset.s codec830.h makefile : : : : : : : : : : Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample startup routine Header file Make file Link file Link file Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample startup routine Reset vector Header file Make file CHAPTER 1 OVERVIEW (4) AP70732-B01 AP70732-B01 (V810 family) The packages for NEC and GHS are available. The two packages have different object formats. root nectools ghstools libmhmr.a : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c crt810.s codec810.h makefile mr_enc.lnk mr_dec.lnk : : : : : : : : : : : libmhmr.a : Library mh_enc.c mr_enc.c mmr_enc.c mh_dec.c mr_dec.c mmr_dec.c crt810.s reset.s codec810.h makefile : : : : : : : : : : Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample startup routine Header file Make file Link file Link file Sample main source for MH-method compression Sample main source for MR-method compression Sample main source for MMR-method compression Sample main source for MH-method expansion Sample main source for MR-method expansion Sample main source for MMR-method expansion Sample startup routine Reset vector Header file Make file 39 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL 1.3.5 Targeted Performance * (1) AP30100-B01 AP30100-B01 Conditions CPU : VR4100 VR4100 (40 MHz/external 10 MHz), Internal cache memory (instruction: K factor = 4 (MR method) Data : ITU-T chart 1 (1,728 x 2,376 dots) Performance MH method : Compression time - About MR method : Compression time - About MMR method: Compression time - About 32-bit bus, 2K bytes, data: 1K byte) 0.18 seconds; Expansion time - About 0.19 seconds 0.23 seconds; Expansion time - About 0.27 seconds 0.22 seconds; Expansion time - About 0.25 seconds (2) AP703000-B01 AP703000-B01 Conditions CPU : V853 (33 MHz), 16-bit bus K factor = 4 (MR method) Data : ITU-T chart 1 (1,728 x 2,376 dots) Performance MH method : Compression time - About 0.17 seconds; Expansion time - About 0.15 seconds MR method : Compression time - About 0.20 seconds; Expansion time - About 0.20 seconds MMR method: Compression time - About 0.20 seconds; Expansion time - About 0.19 seconds (3) AP705100-B01 AP705100-B01 Conditions CPU : V830 (100 MHz), 32-bit bus K factor = 4 (MR method) Data : ITU-T chart 1 (1,728 x 2,376 dots) Performance MH method : Compression time - About 0.06 seconds; Expansion time - About 0.07 seconds MR method : Compression time - About 0.07 seconds; Expansion time - About 0.09 seconds MMR method: Compression time - About 0.09 seconds; Expansion time - About 0.08 seconds (4) AP70732-B01 AP70732-B01 Conditions CPU : V810 (25 MHz), 32-bit bus, cache-on K factor = 4 (MR method) Data : ITU-T chart 1 (1,728 x 2,376 dots) Performance MH method : Compression time - About 0.17 seconds; Expansion time - About 0.20 seconds MR method : Compression time - About 0.23 seconds; Expansion time - About 0.28 seconds MMR method : Compression time - About 0.24 seconds; Expansion time - About 0.28 seconds 40 CHAPTER 2 SPECIFICATIONS OF LIBRARIES 2.1 PROCESSING OUTLINE 2.1.1 Library Organization Table 2-1 lists the contents of the compression library. Table 2-2 lists the contents of the expansion library and Table 2-3 lists the contents of the API libraryNote. Note Only AP30100-B01 AP30100-B01 Table 2-1. Compression Library Function name Function Description mr_albit() Data transmission Sends the EOL code, tag bit, RTC, fill bit, and other data. mr_coltrp() Changing point Creates a changing point table of the pixel data of a single line. table creation mr_mhenc() MH encoding Executes MH encoding according to the changing point table of a single line. mr_mrenc() MR encoding Executes MR encoding according to the changing point table of a reference line and the line to be encoded. Table 2-2. Expansion Library Function name Function Description mr_scheol() EOL detection Detects the EOL code from the encoded data. mr_getbit() 1-bit detection Detects a tag bit from the encoded data. mr_mhdec() MH decoding Decodes the data in the MH method and creates the changing point table of a single line. mr_mrdec() MR decoding Executes MR decoding according to the changing point table of an encoded line and reference line and creates a changing point table of a single line. mr_cnvtrp() Pixel data creation Creates the pixel data from the changing point table of a single line. Table 2-3. API Library * Function name Function Description mr_encode() MH/MR/MMR encoding Performs encoding of specified number of lines starting from image data. mr_decode() MH/MR/MMR decoding Performs decoding of specified number of lines starting from encoded data. 41 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL Figures 2-1 and 2-2 show the encoding/decoding processing flow of single line in the MH encoding and MR encoding methods. Figures 2-3 and 2-4 show the flow of encoding/decoding processing when the API library is used. Figure 2-1. Encoding a Single Line Start EOL transmission (mr_albit() ) Output Transmission buffer Sends EOL and a tag bit Changing point table creation (mr_coltrp() ) Input Creates a changing point table of a single line Output MH/MR encoding (mr_mhenc() /mr_mrenc() ) Input Converts the data of the line into MH/MR codes and store the data in the transmission buffer Output Fill bit transmission (mr_albit() ) Output End 42 Pixel data buffer Changing point table Changing point table Transmission buffer Transmission buffer CHAPTER 2 SPECIFICATIONS OF LIBRARIES Figure 2-2. Decoding a Single Line Start EOL detection (mr_scheol() ) Input Reception buffer Detects EOL (000000000001) One-bit detection (mr_getbit() ) Input Reception buffer Detects a tag bit (one bit) MH/MR decoding (mr_mhdec() /mr_mrdec() ) Decodes the data of a line in the MH/MR method and create a changing point table Pixel data creation (mr_cnvtrp() ) Creates the pixel data of the line Input Output Input Output Reception buffer Changing point table Changing point table Print buffer End 43 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL * Figure 2-3. Encoding of Specified Number of Lines (when API library is used) Start MH/MR encoding (mr_encode() Performs MH/MR encoding of specified number of lines and stores result to transmission buffer Input I/O Output Image data buffer Changing point table Transmission buffer End * Figure 2-4. Decoding of Specified Number of Lines (when API library is used) Start MH/MR decoding (mr_decode() Performs MH/MR decoding of specified number of lines and stores result to print buffer End 44 Input I/O Output Reseption buffer Changing point table Print buffer CHAPTER 2 SPECIFICATIONS OF LIBRARIES 2.1.2 Pixel Data and Code Data * (1) Storing data Image data and encoded data are stored as follows: Bit order : LSB-first (A byte is sequentially stored starting from the LSB.) Byte order: Little endian (Data is sequentially stored starting from that with the lowest address.) Example Storing data Address Bit MSB LSB 7 6 5 4 3 2 1 0 0H 8 7 6 5 4 3 2 1 1H 16 15 14 13 12 11 10 9 2H 24 23 22 21 20 19 18 17 3H 32 31 30 29 28 27 26 25 First data (2) Buffer address and remaining buffer size As a pixel data buffer address, enter a word-aligned value. If the number of pixels of the line to be encoded is other than a multiple of 32, place the first pixel data for the line in a word-aligned position. * Example Single line consisting of 48 pixels Word (32 bits) 1 line : 8-bit pixel data : Negligible 8-bit data (Need not be cleared to zero) Word boundary (3) Expansion mode For encoding, an expansion make-up code and double make-up are supported (2,560 x 2 + 63 = 5,183 bits, maximum). No limitations are imposed on decoding. (4) Non-compression mode Non-compression mode is not supported. Any attempt to select this mode is regarded as an error. 45 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL (5) Code data of less than 32 bits The compression and expansion systems process code data consisting of fewer than 32 bits differently. The processing methods employed by the compression and expansion systems are explained below: (a) Compression system In this library, code data of less than 32 bits, or code data overflow data of more than 32 bits, is retained in the LSB of the odd code data during processing (odd_data). Once this data plus the code data to be sent next total 32 bits, they are sent to the send buffer. The number of bits is retained as the number of bits of odd code data during processing (odd_bit). The figures below illustrate the relationship between the odd code data during processing (odd_data), the number of bits of odd code data during processing (odd_bit), and the send buffer for code data of less than 32 bits and that of 32 or more bits. Figure 2-5. When the Size of Odd Code Data during Processing Plus Send Code Data Is Smaller Than 32 Bits Odd code data during processing MSB LSB 00000000 Odd code data during processing MSB 00 LSB Send code data MSB 00000000000000000000000000 LSB : Number of bits of odd code data during processing : Number of bits of send code data Figure 2-6. When the Size of Odd Code Data during Processing Plus Send Code Data Is 32 Bits or More Odd code data during processing MSB 000000 Odd code data during processing LSB MSB LSB 0000000000000000 Send buffer Send code data MSB 0000000000 LSB MSB LSB : Number of bits of odd code data during processing : Number of bits of send code data 46 CHAPTER 2 SPECIFICATIONS OF LIBRARIES (b) Expansion system In this library, the 32-bit code data to be expanded is read from the receive buffer and retained in the LSB of the odd code data during processing (odd_data). The length of the decoded data is retained as the number of bits of odd code data during processing (odd_bit). Figure 2-7. Relationship between Odd Code Data during Processing and the Number of Data Bits Odd code data during processing MSB LSB : Number of bits of odd code data during processing (number of bits of decoded data) : Data not decoded yet 47 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL *2.2 SPECIFICATIONS OF FUNCTIONS (AP30100-B01 AP30100-B01) The specifications (C language descriptions) for calling each library are described below. Input/output parameters and internal information areas are defined using the structures below in a compression/expansion library. 2.2.1 Structures of AP30100-B01 AP30100-B01 (Parameters) This section lists the parameters (MREINFO, MRDINFO, MRAPIINFO) used by the MH/MR/MMR compression/ expansion functions. (1) Compression system Area : 58 bytes Parameter : MREINFO Member Type Description unsigned int Send code data unsigned char Number of bits of odd code data during processing send_bit unsigned char Number of bits of send code data pixel_num unsigned short Number of pixels of one line enc_buf_size unsigned int Remaining send buffer size *enc_buf unsigned int Send buffer address *pixel_buf unsigned int Pixel data buffer address *ref_tbl unsigned short Address of changing point table for reference line *run_tbl unsigned short Address of changing point table for scan line run_tbl_buf_size unsigned int Remaining changing point table buffer size restart_adr unsigned int Restart address/initialization flag bit_length unsigned short Remaining bit search length (dedicated to suspension processing) a0pos unsigned short a0 position (dedicated to suspension processing) a1pos unsigned short a1 position (dedicated to suspension processing) b0pos unsigned short b0 position (dedicated to suspension processing) b1pos unsigned short b1 position (dedicated to suspension processing) b2pos unsigned short b2 position (dedicated to suspension processing) exp_length unsigned short Remaining length of extended codes (dedicated to suspension processing) a0_color unsigned char Color (black or white) information (dedicated to suspension processing) bit_offset Internal areas Odd code data during processing odd_bit 48 unsigned int send_data I/O parameters odd_data unsigned char Offset within bit search word (dedicated to suspension processing) CHAPTER 2 SPECIFICATIONS OF LIBRARIES The members are described below: · odd_data Caution Handling differs between compression and expansion. Part of encoded data of less than 32 bits is stored as odd code data during processing, starting from the LSB. For details, see (5) in Section 2.1.2. The length of the code data is retained as the number of bits of odd code data during processing (odd_bit). Figure 2-8. Relationship between Odd Code Data during Processing and the Number of Data Bits in Compression Libraries (AP30100-B01 AP30100-B01) Odd code data during processing (odd_data) MSB 00000000 LSB 0 is set. : Number of bits of odd code data during processing (odd_bit) · send_data This member is set when the user sends code data such as EOL or FILL. The code data must be no more than 32 bits long. This member is combined with the odd code data during processing (odd_data). For details, see (5) in Section 2.1.2. · odd_bit This member indicates the number of bits of odd code data during processing (odd_data), that is, the number of data bits that have been coded. · send_bit This member indicates the number of data bits of send code data (send_data). · pixel_num This member indicates the number of pixels constituting a line. The maximum allowable number is 5,183. · enc_buf_size This member indicates the amount of free space remaining in the send buffer. When the odd code data during processing totals 32 bits and is written into the send buffer, this value decreases (by four). When this value reaches 0, processing is suspended. A word-aligned value should be entered for this member. 49 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · *enc_buf This member indicates a send buffer address. When the odd code data during processing totals 32 bits and is written into the send buffer, this value increases (by four). A word-aligned value should be entered for this member. · *pixel_buf This member indicates an image data address. When the 32-pixel data is compressed, this address increases (by four). A word-aligned value should be entered for this member. · *ref_tbl This member indicates the address of a changing point table for a reference line. A halfword-aligned value should be entered for this member. · *run_tbl This member indicates the address of a changing point table for a scan line. When the pixel data is converted into a run length, or for other processing, this address increases (by two). A halfword-aligned value should be entered for this member. · run_tbl_buf_size This member indicates the amount of free space remaining in the changing point table buffer. The value is decreased (by two) by mr_coltrp(). A halfword-aligned value should be specified as the size. When 0 is entered, 10000H 10000H is set. If this value reaches 0 while a single line is being processed, processing is suspended. · restart_adr This member indicates the restart address for library processing that is currently suspended. When processing terminates normally, 0 is returned. To ignore the suspension information and initialize the library processing, 0 should be set. · bit_length This member indicates a bit search length for the remaining pixel data for a single line when mr_coltrp() is suspended. · a0pos This member indicates the a0 position when mr_mhenc() or mr_mrenc() is suspended. · a1pos This member indicates the a1 position when mr_mrenc() is suspended. · b0pos This member indicates the b0 position when mr_mrenc() is suspended. 50 CHAPTER 2 SPECIFICATIONS OF LIBRARIES · b1pos This member indicates the b1 position when mr_mrenc() is suspended. · b2pos This member indicates the b2 position when mr_mrenc() is suspended. · exp_length This member indicates the remaining length of extended codes when mr_mhenc() or mr_mrenc() is suspended. · a0_color This member indicates the color (black or white) information for the a0 position when mr_mrenc() is suspended. (0H: White, FFH: Black) · bit_offset This member indicates an offset within the word subjected to pixel data bit search when mr_coltrp() is suspended. 51 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL (2) Expansion system Area : 60 bytes Parameter : MRDINFO Member Type Description Odd code data during processing unsigned int Odd pixel data during processing odd_bit unsigned char Number of bits of odd code data during processing pixel_bit unsigned char Number of bits of odd pixel data during processing pixel_num unsigned short Number of pixels of one line dec_buf_size unsigned int Remaining receive buffer size *dec_buf unsigned int Receive buffer address *print_buf unsigned int Print buffer address *ref_tbl unsigned short Address of changing point table for reference line *run_tbl unsigned short Address of changing point table for scan line run_tbl_buf_size unsigned int Remaining changing point table buffer size restart_adr unsigned int Restart address/initialization flag zero_cnt unsigned short 0-bit counter (dedicated to suspension processing) a0pos unsigned short a0 position (used upon suspension or abnormal code detection) b1pos unsigned short b1 position (used upon suspension or abnormal code detection) run_M_len unsigned short Make-up run-length (used upon suspension or abnormal code detection) run_pass_len unsigned short Run-length in pass mode (used upon suspension or abnormal code detection) chg_cnt unsigned short Number of changing point table elements in horizontal mode (used upon suspension or abnormal code detection) run_tbl_sadr unsigned int Start address of changing point table for scan line (dedicated to suspension processing) run0_flag unsigned short Run-length 0 detection flag (dedicated to suspension processing) a0_color unsigned char Color (black or white) information (used upon suspension or abnormal code detection) int_sts Internal areas unsigned int pixel_data I/O parameters odd_data unsigned char Suspension status (0: Receive buffer, 1: Changing point table) The members are detailed below: 52 CHAPTER 2 SPECIFICATIONS OF LIBRARIES · odd_data Caution Handling differs between compression and expansion. The 32-bit code data to be expanded is read from the receive buffer and retained as odd code data during processing (odd_data), starting from the LSB. The length of the expanded code data is retained as the number of bits of odd code data during processing (odd_bit). Figure 2-9. Relationship between Odd Code Data during Processing and the Number of Data Bits in Expansion Libraries (AP30100-B01 AP30100-B01) Odd code data during processing MSB LSB : Data not decoded yet : Number of bits of odd code data during processing (length of decoded data) · pixel_data This member retains expanded pixel data of less than 32 bits. · odd_bit This member indicates the number of bits of odd code data during processing (odd_data), that is, the number of bits of expanded data. · pixel_bit This member indicates the number of bits of pixel data in the odd pixel data during processing (pixel_data). · pixel_num This member indicates the number of pixels constituting a single line. · dec_buf_size This member indicates the amount of free space remaining in the receive buffer. Whenever code data is read from the receive buffer, this value decreases (by four). When this value reaches 0, or when the value reaches 4 while the number of bits of odd code data during processing is 12 or less, processing is suspended. (This is because the maximum length of a code is 13 bits.) A word-aligned value should be entered for this member. · *dec_buf This member indicates a receive buffer address. Whenever data is read to be held as odd code data during processing, this address increases (by four). A word-aligned value should be entered for this member. 53 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · *print_buf This member indicates an image data address. Whenever 32-pixel image data is expanded, this address increases (by four). A word-aligned value should be entered for this member. · *ref_tbl This member indicates the address of a changing point table for a reference line. A halfword-aligned value should be entered for this member. · *run_tbl This member indicates the address of a changing point table for a scan line. When code data is converted into a run length, or for other processing, this address increases (by two). A halfword-aligned value should be entered for this member. · run_tbl_buf_size This member indicates the amount of free space remaining in the changing point table buffer. mr_mhdec() or mr_mrdec() can reduce this size value (by two). A halfword-aligned value should be specified for the size. When 0 is entered, 10000H 10000H is set. If this member value reaches 0 while a single line is being processed, processing is suspended. · restart_adr This member indicates a restart address for suspended library processing. To initialize the processing, this member value should be set to 0. · zero_cnt If mr_scheol() is suspended, this member retains the number of corresponding zero EOL codes. A 32-bit register is used internally. For an input/output parameter, however, the 16 high-order bits are masked and the remaining bits are output. Nevertheless, the operation is guaranteed. · a0pos If mr_mhdec() or mr_mrdec() is suspended or detects an abnormal code, this member indicates the corresponding a0 position. · b1pos If mr_mrdec() is suspended or detects an abnormal code, this member indicates the corresponding b1 position. · run_M_len If mr_mhdec() or mr_mrdec() is suspended or detects an abnormal code after make-up code decoding, this member indicates the run length of the make-up codes. · run_pass_len If mr_mrdec() is suspended or detects an abnormal code after pass-mode decoding, this member indicates the run length of pass mode. 54 CHAPTER 2 SPECIFICATIONS OF LIBRARIES · chg_cnt If mr_mrdec() is suspended or detects an abnormal code during horizontal-mode decoding, this member indicates the number of elements in a changing point table in horizontal mode. · run_tbl_sadr If mr_mhdec() or mr_mrdec() is suspended, this member indicates the first address of the changing point table for a scan line. · run0_flag If mr_mhdec() or mr_mrdec() is suspended, this member acts as a run-length 0 detection flag for rebuilding a changing point table. (0: Without run-length 0 data, 1: With run-length 0 data) · a0_color If mr_mrdec() is suspended or detects an abnormal code, this member indicates the color (black or white) information for the a0 position. (0H: White, FFH: Black) · int_sts If mr_mhdec() or mr_mrdec() is suspended, this member indicates the reason for the suspension. 0: The receive buffer is full (dec_buf_size = 0 or (dec_buf_size = 4 and odd_bit < 13) 1: The changing point table buffer is full. (run_tbl_buf_size = 0) 55 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL (3) MRAPIINFO The MRAPIINFO structure stores the I/O parameters of the API library and is used together with the compression/expansion functions of the API library. Member Type Description unsigned int Number of lines on one page pixel_line unsigned int Number of lines processed line_cnt unsigned int Total number of lines counter *run_len_tbl unsigned short Changing point table first address reset unsigned char 1: Executes reset. method unsigned char Method (1: MH, 2: MR, 3: MMR) k_para unsigned char K parameter rtc_cnt unsigned char EOL counter of RTC fill_bit unsigned int Minimum number of transmitted bits restart_adr unsigned int Restart address mr_val [5] I/O parameters page_line unsigned int Variable save area (dedicated to suspension processing) The members are detailed below: · page_line This member indicates the number of lines on one page. This member is used only for compression. If the number of lines on one page is not known at the beginning of a page, set this member to FFFF FFFFH. This member can be re-set once the number of lines has been determined. If a value less than that of the total number of lines counter (line_cnt) is set to this member, the operation is not guaranteed. · pixel_line This member indicates the number of lines processed. When processing of the specified number of lines has been completed, this member outputs 0. If processing is suspended, the remaining number of lines is output. · line_cnt This is a counter that indicates the total number of lines that have been processed by the library. Refer to this counter if the number of lines is not known. This counter is cleared when reset = 1. 56 CHAPTER 2 SPECIFICATIONS OF LIBRARIES · *run_len_tbl This member indicates the first address of the changing point table. An area starting from this address and consisting of the minimum size is used as a changing point table. The size used differs depending on the method, as indicated below. Method Size of changing point table MH 1 line MR 2 lines MMR 2 lines Remark Size per line = (Number of pixels per line + 3) x 2 bytes · reset This member initializes the library. If the library is executed with reset = 1, the next member of the memory area is initialized. line_cnt, restart_adr:0 Changing point table for a reference line (in MMR method only): Changing point information on all white After reset, reset = 0. Be sure to execute reset at the beginning of a page. · method Indicates the encoding/decoding method of one page. The correspondence between the value of this parameter and the method selected is as shown below. This parameter cannot be changed during page processing. Value of method Method 1 MH 2 MR 3 MMR · k_para This member indicates the value of the K parameter while compression is in progress in the MR method. This parameter can be set to a value of 1 to 255. Generally, the K parameter is set to a value of 4. The operation is not guaranteed if this parameter is set to 0. 57 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · rtc_cnt This member indicates the count value of EOL/(EOL+1) that is appended or detected as RTC. · Compression processing Set the following value to rtc_cnt at the beginning of a page. Method Value of RTC Set value of rtc_cnt MH EOL x 6 6 MR (EOL + 1) x 6 6 MMR EOL x 2 2 Remark EOFB (End Of Facsimile Block) code is appended in the MMR method. RTC is appended at the end of a page. If this parameter is set to 0, RTC is not appended. If suspension occurs while RTC is appended, the remaining count value is output. Zero is output when the appending of RTC is completed. · Expansion processing The remaining count value is output if suspension occurs while RTC is detected. Zero is output when the detection of RTC is completed. · fill_bit This member indicates the minimum number of bits transmitted per line. This parameter is used only for compression. Fill bit(s) are appended if the number of bits of EOL + code per line is less than the minimum number of transmitted bits (fill_bit). This parameter is invalid for the MMR method. · restart_adr This member indicates restart if processing of each library is suspended. When restart_adr = 0, the beginning of the specified number of lines is assumed and processing is performed. This parameter is cleared if reset = 1. · mr_val [5] This member is used as a variable save area in the case of suspension. 58 CHAPTER 2 SPECIFICATIONS OF LIBRARIES 2.2.2 External Interface (AP30100-B01 AP30100-B01) (1) Data transmission · Category Compression system · Function name mr_albit() · Function overview This function outputs EOL, FILL, and other data of less than 32 bits to the send buffer. · Format #include "codec_vr.h" int mr_albit (MREINFO *mreinfo) 59 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · Argument MREINFO Member Type Description (io) Odd code data during processing unsigned int (i) odd_bit unsigned char (io) Number of bits of odd code data during processing send_bit unsigned char (i) pixel_num unsigned short (-) Number of pixels of one line enc_buf_size unsigned int (io) Remaining send buffer size *enc_buf unsigned int (io) Send buffer address *pixel_buf unsigned int (-) Pixel data buffer address *ref_tbl unsigned short (-) Address of changing point table for reference line *run_tbl unsigned short (-) Address of changing point table for scan line run_tbl_buf_size unsigned int (-) Remaining changing point table buffer size restart_adr unsigned int (-) Restart address/initialization flag bit_length unsigned short (-) Remaining bit search length (dedicated to suspension processing) a0pos unsigned short (-) a0 position (dedicated to suspension processing) a1pos unsigned short (-) a1 position (dedicated to suspension processing) b0pos unsigned short (-) b0 position (dedicated to suspension processing) b1pos unsigned short (-) b1 position (dedicated to suspension processing) b2pos unsigned short (-) b2 position (dedicated to suspension processing) exp_length unsigned short (-) Remaining length of extended codes (dedicated to suspension processing) a0_color unsigned char (-) Color (black or white) information (dedicated to suspension processing) bit_offset Internal areas unsigned int send_data I/O parameters odd_data unsigned char (-) Offset within bit search word (dedicated to suspension processing) Send code data Number of bits of send code data Remark i: Input, o: Output, io: Input/output, -: Not used · Return value Return value Description 00 01 60 Normal termination Suspension CHAPTER 2 SPECIFICATIONS OF LIBRARIES · Function This function outputs EOL, FILL, and other data of less than 32 bits to the send buffer. Once the send buffer is full, the function is suspended. For details of the odd code data during processing, see (5) in Section 2.1.2. Caution Executing this library while the amount of free space remaining in the send buffer is 0H may produce unpredictable results. When executing the library, enter a value of at least 4H in advance. (For details of the values that can be input, see the description of enc_buf_size in Section 2.2.1 (1).) (2) Changing point table creation · Category Compression system · Function name mr_coltrp() · Function overview This function creates a changing point table for one line of pixel data in a specified memory area. · Format #include "codec_vr.h" int mr_coltrp (MREINFO *mreinfo) 61 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · Argument MREINFO Member Type Description (-) Odd code data during processing unsigned int (-) Send code data odd_bit unsigned char (-) Number of bits of odd code data during processing send_bit unsigned char (-) Number of bits of send code data pixel_num unsigned short (i) enc_buf_size unsigned int (-) Remaining send buffer size *enc_buf unsigned int (-) Send buffer address *pixel_buf unsigned int (io) Pixel data buffer address *ref_tbl unsigned short (-) Address of changing point table for reference line *run_tbl unsigned short (io) Address of changing point table for scan line run_tbl_buf_size unsigned int (io) Remaining changing point table buffer size restart_adr unsigned int (io) Restart address/initialization flag bit_length unsigned short (io) Remaining bit search length (dedicated to suspension processing) a0pos unsigned short (-) a0 position (dedicated to suspension processing) a1pos unsigned short (-) a1 position (dedicated to suspension processing) b0pos unsigned short (-) b0 position (dedicated to suspension processing) b1pos unsigned short (-) b1 position (dedicated to suspension processing) b2pos unsigned short (-) b2 position (dedicated to suspension processing) exp_length unsigned short (-) Remaining length of extended codes (dedicated to suspension processing) a0_color unsigned char (-) Color (black or white) information (dedicated to suspension processing) bit_offset Internal areas unsigned int send_data I/O parameters odd_data unsigned char (io) Offset within bit search word (dedicated to suspension processing) Number of pixels of one line Remark i: Input, o: Output, io: Input/output, -: Not used · Return value Return value Description 00 01 62 Normal termination Suspension (changing point table size overflow) CHAPTER 2 SPECIFICATIONS OF LIBRARIES · Function This function creates a changing point table for one line of pixel data in a specified memory area in encode processing. This function is suspended when the remaining changing point table size becomes 0 in processing of one line. A halfword-aligned value is needed to specify a changing point table size. When 0 is entered in the changing point table size parameter, 10000H 10000H is set. In a changing point table, white and blank run-lengths are alternately stored, starting with a white runlength; two bytes is assigned to each run-length. In the last two-byte area of a changing point table, FFFFH is stored as terminator information. In initialization, set 0 in the restart address/initialization flag parameter. Processing cannot be restarted after it has been suspended. In this case, this function must be re-set from the beginning of the line. The format of the changing point table is shown below. Figure 2-10. Format of Changing Point Table (AP30100-B01 AP30100-B01) (Pixel data) ··· mr_coltrp() processing (Changing point table) White Black White Black White Black White Black 0 4 1 1 5 3 2 2 bytes 1 ··· FFFFH 2 bytes To prevent this function from being suspended in processing of one line, allocate a changing point table area as large as (number of pixels of one line + 3) multiplied by 2 bytes in memory. (3) MH encoding · Category Compression system · Function name mr_mhenc() · Function overview This function reads the changing point information (changing point table) of the pixel data constituting one line (scan line), performs MH encoding for that line, then sends the encoded data to a specified memory area (send buffer). · Format #include "codec_vr.h" int mr_mhenc (MREINFO *mreinfo) 63 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · Argument MREINFO Member Type Description (io) Odd code data during processing unsigned int (-) Send code data odd_bit unsigned char (io) Number of bits of odd code data during processing send_bit unsigned char (-) Number of bits of send code data pixel_num unsigned short (i) enc_buf_size unsigned int (io) Remaining send buffer size *enc_buf unsigned int (io) Send buffer address *pixel_buf unsigned int (-) Pixel data buffer address *ref_tbl unsigned short (-) Address of changing point table for reference line *run_tbl unsigned short (io) Address of changing point table for scan line run_tbl_buf_size unsigned int (-) Remaining changing point table buffer size restart_adr unsigned int (io) Restart address/initialization flag bit_length unsigned short (-) Remaining bit search length (dedicated to suspension processing) a0pos unsigned short (io) a0 position (dedicated to suspension processing) a1pos unsigned short (-) a1 position (dedicated to suspension processing) b0pos unsigned short (-) b0 position (dedicated to suspension processing) b1pos unsigned short (-) b1 position (dedicated to suspension processing) b2pos unsigned short (-) b2 position (dedicated to suspension processing) exp_length unsigned char (io) Remaining length of extended codes (dedicated to suspension processing) a0_color unsigned char (-) Color (black or white) information (dedicated to suspension processing) bit_offset Internal areas unsigned int send_data I/O parameters odd_data unsigned char (-) Offset within bit search word (dedicated to suspension processing) Number of pixels of one line Remark i: Input, o: Output, io: Input/output, -: Not used · Return value Return value Description 00 01 Suspension 02 FFFFH was detected after changing point information shorter than the number of pixels of one line. 03 64 Normal termination There is changing point information to be encoded not less than the number of pixels of one line. CHAPTER 2 SPECIFICATIONS OF LIBRARIES · Function This function reads the changing point information (changing point table) of pixel data for one line (scan line) and performs MH encoding for the line, then sends the encoded data to a specified memory area (send buffer). The encoding of one line ends when the terminator (FFFFH) of the changing point table is detected. This function is suspended when the remaining send buffer size becomes 0 in processing of one line. In initialization, set 0 in the restart address/initialization flag parameter. Caution Executing this library while the amount of free space remaining in the send buffer is 0H may produce unpredictable results. When executing the library, enter a value of at least 4H in advance. (For details of the values that can be input, see the description of enc_buf_size in Section 2.2.1 (1).) (4) MR encoding · Category Compression system · Function name mr_mrenc() · Function overview This function reads the changing point information (changing point table) of reference lines/scan lines, performs MR encoding for one line, then sends the encoded data to a specified memory area (send buffer). · Format #include "codec_vr.h" int mr_mrenc (MREINFO *mreinfo) 65 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · Argument MREINFO Member Type Description (io) Odd code data during processing unsigned int (-) Send code data odd_bit unsigned char (io) Number of bits of odd code data during processing send_bit unsigned char (-) Number of bits of send code data pixel_num unsigned short (i) enc_buf_size unsigned int (io) Remaining send buffer size *enc_buf unsigned int (io) Send buffer address *pixel_buf unsigned int (-) Pixel data buffer address *ref_tbl unsigned short (io) Address of changing point table for reference line *run_tbl unsigned short (io) Address of changing point table for scan line run_tbl_buf_size unsigned int (-) Remaining changing point table buffer size restart_adr unsigned int (io) Restart address/initialization flag bit_length unsigned short (-) Remaining bit search length (dedicated to suspension processing) a0pos unsigned short (io) a0 position (dedicated to suspension processing) a1pos unsigned short (io) a1 position (dedicated to suspension processing) b0pos unsigned short (io) b0 position (dedicated to suspension processing) b1pos unsigned short (io) b1 position (dedicated to suspension processing) b2pos unsigned short (io) b2 position (dedicated to suspension processing) exp_length unsigned short (io) Remaining length of extended codes (dedicated to suspension processing) a0_color unsigned char (io) Color (black or white) information (dedicated to suspension processing) bit_offset Internal areas unsigned int send_data I/O parameters odd_data unsigned char (-) Offset within bit search word (dedicated to suspension processing) Number of pixels of one line Remark i: Input, o: Output, io: Input/output, -: Not used · Return value Return value Description 00 01 Suspension 02 FFFFH was detected after changing point information shorter than the number of pixels of one line. 03 66 Normal termination There is changing point information to be encoded not less than the number of pixels of one line. CHAPTER 2 SPECIFICATIONS OF LIBRARIES · Function This function reads the changing point information (changing point table) of reference lines/scan lines and performs MR encoding for one line, then sends the encoded data to a specified memory area (send buffer). The encoding of one line ends when the terminator (FFFFH) of the changing point table for scan lines is detected. This function is suspended when the remaining send buffer size becomes 0 in processing of one line. In initialization, set 0 in the restart address/initialization flag parameter. Caution Executing this library while the amount of free space remaining in the send buffer is 0H may produce unpredictable results. When executing the library, enter a value of at least 4H in advance. (For details of the values that can be input, see the description of enc_buf_size in Section 2.2.1 (1).) (5) EOL detection · Category Expansion system · Function name mr_scheol() · Function overview This function detects an EOL in a specified memory (receive buffer) location. · Format #include "codec_vr.h" int mr_scheol (MRDINFO *mrdinfo) 67 µSAP30100-B01 SAP30100-B01, µSAP703000-B01 SAP703000-B01, µSAP705100-B01 SAP705100-B01, µSAP70732-B01 SAP70732-B01 USER'S MANUAL · Argument MRDINFO Member Type Description (io) Odd code data during processing unsigned int (-) Odd pixel data during processing odd_bit unsigned char (io) Number of bits of odd code data during processing pixel_bit unsigned char (-) Number of bits of odd pixel data during processing pixel_num unsigned short (-) Number of pixels of one line dec_buf_size unsigned int (io) Remaining receive buffer size *dec_buf unsigned int (io) Receive buffer address *print_buf unsigned int (-) Print buffer address *ref_tbl unsigned short (-) Address of changing point table for reference line *run_tbl unsigned short (-) Address of changing point table for scan line run_tbl_buf_size unsigned int (-) Remaining changing point table buffer size restart_adr unsigned int (io) Restart address/initialization flag zero_cnt unsigned short (io) 0-bit counter (dedicated to suspension processing) a0pos unsigned short (-) a0 position (used upon suspension or abnormal code detection) b1pos unsigned short (-) b1 position (used upon suspension or abnormal code detection) run_M_len unsigned short (-) Make-up run-length (used upon suspension or abnormal code detection) run_pass_len unsigned short (-) Run-length in pass mode (used upon suspension or abnormal code detection) chg_cnt unsigned short (-) Number of changing point table elements in horizontal mode (used upon suspension or abnormal code detection) run_tbl_sadr unsigned int (-) Start address of changing point table for scan line (dedicated to suspension processing) run0_flag unsigned short (-) Run-length 0 detection flag (dedicated to suspension processing) a0_color unsigned char (-) Color (black or white) information (used upon suspension or abnormal code detection) int_sts Internal areas unsigned int pixel_data I/O parameters odd_data unsigned char (-) Suspension status (0: Receive buffer, 1: Changing point table) Remark i: Input, o: Output, io: Input/output, -: Not used 68 CHAPTER 2 SPECIFICATIONS OF LIBRARIES · Return value Return value Description 01 Suspension 04 An EOL was detected at the start (normal termination). 05 An EOL with FILL was detected at the start (normal termination). 12 An EOL was detected after a code other than EOL was detected. · Function In decoding, this function detects an EOL in a specified memory (receive buffer) location. This function is suspended when no EOL is detected in a specified receive buffer. In initialization, set 0 in the restart address/initialization flag parameter. This function is suspended when the remaining receive buffer size becomes 0, or when it becomes 4 and the number of bits of odd code data during processing is less than 13 (because the maximum code length is 13 bits). Cautions 1. This function is also suspended if an EOL code is detected when the remaining receive buffer size is 4H, and the number of bits of odd code data during processing is less than 13. 2. The 0-bit counter internally uses a 32-bit register,