Design and optimization of PPT format engine for electronic paper reader


This article refers to the address: http://

PPT (Microsoft Office PowerPoint) is an office software for editing presentations developed by Microsoft Corporation. Compared with txt, chm, etc., the format has a larger amount of information and a more complicated structure, which results in higher hardware configuration requirements. However, the current embedded terminal configuration is low, so this article focuses on meeting the basic needs of people for mobile reading, and does not consider features such as video, audio and external objects. This parser is implemented in the open source environment based on the Linux operating system. Based on embedded multi-format parsing engine system architecture and intermediate format theory, it has the characteristics of platform independence and high efficiency.

1 System features

The parsing engine is compatible with many versions, including versions such as Microsoft PowerPoint 97-2003. The following describes the system features.

1 Does not depend on the graphics server. The parsing engine has its own dedicated vector graphics renderer. Does not depend on a specific underlying graphics server. For example, when the graphics server of our experimental system is changed from nanoX to Qt, the parsing engine does not need to be modified.

2 High efficiency. For a general format parser, the larger the sample file, the slower the open speed, and the parser can achieve file open speed regardless of file size.

3 platform independence. The parsing engine does not draw graphics and text directly on the display device. Instead, it draws various formatting elements on a memory area and then maps the memory data to the physical device. That is, the input is a file, and the output is a bitmap of the screen size.

4 Configuration is flexible. The modular design of the parsing engine is easy to port and crop. All data types are defined by macros, which are easy to configure according to the platform.

5 Support for handwritten annotations. The parser only does content extraction and display, does not support editing and saving, and supports handwritten annotations. The handwritten annotation does not change the original document, but a new xml description file.

6 Personalized interaction. The 16-channel and black-and-white brush of the electronic paper controller realizes the animation switching effect.

2 format analysis

2.1 Overall structure

Microsoft PowerPoint uses OLE2 to combine document storage. Similar to the file system structure, it consists of a container and a stream, and a tree structure. Various streams are stored independently for easy loading and fast save. As listed in Table 1, the PPT file includes the following five types of streaming data.

PowerPoint file structure

Table 1 PowerPoint file structure

The PPT storage format uses hexadecimal, small endian byte order, which is divided into several large data blocks and small data blocks. The sizes are 512 bytes and 64 bytes respectively. The first data block is the initial data block and is stored. Data block index table.

2.2 Image stream structure

The PPT contains 204 types of elements such as rectangles, picture frames, text boxes, lines, and ellipses, collectively referred to as Shape. Each Shape has a unique instance code corresponding to it.

The hierarchical structure of multimedia data is shown in Figure 1.

Container hierarchy

Figure 1 container hierarchy

Drawing GROUP is a combined graphics storage structure that contains a set of graphical objects. Drawing is a graphical storage structure, and Shape and Solver are two sets of graphical attribute metadata. The Blip Store is an inserted picture object. The Property Table is the default property sheet. Client Data is a set of metadata information, including coordinates, text and OLE data, and user-defined attribute tables.

The attribute item adopts the id-value structure, and the length of the custom attribute table is variable. The relative positions of the attributes are unchanged. Properties that appear in the custom property sheet override the default property.

Drawing is a set of rules that describe the graphical objects in a container, including alignment, rulers, and so on.

3 software design

This design is based on the embedded multi-format parsing engine system architecture. The parsing engine is the module responsible for parsing the source files and generating the data needed by the intermediate format.

The internal architecture of the parsing engine is shown in Figure 2.

Parsing engine architecture

Figure 2 parsing engine architecture

3.1 Parser

The parser is input stream data, and the output is structured data for each module. The PPT format records use the id-value structure, and the id and value occupy the specified number of bytes. The parser is responsible for identifying the record id and extracting the value.

3.2 Navigator

Responsible for transferring data from the file system into memory and converting the I/O stream into structured data, that is, using the DOM structure to describe the overall architecture of the file.

This module has a page navigation function. PPT uses OLE2 combined document storage. Containers and nodes only store coarse-grained index information. For pages that do not need to be displayed immediately, only the container nodes are stored, and they are not expanded temporarily. When the page needs to be displayed, it is expanded downward from the node, thereby reducing unnecessary File reading. This layered loading method increases the speed of opening, and for large documents, the speed of entry is only related to the complexity of the first page.

In addition, in order to better index, a series of linked list structures have been established. Such as: data block index table, root directory table, image data stream linked list, user reverse linked list, text chain, motherboard linked list, and so on.

Information such as file length, version number, and file legality is obtained by reading the initialization block. In addition to this, you need to initialize several important global linked lists.

1 data block index table. Files are stored in blocks and are not continuous. The block number and intra-block offset of the data can be easily addressed.

2 Build the root table, including the starting block number and size of the stored content, for addressing operations. The read operation is only in the current block range. When the current block readable length is exceeded, the block number of the next block is found by querying the block index table.

3 Build an image data stream list.

4 Build a user reverse linked list. For fast storage, PPT uses incremental storage, which means that each time you save, a copy of the page is directly generated and appended to the end of the document. The disadvantage of incremental storage is the large amount of redundancy. For example, some files have only a few pages, but the file size is a few megabytes or even tens of megabytes, and the actual size of the file is related to the number of modifications.

5 Slide text chain, stream information to layout metadata stored separately. Plain text is stored in the text stream, and storage and layout information is stored in the page data area. The page data area also stores the location of plain text in the text stream.

6 Motherboard linked list, the motherboard is generally used as a background, stored sequentially in units of pages. Because the electronic paper displays grayscale images, the background and text overlays are not clearly visible, and the user can remove the background without reading the file itself.

