presented by: mohamad hammam alsafrjalani

25
PRESENTED BY: MOHAMAD HAMMAM ALSAFRJALANI UFL ECE Dept. 3/31/2010 UFL ECE Dept 1 CACHE OPTIMIZATION FOR AN EMBEDDED MPEG- 4 VIDEO DECODER

Upload: dixie

Post on 23-Feb-2016

73 views

Category:

Documents


0 download

DESCRIPTION

Cache optimization for an embedded MPEG-4 video decoder. Presented by: Mohamad Hammam Alsafrjalani. UFL ECE Dept. Outline. Introduction Quick MPEG-4 Background Original design Optimized design Conclusion. Introduction. Video decoders are popular Streaming video and audio applications - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Presented by: Mohamad Hammam Alsafrjalani

PRESENTED BY:MOHAMAD HAMMAM ALSAFRJALANI

UFL ECE Dept.3/31/2010

UFL ECE Dept 1

CACHE OPTIMIZATION FOR AN EMBEDDED MPEG-4 VIDEO DECODER

Page 2: Presented by: Mohamad Hammam Alsafrjalani

2

Outline

UFL ECE Dept

Introduction Quick MPEG-4 Background Original design Optimized design Conclusion

3/31/2010

Page 3: Presented by: Mohamad Hammam Alsafrjalani

3

Introduction

3/31/2010UFL ECE Dept

Video decoders are popular Streaming video and audio applications Video surveillance

The predominant format is MPEG-4 MPEG-4 decoder specifications are narrow

Unlike the encoder, designer’s options are limited

Page 4: Presented by: Mohamad Hammam Alsafrjalani

4

The Challenge

UFL ECE Dept

The high data rate, large sizes, and distinctive memory access patterns of MPEG-4 exert a particular strain on cache

Miss rates are tolerable But they generate excess cache-memory

traffic Multimedia application suffer due cache

inefficiency The goal is optimizing the algorithm for a

better cache-SRAM, SRMA-subsystem interaction

3/31/2010

Page 5: Presented by: Mohamad Hammam Alsafrjalani

5

MPEG-4 Background

UFL ECE Dept

MPEG-4 achieves the compression of video data using two orthogonal lines

In the spatial domain, it extracts redundancies from each individual image, operating on a frame by frame basis

In the temporal domain, the algorithm operates between frames, taking advantage of visual content common to adjacent frames.

Each frame is broken down into 8 × 8 pixel image fragments known as blocks

3/31/2010

Page 6: Presented by: Mohamad Hammam Alsafrjalani

6

With spatial compression, each block is filtered through the discrete cosine transform and quantized, and then undergoes variable length coding

Temporal compression uses motion estimation, constructing frames from pieces of other frames translated as a group from their location in the source image

MPEG-4 Background

UFL ECE Dept

The most relevant for cacheperformanceknown as reference frames

3/31/2010

Page 7: Presented by: Mohamad Hammam Alsafrjalani

7

MPEG-4 Background

UFL ECE Dept

For MPEG-4 simple profile, the motion estimation and compensation are organized using two different types of frames. I (intra) frames contain a spatially compressed

image without motion-compensated elements. P (predicted) frames are built primarily of pixels

from the closest previous I or P frame. The ability to reference data in past frames

provides additional opportunities for compression, but introduces data dependencies

3/31/2010

Page 8: Presented by: Mohamad Hammam Alsafrjalani

8

The DM642

UFL ECE Dept

The DM642 is the first integrated media processor based on the C64x VLIW DSP core.

Optimized for video processing including both 8-way VLIW parallelism and packed data processing (SIMD) within each functional unit.

Key elements Two-level cache architecture Enhanced DMA (EDMA) controller 64-bit external memory interface Three 20-bit video ports Ethernet MAC

3/31/2010

Page 9: Presented by: Mohamad Hammam Alsafrjalani

9

Cache Architecture

UFL ECE Dept

two-wayset associative to account for multiple input sources

allows large amounts of data to be brought on chip.

regions of reference data for motion estimation can be retained on-chip across multiple blocks minimizing redundant external I/O.

3/31/2010

Page 10: Presented by: Mohamad Hammam Alsafrjalani

10

Decoder Architecture

UFL ECE Dept

3 parts Receive task, Decode task and Output task

DSP decodes and writes the video streams into the SDRAM through its cache hierarchy

The DSP reads the encoded data from and writes the decoded video into the SDRAM

Another EDMA-I/O transfers the decoded video from SDRAM to the display peripheral.

3/31/2010

Page 11: Presented by: Mohamad Hammam Alsafrjalani

11

Original Design

UFL ECE Dept

Parameters: size, associatively, levels Size

Size: 16k, 32k, 64k, etc Size performance . But very large size,

performance improvement is not so much The DM642, size L1 is 16k for instruction and 16 for

data. L2 size is 256k Associatively

Direct mapped -> 2-way, may performance by 50% The DM462 L1 instruction is direct mapped, and data

is 2-way

3/31/2010

Page 12: Presented by: Mohamad Hammam Alsafrjalani

12

Original Design

UFL ECE Dept

Levels: In general, addition of L2 decreases the bus

traffic and memory latency. The DM642 utilizes two-level cache

architecture, namely L1P, L1D and L2 cache

