diff options
author | Lajos Molnar <lajos@google.com> | 2014-08-21 14:08:29 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2014-08-21 16:24:27 -0700 |
commit | 6ac9da6b181828b88ef2403d8d5ff0a79c173a24 (patch) | |
tree | 5a454972e2ae070611c392130976922362085aea /media | |
parent | c54a76cbcd1e4bc7f27de2010c1c1fd4ed6f845a (diff) | |
download | frameworks_base-6ac9da6b181828b88ef2403d8d5ff0a79c173a24.zip frameworks_base-6ac9da6b181828b88ef2403d8d5ff0a79c173a24.tar.gz frameworks_base-6ac9da6b181828b88ef2403d8d5ff0a79c173a24.tar.bz2 |
MediaCodeInfo: fix support for feature-can-swap-width-height
Also fix an issue with limiting size based on number of
blocks allowed.
Bug: 11990740
Change-Id: I3b01be4031dce6b425e8573da5de527ba2a0995c
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/MediaCodecInfo.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index ae2d024..acb2186 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -959,6 +959,23 @@ public final class MediaCodecInfo { } } } + // for now this just means using the smaller max size as 2nd + // upper limit. + // for now we are keeping the profile specific "width/height + // in macroblocks" limits. + if (Integer.valueOf(1).equals(map.get("feature-can-swap-width-height"))) { + if (widths != null) { + mSmallerDimensionUpperLimit = + Math.min(widths.getUpper(), heights.getUpper()); + widths = heights = widths.extend(heights); + } else { + Log.w(TAG, "feature can-swap-width-height is best used with size-range"); + mSmallerDimensionUpperLimit = + Math.min(mWidthRange.getUpper(), mHeightRange.getUpper()); + mWidthRange = mHeightRange = mWidthRange.extend(mHeightRange); + } + } + ratios = Utils.parseRationalRange( map.get("block-aspect-ratio-range"), null); blockRatios = Utils.parseRationalRange( @@ -1124,9 +1141,17 @@ public final class MediaCodecInfo { private void updateLimits() { // pixels -> blocks <- counts mHorizontalBlockRange = mHorizontalBlockRange.intersect( - Utils.factorRange(mWidthRange, mBlockWidth)).intersect(mBlockCountRange); + Utils.factorRange(mWidthRange, mBlockWidth)); + mHorizontalBlockRange = mHorizontalBlockRange.intersect( + Range.create( + mBlockCountRange.getLower() / mVerticalBlockRange.getUpper(), + mBlockCountRange.getUpper() / mVerticalBlockRange.getLower())); mVerticalBlockRange = mVerticalBlockRange.intersect( - Utils.factorRange(mHeightRange, mBlockHeight)).intersect(mBlockCountRange); + Utils.factorRange(mHeightRange, mBlockHeight)); + mVerticalBlockRange = mVerticalBlockRange.intersect( + Range.create( + mBlockCountRange.getLower() / mHorizontalBlockRange.getUpper(), + mBlockCountRange.getUpper() / mHorizontalBlockRange.getLower())); mBlockCountRange = mBlockCountRange.intersect( Range.create( mHorizontalBlockRange.getLower() |