summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2015-03-05 08:52:18 (GMT)
committerWim Taymans <wtaymans@redhat.com>2015-03-05 08:52:18 (GMT)
commit31a3e6c9f1462a7d76eddbceebac9fb9ceeef44e (patch)
tree8f9096e1bc217874b053e05b621f7357d4d5d154
parent6602861d00acd70976a26910576288245fd833cd (diff)
downloadgst-plugins-base-31a3e6c9f1462a7d76eddbceebac9fb9ceeef44e.tar.gz
gst-plugins-base-31a3e6c9f1462a7d76eddbceebac9fb9ceeef44e.tar.xz
video-converter: avoid scaler when size is unchanged
-rw-r--r--gst-libs/gst/video/video-converter.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c
index 68acdae..afdb5d3 100644
--- a/gst-libs/gst/video/video-converter.c
+++ b/gst-libs/gst/video/video-converter.c
@@ -3881,26 +3881,31 @@ setup_scale (GstVideoConverter * convert)
if (is_merge_yuv (in_info)) {
GstVideoScaler *y_scaler, *uv_scaler;
- y_scaler = gst_video_scaler_new (method, GST_VIDEO_SCALER_FLAG_NONE, taps,
- GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (in_finfo, GST_VIDEO_COMP_Y,
- in_width), GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (out_finfo,
- GST_VIDEO_COMP_Y, out_width), convert->config);
- uv_scaler =
- gst_video_scaler_new (method, GST_VIDEO_SCALER_FLAG_NONE, taps,
- GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (in_finfo, GST_VIDEO_COMP_U,
- in_width), GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (out_finfo,
- GST_VIDEO_COMP_U, out_width), convert->config);
+ if (in_width != out_width) {
+ y_scaler =
+ gst_video_scaler_new (method, GST_VIDEO_SCALER_FLAG_NONE, taps,
+ GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (in_finfo, GST_VIDEO_COMP_Y,
+ in_width), GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (out_finfo,
+ GST_VIDEO_COMP_Y, out_width), convert->config);
+ uv_scaler =
+ gst_video_scaler_new (method, GST_VIDEO_SCALER_FLAG_NONE, taps,
+ GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (in_finfo, GST_VIDEO_COMP_U,
+ in_width), GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (out_finfo,
+ GST_VIDEO_COMP_U, out_width), convert->config);
- convert->fh_scaler[0] =
- gst_video_scaler_combine_packed_YUV (y_scaler, uv_scaler,
- in_format, out_format);
+ convert->fh_scaler[0] =
+ gst_video_scaler_combine_packed_YUV (y_scaler, uv_scaler,
+ in_format, out_format);
+
+ gst_video_scaler_free (y_scaler);
+ gst_video_scaler_free (uv_scaler);
+ } else
+ convert->fh_scaler[0] = NULL;
pstride = GST_VIDEO_FORMAT_INFO_PSTRIDE (out_finfo, GST_VIDEO_COMP_Y);
convert->fin_x[0] = GST_ROUND_UP_2 (convert->in_x) * pstride;
convert->fout_x[0] = GST_ROUND_UP_2 (convert->out_x) * pstride;
- gst_video_scaler_free (y_scaler);
- gst_video_scaler_free (uv_scaler);
} else {
if (in_width != out_width && in_width != 0 && out_width != 0)
convert->fh_scaler[0] =