3/31/2010

Page 13: Presented by: Mohamad Hammam Alsafrjalani

13

Optimized Design

UFL ECE Dept

The optimal memory allocation method is based on the Cache-SRAM-SDRAM structure.

The SRAM is in the middle and it negotiates the unbalance of the cache and the SDRAM in speed and capacity, so it affects the system efficiency greatly.

SRAM is divided into three sections: Data exchanging section

two data buffers, solves the video data storage and exchanging problems

The core code and variables storage section Used to store the frequently called functions

Cache section For the other codes and data management

3/31/2010

Page 14: Presented by: Mohamad Hammam Alsafrjalani

14

More on the SRAM

UFL ECE Dept

Additionally, the code structure is properly modularized, the code fragments in teamwork are adjusted to be stored continuously, and the related data are stored together.

These actions increase the hit rate of the cache in the SRAM.

3/31/2010

Page 15: Presented by: Mohamad Hammam Alsafrjalani

15

Allocation of DES

UFL ECE Dept

Data exchange section must be large: The system decodes 8 ch CIF (Common

Intermediate Format) (352 × 288 pixels) Size of 8 ch’s is 8x352x288x1.5, additional space

needed for source code, etc.. Total needed, 2.85MB Much bigger than the 256k we have

The buffer must be also able to store the decoded video data reference frame data and the relevant structure variables of each GMBL (Group of

Macro Block Lines)3/31/2010

Page 16: Presented by: Mohamad Hammam Alsafrjalani

16

Decoding unit

UFL ECE Dept

The unit of MPEG-4 decoding is a 16 × 16 pixel fragment known as a macro block, covering the area of six 8× 8 blocks. Subsampling

Decoders take the GMBL the decoding unit Access to SDRAM is reduced since buffer is ale to

store the decoded video data In order to process multiple blocks at a time to

obtain optimal cache performance and EDMA bandwidth efficiency, a ping-pang data buffer, namely BUF1

and BUF2, is used to store the decoded data in turn.

3/31/2010

Page 17: Presented by: Mohamad Hammam Alsafrjalani

17

MPEG Decoder, Based on GMBL

UFL ECE Dept 3/31/2010

Page 18: Presented by: Mohamad Hammam Alsafrjalani

18

Allocation of code and cache settings

UFL ECE Dept

The method that utilizes SRAM to save video data is to solve the video data storage and exchanging problems.

Unless the data exchange can be realized in time, the performance of the decoder still may not be improved.

Therefore, it’s necessary to allocate parts of SRAM for storing the relevant variables of code and program.

Repeating operations is very common in MPEG-4 decoders => L1P must allocate space for frequent functions

Space is allocated to store cache settings (2 way, or 4 way)

3/31/2010

Page 19: Presented by: Mohamad Hammam Alsafrjalani

19

Proposed Modes

2/26/2010UFL ECE Dept

Mode 1, ALL SRAM of L2: All the spaces of On-Chip memory are

configured to SRAM that is used to store codes, data, and global variables

This mode is feasible because the direction of data streams is clear and the data exchange can be completed by scheduling EDMA.

Yet, it will consume a lot of time once DSP accesses external memory

Page 20: Presented by: Mohamad Hammam Alsafrjalani

20

Proposed Modes

2/26/2010UFL ECE Dept

Mode 2: Cache based memory mode The storage space of 83KB size SRAM is

divided into two parts with one of 64KB size for cache

The surplus is for saving codes and data which are in common use.

In this mode, the L2 cache is four-way set associative.

Page 21: Presented by: Mohamad Hammam Alsafrjalani

21

Proposed Modes

2/26/2010UFL ECE Dept

Mode 3: The storage space of 83KB size SRAM is

divided into two parts with one of 32KB size for cache

The surplus is for saving codes and data which are in common use.

In this way, the access to SDRAM is possibly completed in a high speed taking advantage of the cache

The L2 cache is two-way set associative.

Page 22: Presented by: Mohamad Hammam Alsafrjalani

22

Which mode is the best?

2/26/2010UFL ECE Dept

Compared with mode 1, both mode2 and 3 has a higher miss rates when CPU read block which could waste lots of time because of the impossibility of manual scheduler resulted from the invisible map program.

The miss rates decrease significantly as the associativity level is increased from 2- to 4-way

Page 23: Presented by: Mohamad Hammam Alsafrjalani

23

The winner

2/26/2010UFL ECE Dept

the second mode is finally the optimum one and is used in this paper which is called Cache-based memory mode

It separates the 64KB SRAM into L2 levels and surplus 19KB SRAM is used for store core codes and variables

Page 24: Presented by: Mohamad Hammam Alsafrjalani

24

Conclusion

2/26/2010UFL ECE Dept

Memory access has great influence on system performance

Cache-based memory allocation mode is proposed to optimally allocate the limited on–chip memory

of the DM642 processor Hardware characteristics Software characteristics of MPEG-4 video decoders

The obtained MPEG-4 decoders can simultaneously decode eight channels CIF video frames on DM642.

The experiment results show that MPEG-4 decoding performance can be improved by almost 25% compared to the no cache optimization, with the standard video streams.

Page 25: Presented by: Mohamad Hammam Alsafrjalani

25

Questions?

3/19/2010UFL ECE Dept