summaryrefslogtreecommitdiff
path: root/gst/videosignal
diff options
context:
space:
mode:
authorVineeth T M <vineeth.tm@samsung.com>2015-02-12 12:04:44 +0530
committerThiago Santos <thiagoss@osg.samsung.com>2015-02-13 18:33:48 -0300
commit413a60959d34f7a3c75237a567ff768308c75d05 (patch)
treeda83e855b90620efd8518951595ed015378987ab /gst/videosignal
parentb347ea98703e03b41f0f5fca003b15005e82c4aa (diff)
downloadgstreamer-plugins-bad-413a60959d34f7a3c75237a567ff768308c75d05.tar.gz
simplevideomark: refactor code
the calculations for drawing the videomark is being repeated in for loop unnecessarily. Moving this outside of for loop such that the code need not be executed evertime the loop is executed. https://bugzilla.gnome.org/show_bug.cgi?id=744371
Diffstat (limited to 'gst/videosignal')
-rw-r--r--gst/videosignal/gstsimplevideomark.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/gst/videosignal/gstsimplevideomark.c b/gst/videosignal/gstsimplevideomark.c
index 85e719de7..d62af9b8d 100644
--- a/gst/videosignal/gstsimplevideomark.c
+++ b/gst/videosignal/gstsimplevideomark.c
@@ -359,15 +359,13 @@ gst_video_mark_yuv (GstSimpleVideoMark * simplevideomark, GstVideoFrame * frame)
return GST_FLOW_ERROR;
}
+ d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
+ /* move to start of bottom left */
+ d += row_stride * (height - ph - simplevideomark->bottom_offset) +
+ pixel_stride * simplevideomark->left_offset;
+
/* draw the bottom left pixels */
for (i = 0; i < simplevideomark->pattern_count; i++) {
- d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
- /* move to start of bottom left */
- d += row_stride * (height - ph - simplevideomark->bottom_offset) +
- pixel_stride * simplevideomark->left_offset;
- /* move to i-th pattern */
- d += pixel_stride * pw * i;
-
if (i & 1)
/* odd pixels must be white */
color = 255;
@@ -377,6 +375,9 @@ gst_video_mark_yuv (GstSimpleVideoMark * simplevideomark, GstVideoFrame * frame)
/* draw box of width * height */
gst_video_mark_draw_box (simplevideomark, d, pw, ph, row_stride,
pixel_stride, color);
+
+ /* move to i-th pattern */
+ d += pixel_stride * pw;
}
pattern_shift =
@@ -384,15 +385,6 @@ gst_video_mark_yuv (GstSimpleVideoMark * simplevideomark, GstVideoFrame * frame)
/* get the data of the pattern */
for (i = 0; i < simplevideomark->pattern_data_count; i++) {
- d = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
- /* move to start of bottom left, adjust for offsets */
- d += row_stride * (height - ph - simplevideomark->bottom_offset) +
- pixel_stride * simplevideomark->left_offset;
- /* move after the fixed pattern */
- d += pixel_stride * simplevideomark->pattern_count * pw;
- /* move to i-th pattern data */
- d += pixel_stride * pw * i;
-
if (simplevideomark->pattern_data & pattern_shift)
color = 255;
else
@@ -402,6 +394,9 @@ gst_video_mark_yuv (GstSimpleVideoMark * simplevideomark, GstVideoFrame * frame)
pixel_stride, color);
pattern_shift >>= 1;
+
+ /* move to i-th pattern data */
+ d += pixel_stride * pw;
}
return GST_FLOW_OK;