#11284: Aspect ratio defined by the JFIF segment APP0 is misinterpreted as its
reciprocal
---------------------------------+--------------------------------------
             Reporter:  goodbye  |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  avcodec  |                  Version:  git-master
             Keywords:  mjpeg    |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+--------------------------------------
 The JFIF APP0 segment describes the resolution/pixel density of an image,
 which can be in abstract units (in which case it only defines the pixel
 aspect ratio), in pixels per inch, or in pixels per centimetre.  See for
 example [https://www.ecma-international.org/wp-content/uploads/ECMA_TR-
 98_1st_edition_june_2009.pdf ECMA TR/98 1st Ed. §6.4 and §10].

 FFmpeg interprets the X:Y resolution ratio directly as a X:Y PAR, but in
 actuality, it’s the reciprocal. This is because the resolution is
 specified as a “pixels per unit” value and not “units per pixel”, as is
 typically the case with PARs. The X:Y PAR is equal to the Y:X ratio of
 resolutions specified in the segment.

 The attached image is supposed to have a DAR of 1:1, but FFmpeg
 misinterprets it to have a DAR of 4:1.

 The issue has been present from the very beginning, since aspect ratio
 decoding was re-enabled in commit 5ff85f1d8b5721a9e7f0ca6e03f61f5d3a4c3664
 (libavcodec/mjpeg.c lines 384–385; now libavcodec/mjpegenc.c lines+
 1904–1905).  In fact, it has never worked very well – previous code seemed
 to misinterpret the density ratio as the DAR.

 The MJPEG encoder has the complementary problem of writing the reciprocal
 ratio into the APP0 segment (libavcodec/mjpegenc_common.c lines 189–190)
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11284>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to