The basic idea of ​​incremental storage is that each modification generates a user information, stores the modified block number, and the current user information points back to the previous user information, thereby forming a user reverse chain. The last modification can be found by traversing the user's reverse chain. Redundant data can be discarded directly.

3.3 Layout Manager

Responsible for screen partitioning and layer management, the layout manager is divided into different rectangular areas and identifies the type of the area. Then map the parsed text, graphics, and image buffers to the screen bitmap.

3.4 word processor

The type and layout of the text in the PPT format is relatively complicated, and can be divided into two types: text and graphic embedded text. The layout of the title text at each level is also required. The word processor parses and layouts the variety of layout formats of various texts, and completely reproduces the layout information of the original document.

The word processing process is divided into two parts: pre-typesetting and page layout. The pre-typesetting is responsible for filling the font buffer, extracting the character encoding and font information as the input of FreeType, and filling the buffer with the generated single font bitmap. Then combine the ruler and map it to the page display buffer. The text parsing schematic is shown in Figure 3.

Text parsing schematic

Figure 3 text analysis schematic

3.5 graphics rendering

Responsible for graphic drawing and combined graphic coordinate space conversion. This parsing engine does not rely on the graphics server and has a dedicated vector graphics rendering library. Ability to draw graphics directly into the page bitmap, regardless of physical display.

The straight line, curve and polygon fill are respectively used by the classic Breshman algorithm, the cubic Bezier curve line algorithm and the column scan polygon filling algorithm. In order to improve the efficiency of the operation, the floating point number is rounded. It has been verified that better rendering results can be achieved on embedded systems with poor floating-point arithmetic efficiency.

The Drawing Group contains a set of graphic objects that use the Dom structure. The child node uses the coordinate space relative to the parent node. Therefore, graphics processing can recursively transform coordinates and draw the graphics in the coordinate space of their parent nodes.

3.6 Image rendering

The image renderer uses the Cximage image library to reconstruct the image data and further convert it into a grayscale image into the screen buffer.

The image and multimedia information in the file are stored in the image stream and described by FBSE (File Blip Store Entry). Then the structure is defined:

Typedef struct _FBSE{



ULONG size;


ULONG offsetInDelayStream;


4 Optimized speed

Users always want the system to be as fast as possible, but the embedded system is limited by the lower frequency and smaller memory. It is difficult to achieve the desired effect for some jobs with large calculations. Therefore, the parsing engine is applying an optimization strategy of a multi-page buffer mechanism and an asynchronous parallel mechanism.

Each renderer works asynchronously in parallel, and the first renderer that completes the task immediately submits the data to the screen display. The refresh rate of the whole screen of the electronic paper is 1 s. With this screen intermittent, the rest of the renderer completes the task, and then the partial refresh screen is used to refresh the incremental portion to the screen. This overall speed depends on which one is the slowest rendering speed. In addition, asynchronous execution does not block input. If the user flips the page at this time, the unfinished thread will be terminated and a new thread will be created to resolve the next page. For example, open a slide of a page of text and text, display the text first, then display the image, and will not block the user input, if the user stops after several pages in rapid succession, the intermediate page parsing will be terminated.

5 verification

The effect is achieved on an electronic paper reader with a frequency of 200 MHz as shown in Fig. 4.

Analyze renderings on an e-paper reader

Figure 4 Analysis of the effect diagram on the e-paper reader

Randomly select 60 sample files, the minimum time to enter the book is 2.82 s, the maximum length is 11.92 s. As shown in Figure 5.

Analyze speed statistics on an e-paper reader

Figure 5 Analyze speed statistics on an e-paper reader

The parsing engine uses a layered loading method to improve the speed of opening books. Here, three PPT documents with the same first page but large differences in size are selected. Experiments have shown that although the document sizes vary widely, the opening speeds are not much different. As listed in Table 2.

Start speed comparison

Table 2 Start speed comparison


Due to the characteristics of electronic paper and the resource limitations of embedded devices, this article only focuses on the analysis of common elements, such as text, graphics, images, tables, etc., but does not support embedded objects (such as video, audio, etc.). The analysis of unknown elements will be the main work of the future. The modular design architecture of this paper is conducive to the next step of function expansion. In addition, with the birth of the Office Open Document Format (OOXML) and becoming an international standard, an embedded parser supporting OOXML will be developed in the future.

How to use our Iphone 8 Plus 3D Viewer? You just need to put it on the front of your phone screens, then download"Mplayer3D"from  APP store.

About Mplayer3D

An application that transforms your smartphone into a 3D TV. Can be downloaded for free.Supports video streaming on .A video player which does not support offine content. Provides demo videos only in the download area ,Supported format: MP4. Does not support 2D to 3D conversion. You can use our Iphone 8 3D Viewer to watch 3D movies, 3D videos, and play 3D games everywhere you go, instead for carrying a heavy VR headset.

Iphone8 Plus 3d ViewerIphone8 Plus 3d ViewerIphone8 Plus 3d Viewer Iphone8 Plus 3d ViewerIphone8 Plus 3d ViewerIphone8 Plus 3d ViewerIphone 8 Plus 3D ViewerIphone8 Plus 3d Viewer CaseIphone8 Plus 3d Viewer Mplayer3d Snap3d

Iphone 8 Plus 3D Viewer

Iphone 8 Plus 3D Viewer,Iphone 8 Plus Vr Viewer,3D Viewer For Iphone 8 Plus,Vr Viewer For Iphone 8 Plus

iSID Korea Co., Ltd ,