diff options
author | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2015-04-17 15:03:34 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-04-30 21:46:31 +0200 |
commit | af7ff2bd95ad8f9246bf7d3ee3ee9448c06a19d1 (patch) | |
tree | ec4f7bdb40a59f94ce8053d2ad195e8c1396b313 /gst-libs/gst/codecparsers | |
parent | 877e69c9ec7cc19146932f78dfa71a7e4bfbdb1c (diff) | |
download | gstreamer-plugins-bad-af7ff2bd95ad8f9246bf7d3ee3ee9448c06a19d1.tar.gz |
codecparser: h265: Calculate crop rectangle dimensions
Diffstat (limited to 'gst-libs/gst/codecparsers')
-rw-r--r-- | gst-libs/gst/codecparsers/gsth265parser.c | 17 | ||||
-rw-r--r-- | gst-libs/gst/codecparsers/gsth265parser.h | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c index d940cd0af..6b50b0889 100644 --- a/gst-libs/gst/codecparsers/gsth265parser.c +++ b/gst-libs/gst/codecparsers/gsth265parser.c @@ -1564,6 +1564,8 @@ gst_h265_parse_sps (GstH265Parser * parser, GstH265NalUnit * nalu, GstH265VPS *vps; guint8 vps_id; guint i; + guint subwc[] = { 1, 2, 2, 1, 1 }; + guint subhc[] = { 1, 2, 1, 1, 1 }; GstH265VUIParams *vui = NULL; INITIALIZE_DEBUG_CATEGORY; @@ -1713,7 +1715,20 @@ gst_h265_parse_sps (GstH265Parser * parser, GstH265NalUnit * nalu, goto error; } - /* ToDo: Add crop_rectangle dimensions */ + if (sps->conformance_window_flag) { + const guint crop_unit_x = subwc[sps->chroma_format_idc]; + const guint crop_unit_y = subhc[sps->chroma_format_idc]; + + sps->crop_rect_width = sps->width - + (sps->conf_win_left_offset + sps->conf_win_right_offset) * crop_unit_x; + sps->crop_rect_height = sps->height - + (sps->conf_win_top_offset + sps->conf_win_bottom_offset) * crop_unit_y; + sps->crop_rect_x = sps->conf_win_left_offset * crop_unit_x; + sps->crop_rect_y = sps->conf_win_top_offset * crop_unit_y; + + GST_LOG ("crop_rectangle x=%u y=%u width=%u, height=%u", sps->crop_rect_x, + sps->crop_rect_y, sps->crop_rect_width, sps->crop_rect_height); + } sps->fps_num = 0; sps->fps_den = 1; diff --git a/gst-libs/gst/codecparsers/gsth265parser.h b/gst-libs/gst/codecparsers/gsth265parser.h index 7c0ea6981..9f426253e 100644 --- a/gst-libs/gst/codecparsers/gsth265parser.h +++ b/gst-libs/gst/codecparsers/gsth265parser.h @@ -763,6 +763,8 @@ struct _GstH265SPS /* calculated values */ guint8 chroma_array_type; gint width, height; + gint crop_rect_width, crop_rect_height; + gint crop_rect_x, crop_rect_y; gint fps_num, fps_den; gboolean valid; }; |