S5pv210 multimedia reserved memory space 3-JPEG codec

Source: Internet
Author: User

JPEG codec is used for compresses original raw image and decompresses original JPEG image. This hardware circuit performs all the functions required for compression/Decompression: discrete cosine transformation, quantization, and Hoffmann encoding.

Encoding function:

Input raw image: Format: ycbcr4: 2: 2, rgb565

Output JPEG file: Baseline JPEG, Color Space: ycbcr4: 2: 2 or ycbcr4: 2: 0

The progressive mode is not supported.

Decoding function:

Input JPEG file: Baseline JPEG, Color Space: ycbcr4: 4: 4, ycbcr4: 2: 2, ycbcr4: 2: 0, gray

Output raw image: ycbcr4: 2: 2, ycbcr4: 2: 0

The progressive mode is not supported.

Reserved memory space defined in arch/ARM/mach-s5pv210/mach-smdkc110.c

#define  S5PV210_VIDEO_SAMSUNG_MEMSIZE_JPEG (8192 * SZ_1K)

The jpec codec driver of s5pv210 is under Drivers/Media/Video/Samsung/jpeg_v2/. The jepg codec driver uses the reserved memory to store the input and output images of codec, JPEG codec supports simultaneous encoding and decoding of original images and thumbnail. Therefore, the reserved memory space must meet the memory requirements of main frame, thumbnail frame, main stream, and thumbnail stream.

394     s3c_jpeg_limits.max_main_width      = pdata->max_main_width;395     s3c_jpeg_limits.max_main_height     = pdata->max_main_height;396     s3c_jpeg_limits.max_thumb_width     = pdata->max_thumb_width;397     s3c_jpeg_limits.max_thumb_height    = pdata->max_thumb_height;398 399     main_pixels = s3c_jpeg_limits.max_main_width *400         s3c_jpeg_limits.max_main_height;401     thumb_pixels = s3c_jpeg_limits.max_thumb_width *402         s3c_jpeg_limits.max_thumb_height;403 404     s3c_jpeg_bufinfo.main_stream_size = ALIGN(main_pixels, PAGE_SIZE);405     /* Assuming JPEG V2 uses YCBCR422 output format */406     s3c_jpeg_bufinfo.main_frame_size = ALIGN(main_pixels * 2, PAGE_SIZE);407 408     s3c_jpeg_bufinfo.thumb_stream_size = ALIGN(thumb_pixels, PAGE_SIZE);409     s3c_jpeg_bufinfo.thumb_frame_size = ALIGN(thumb_pixels * 2, PAGE_SIZE);410 411     s3c_jpeg_bufinfo.total_buf_size = s3c_jpeg_bufinfo.main_stream_size +412         s3c_jpeg_bufinfo.thumb_stream_size +413         s3c_jpeg_bufinfo.main_frame_size +414         s3c_jpeg_bufinfo.thumb_frame_size;

From the above code, we can get the following formula for calculating the reserved memory:

Reserved mem size = main_stream_size + thumb_stream_size + main_frame_size + thumb_frame_size

= Align (main_pixels, page_size) + align (main_pixels * 2, page_size) + align (thumb_pixels, page_size) + align (thumb_pixels * 2, page_size)

= Align (pdata-> max_main_width * pdata-> max_main_height, page_size) + align (pdata-> max_main_width * pdata-> max_main_height * 2, page_size)

+ Align (pdata-> max_thumb_width * pdata-> max_thumb_height, page_size) + align (pdata-> max_thumb_width * pdata-> max_thumb_height * 2, page_size)

Pdata-> max_thumb_width, pdata-> max_thumb_height, pdata-> max_main_width, pdata-> the definition of max_main_height is project-related and is the original image width that the system needs to codec, height and the width and height of the thumbnail image.

Defined in arch/ARM/mach-s5pv210/mach-smdkc110.c

#ifdef CONFIG_VIDEO_JPEG_V2static struct s3c_platform_jpeg jpeg_plat __initdata = {    .max_main_width = 800,    .max_main_height    = 480,    .max_thumb_width    = 320,    .max_thumb_height   = 240,};#endif

Therefore, the size of the JPEG codec reserved memory can be obtained.

Align (800*480, page_size) + align (800*480*2, page_size) + align (320*240, page_size) + align (320*240*2, page_size) = 1352kb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.