aboutsummaryrefslogtreecommitdiff
path: root/utils/src
diff options
context:
space:
mode:
authorsahara <keun-o.park@windriver.com>2010-01-25 20:59:55 +0900
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:03:35 -0700
commitbbee87861d9da348927f5d3214f63fde045c6bb6 (patch)
tree2d089db023f7838af8312722eb6fd9d60c5500be /utils/src
parent983ae58ba31d37e90bca2933ed67331021f7c775 (diff)
downloadwrs_omxil_core-bbee87861d9da348927f5d3214f63fde045c6bb6.tar.gz
get more exact frame size
Signed-off-by: sahara <keun-o.park@windriver.com>
Diffstat (limited to 'utils/src')
-rw-r--r--utils/src/h264_parser.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/utils/src/h264_parser.c b/utils/src/h264_parser.c
index e90da4a..e5f2748 100644
--- a/utils/src/h264_parser.c
+++ b/utils/src/h264_parser.c
@@ -534,11 +534,13 @@ static int _vui_parse(nal_stream *pstream, SPS *sps)
int nal_sps_parse(unsigned char *buffer, unsigned int len,
unsigned int *width, unsigned int *height,
+ unsigned int *stride, unsigned int *sliceheight,
unsigned int *framerate)
{
SPS sps;
VUI vui;
nal_stream nalst;
+ unsigned int crop_left, crop_right, crop_top, crop_bottom;
unsigned int val;
int status = H264_SPS_ERROR;
@@ -572,11 +574,39 @@ int nal_sps_parse(unsigned char *buffer, unsigned int len,
goto vui_error;
}
- /* calculate width, height, framerate */
+ /* calculate width, height, stride, sliceheight, framerate */
*width = (sps.pic_width_in_mbs_minus1 + 1) * 16;
*height = (sps.pic_height_in_map_units_minus1 + 1) * 16;
+ LOGV("%s: width = %d", __func__, *width);
+ LOGV("%s: height = %d", __func__, *height);
+
+ if (sps.frame_cropping_flag) {
+ crop_left = 2 * sps.frame_crop_left_offset;
+ crop_right = *width - (2 * sps.frame_crop_right_offset + 1);
+
+ if (sps.frame_mbs_only_flag) {
+ crop_top = 2 * sps.frame_crop_top_offset;
+ crop_bottom = *height - (2 * sps.frame_crop_bottom_offset + 1);
+ } else {
+ crop_top = 4 * sps.frame_crop_top_offset;
+ crop_bottom = *height - (4 * sps.frame_crop_bottom_offset + 1);
+ }
+ } else {
+ crop_bottom = *height - 1;
+ crop_right = *width - 1;
+ crop_top = crop_left = 0;
+ }
+ *width = crop_right - crop_left + 1;
+ *height = crop_bottom - crop_top + 1;
+
+ /* FIXME: same as frame width,height */
+ *stride = *width;
+ *sliceheight = *height;
+
LOGV("%s: frame width = %d", __func__, *width);
LOGV("%s: frame height = %d", __func__, *height);
+ LOGV("%s: stride = %d", __func__, *stride);
+ LOGV("%s: sliceheight = %d", __func__, *sliceheight);
/* FIXME: Generally framerate is in container header */
if (vui.fixed_frame_rate_flag) {