Resources | Resources |



Media considerations

Tradeoffs between media formats

Modern user interfaces contain many graphical elements. The treatment of these graphical elements entails tradeoffs between image quality, cost of memory consumption, and speed. The performance cost of storing and processing graphical element data is typically proportional to the display resolution.

Static image data: Crushed JPEG vs PNG vs BMP formats

JPEG format is well-suited for images that are photographs, or for artistically generated images that are photograph-like, with many different colors and frequent color/contrast changes (in terms like lines per mm, or lines per number of pixels). Images of this type will compress poorly in PNG, resulting in a large file, since PNG is a lossless format and guarantees reproducing every detail precisely.

PNG format is better suited to graphic art images. They tend to contain relatively fewer colors and less fine detail, so the compression strategy used by PNG is well suited. JPEGs rely on the nature of the subject masking the artifacts of lossy compression. With simpler images, the JPEG artifacts tend to be quite noticeable.

A test to help determine whether to use JPEG or PNG for a given image is to compress the image as both a JPEG and a PNG. If the de-compressed JPEG looks acceptable and its file size is drastically smaller than the one compressed as a PNG, then it may be a good choice. JPEGs contain no support for alpha or transparency, so they are not good for images that are not opaque. Another format to consider is bitmaps (BMP). For small icons, they can be as small as PNGs and faster to load, since they do not require decoding.

To avoid video flickering

If the video only occupies a portion of the device screen, the general recommendation is either not to draw to the area where the video is drawing when in direct mode or to use frame callback mode. This is to avoid video flickering during the playback.

If IMedia is being used in direct mode and IMedia owns the portion of the display that the video is being drawn to, the app will not be allowed to update that portion. If the application needs to draw over the video region, frame callback mode should be used instead, which can be enabled as follows:

IMedia_EnableFrameCallback(pMe->m_pMedia, TRUE);

In the media callback function, the status MM_STATUS_FRAME will be sent each time a frame is available. At this point, the frame can be updated by the application and blitted to the display.