mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
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:
parent
18ae955fea
commit
b8e7e1077e
1 changed files with 3 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue