[FFmpeg-devel] Export display matrix mirroring info as part of the rotate API

Vittorio Giovara vittorio.giovara at gmail.com
Fri May 17 05:38:13 EEST 2019


On Thu, May 16, 2019 at 9:32 PM Jun Li <junli1026 at gmail.com> wrote:

> On Thu, May 16, 2019 at 4:34 PM Ted Meyer <
> tmathmeyer-at-google.com at ffmpeg.org> wrote:
>
> > Right now ffmpeg doesn't export a mirroring status when checking the
> > display matrix for rotation.
> > Here is an example video: https://files.tedm.io/flip.mp4
> > -Ted
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
>
> There is a patch but not merged into master, quality not guaranteed :)
> Hope this helps.
> https://patchwork.ffmpeg.org/patch/13130/
>

hey i just noticed this patch

+    if (CONV_FP(m[0]) * CONV_FP(m[4]) < CONV_FP(m[1]) *
CONV_FP(m[3])) {+        *hflip = 1;+        av_display_matrix_flip(m,
1, 0);+    }

the long if is basically computing the determinant of the matrix, but you
only need the fact whether it's positive or negative, you can discard the
result so you can avoid converting to CONV_FP, and just cast to int64_t

+    return av_display_rotation_get(m);

don't you need to set vertical flip only if det < 0 and rot = 180?

beside that small point, this patch introduces an api that basically
supersedes the normal av_display_rotation_get(), and does many more things,
I'd be tempted to deprecate any other use, and what do you think? in that
case you could just call it av_display_rotation_get2() like is tradition

I can't find the other patches from the set to review, would you be able to
send an updated version?
thanks
-- 
Vittorio


More information about the ffmpeg-devel mailing list