diff options
author | Andreas Huber <andih@google.com> | 2010-10-08 11:05:10 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-08 11:05:10 -0700 |
commit | c7e61d5e67a8218d33835a1b5ca0256b30699ae7 (patch) | |
tree | ea075851f690c181dcc312227aa317e40e5c5d2e /media | |
parent | 6a3bc8ca890fae9019c668c9f6262403f0769d44 (diff) | |
parent | e6d26450e5a01be5b7f1343578e7237e68db7737 (diff) | |
download | frameworks_av-c7e61d5e67a8218d33835a1b5ca0256b30699ae7.zip frameworks_av-c7e61d5e67a8218d33835a1b5ca0256b30699ae7.tar.gz frameworks_av-c7e61d5e67a8218d33835a1b5ca0256b30699ae7.tar.bz2 |
am b9bf5457: Merge "Respect the cropping rectangle when extracting the video dimensions from the sequence parameter set of H.264 streams." into gingerbread
Merge commit 'b9bf545774b1f1dbd35c34c4060a6ebdd2bc843c' into gingerbread-plus-aosp
* commit 'b9bf545774b1f1dbd35c34c4060a6ebdd2bc843c':
Respect the cropping rectangle when extracting the video dimensions from the sequence parameter set of H.264 streams.
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/avc_utils.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp index a8f1104..8762d29 100644 --- a/media/libstagefright/avc_utils.cpp +++ b/media/libstagefright/avc_utils.cpp @@ -41,10 +41,12 @@ void FindAVCDimensions( br.skipBits(16); parseUE(&br); // seq_parameter_set_id + unsigned chroma_format_idc = 1; // 4:2:0 chroma format + if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || profile_idc == 244 || profile_idc == 44 || profile_idc == 83 || profile_idc == 86) { - unsigned chroma_format_idc = parseUE(&br); + chroma_format_idc = parseUE(&br); if (chroma_format_idc == 3) { br.skipBits(1); // residual_colour_transform_flag } @@ -85,6 +87,41 @@ void FindAVCDimensions( *height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 * 16 + 16); + + if (!frame_mbs_only_flag) { + br.getBits(1); // mb_adaptive_frame_field_flag + } + + br.getBits(1); // direct_8x8_inference_flag + + if (br.getBits(1)) { // frame_cropping_flag + unsigned frame_crop_left_offset = parseUE(&br); + unsigned frame_crop_right_offset = parseUE(&br); + unsigned frame_crop_top_offset = parseUE(&br); + unsigned frame_crop_bottom_offset = parseUE(&br); + + unsigned cropUnitX, cropUnitY; + if (chroma_format_idc == 0 /* monochrome */) { + cropUnitX = 1; + cropUnitY = 2 - frame_mbs_only_flag; + } else { + unsigned subWidthC = (chroma_format_idc == 3) ? 1 : 2; + unsigned subHeightC = (chroma_format_idc == 1) ? 2 : 1; + + cropUnitX = subWidthC; + cropUnitY = subHeightC * (2 - frame_mbs_only_flag); + } + + LOGV("frame_crop = (%u, %u, %u, %u), cropUnitX = %u, cropUnitY = %u", + frame_crop_left_offset, frame_crop_right_offset, + frame_crop_top_offset, frame_crop_bottom_offset, + cropUnitX, cropUnitY); + + *width -= + (frame_crop_left_offset + frame_crop_right_offset) * cropUnitX; + *height -= + (frame_crop_top_offset + frame_crop_bottom_offset) * cropUnitY; + } } } // namespace android |