From: Bram R. <bra...@ph...> - 2006-06-26 09:57:35
|
Hi all, Frank van Heesch triggered a disussion on the use of the display aspect ratio in cpfspd and related tools. This email outlines a CPFSPD change proposal. Current situation Cpfspd supports two display aspect ratios: 4:3 and 16:9. These are both commonly used in current TV standards. For several reasons, current tools and files do not use the 16:9 values properly - the 4:3 default is almost always used. Consequently, almost every file is tagged as 4:3. Up till now, we did not really pay attention to the aspect ratio. Frank pointed out some good reasons to pay attention: - Frank is working on an application that needs to use the information - Wrong values are confusing Requirements - Appropriate defaults for aspect ration (so most tools will "automatically" set correct aspect ratio values). - Support for "square pixel" aspect ratio (since many pfspd files contain a graphics image) Boundary conditions - Minimal or no change in API. - Consistency with current API semantics. - No change in pfspd file format. The file format describes only a __display__ aspect ratio (or image aspect ratio). Hence, a "square pixel" aspect ratio is only valid for a certain image width/height and cannot be preserved automatically over scaling operations. Propsed solution Both PV and PP will NOT be adapted. Main focus of these tools is visulisation of the pixels. A deformation of the image aspect ratio is acceptable and clearly favourable over scaling (requiering filtering with two main disadvantages: original pixel values are lost and slowdown due to the extra calculations). cpfspd.h - Add P_AS_WH to pT_asp_rat. cpfspd_get.c / p_get_aspect_ratio() - Add P_AS_WH; use largest common divider from image width/height to check this value. cpfspd_mod.c / p_mod_aspect_ratio() - Add P_AS_WH; use largest common divider from image width/height to calculate this value. Note that this is only "square pixel" for the current width/height setting. cpfspd_hdr.c / p_set_header_values() internal function - Add P_AS_WH as parameter value; use largest common divider from image width/height to calculate this value. - Add P_UNKNOWN_ASPECT_RATIO to serve as "default" parameter value to enable automatic setting depending on pT_size values: P_4_3 for P_SD, P_CIF, P_QCIF P_16_9 for P_HDp, P_HDi cpfspd_hdr.c / p_set_stream_header_values() internal function As p_set_header_values(). cpfspd_hdr.c / p_create_header() - Pass P_UNKNOWN_ASPECT_RATIO (not P_4_3) to p_create_ext_header(). cpfspd_hdr.c / p_create_ext_header() - No code change, funcionality changed by underlaying p_set_header_values() / p_set_stream_header_values(). Non-cpfspd issues Cpfspd application/tools that change image size (scale, border, crop, trim) need to handle the aspect ratio explicitely. If input file has P_AS_WH then output must be explicitely set at P_AS_WH to retain the "square pixel" property. Your comments / suggestions / improvements are appreciated. Regards, Bram. PS: Frank, please subscribe to the relevant mailing list via https://sourceforge.net/mail/?group_id=137382 -- A.K. (Bram) Riemens Principal Scientist, DSP group, Philips Research Office: WO-p-94, Postbox WO02 High Tech Campus 36 (WO), 5656 AE Eindhoven, The Netherlands Tel: +31 40 27 43833, Fax: +31 40 27 44675 E-mail: bra...@ph... |