Fix bad pixel w:h ratio calculation in H262 reader.

It appears the spec calculation gives the h:w pixel ratio, where-as
we want w:h. It's pretty easy to convince oneself that this way round
is correct. Consider a video that's 100px by 100px, and setting
aspectRatioCode=3 to achieve this. The pixelWidthHeightRatio needs to
be 16/9 and not 9/16 :).

Issue: #965
This commit is contained in:
Oliver Woodman 2015-11-25 16:42:12 +00:00
parent 18ae955fea
commit b8e7e1077e

View file

@ -148,13 +148,13 @@ import java.util.Collections;
int aspectRatioCode = (csdData[7] & 0xF0) >> 4;
switch(aspectRatioCode) {
case 2:
pixelWidthHeightRatio = (3 * width) / (float) (4 * height);
pixelWidthHeightRatio = (4 * height) / (float) (3 * width);
break;
case 3:
pixelWidthHeightRatio = (9 * width) / (float) (16 * height);
pixelWidthHeightRatio = (16 * height) / (float) (9 * width);
break;
case 4:
pixelWidthHeightRatio = (100 * width) / (float) (121 * height);
pixelWidthHeightRatio = (121 * height) / (float) (100 * width);
break;
default:
// Do nothing.