[FFmpeg-devel] [PATCH]Write tiff aspect ratio by default instead of dpi

Michael Niedermayer michaelni at gmx.at
Thu Apr 3 05:29:09 CEST 2014


On Tue, Apr 01, 2014 at 12:15:25PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch changes the tiff encoder to write the sample 
> aspect ratio instead of the dpi by default, this is what other 
> FFmpeg image decoders do.
> Tested with xv.
> 
> Please comment, Carl Eugen

>  Changelog            |    1 +
>  libavcodec/tiffenc.c |   11 ++++++-----
>  libavcodec/version.h |    2 +-
>  tests/ref/lavf/tiff  |    2 +-
>  4 files changed, 9 insertions(+), 7 deletions(-)
> 7ddb87691a1e76e7300bdd8d2276a281e8fe6941  patchtiffsar.diff
> diff --git a/Changelog b/Changelog
> index 0e38ec8..9d40e53 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -13,6 +13,7 @@ version <next>:
>  - QTKit input device
>  - improvments to OpenEXR image decoder
>  - support decoding 16-bit RLE SGI images
> +- Write tiff aspect ratio instead of dpi by default
>  
>  
>  version 2.2:
> diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
> index 7b1e510..cccc4bc 100644
> --- a/libavcodec/tiffenc.c
> +++ b/libavcodec/tiffenc.c
> @@ -233,7 +233,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>      uint8_t *offset;
>      uint32_t strips;
>      int bytes_per_row;
> -    uint32_t res[2] = { s->dpi, 1 };    // image resolution (72/1)
> +    uint32_t resx[2] = { s->dpi ? s->dpi : avctx->sample_aspect_ratio.den, 1 };
> +    uint32_t resy[2] = { s->dpi ? s->dpi : avctx->sample_aspect_ratio.num, 1 };

i think this is wrong
shouldnt the dpi be adjusted when the aspect differs from 1:1
i mean 1:2 sample aspect would imply that there are twice as many
pixels in one direction thus dpi also being different for the two
axis

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140403/d8dbfdb0/attachment.asc>


More information about the ffmpeg-devel mailing list