[vlc-devel] [PATCH] Automatically orient JPEG image based on orientation flag, if set

Wayne McDougall waynemcdougall at gmail.com
Sun Apr 17 12:37:42 CEST 2016


On 17 April 2016 at 17:44, Jean-Baptiste Kempf <jb at videolan.org> wrote:

> In what case don't we want it automatic, tbh?
>

There are several convertors that will reorient your JPEG files according
to the orientation tag
*but do not* reset that flag to normal orientation.
If I was given a batch of such converted files, I'd be very glad of an
advanced option to
make VLC behave the way it used to.


> I'm surprised we don't have the right function in vlc_common.h
> (GetWBE/GetWLE)
>

I suggest  the patch code is simpler.
We have 4 cases: the machine may be storing data big or little endian,
and the JPEG may be storing the EXIF headers as big or little endian.

I really don't think the vlc_common functions help because we can't
make any assumptions about the source byte order.

If you think I am wrong, please let me know.

> +    b_autoorient = var_CreateGetBool( p_dec, "jpeg-autoorient" );
>
> var_InheritBool
>

 Good catch. I was patterning after other code that I guess is
too old, eg line 202 in codec telx.c - written in 2007, which predates
var_InheritBool (from 2010).

>
>
Thank you for your close review. Any errors remain mine of course.

I am now working through Rémi's excellent (but terse) suggestion.

Curiously, I can find no reference to ORIENT_FROM_EXIF
And the numbers it returns do not helpfully map to the order of
transformations. I'm not sure if I'm expected to use the idea as a
template, or whether it should work. If Video and JPEG exif
orientation data is supposed to match, then maybe the current code
is just wrong. I'm continuing to study it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160417/ec754de6/attachment.html>


More information about the vlc-devel mailing list