[0.11] gst-plugins-base: theoraenc: Fix encoding of non-mod-16 widths/ heights

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Jan 25 09:24:55 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: b363d4a1032733d64b8e7068176ee7dcea49e5ba
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=b363d4a1032733d64b8e7068176ee7dcea49e5ba

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Jan 25 18:24:07 2012 +0100

theoraenc: Fix encoding of non-mod-16 widths/heights

The next higher multiple of 16 has to be passed
in the input buffers but Theora does never read
beyond the configured picture size.

---

 ext/theora/gsttheoraenc.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c
index 00ecd69..2406779 100644
--- a/ext/theora/gsttheoraenc.c
+++ b/ext/theora/gsttheoraenc.c
@@ -1057,6 +1057,7 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstClockTime timestamp,
 static void
 theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame)
 {
+  GstVideoInfo info;
   guint i;
 
   /* According to Theora developer Timothy Terriberry, the Theora 
@@ -1066,9 +1067,15 @@ theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame)
    * Due to this, setting the frame's width/height as the buffer width/height
    * is perfectly ok, even though it does not strictly look ok.
    */
+
+  gst_video_info_init (&info);
+  gst_video_info_set_format (&info, GST_VIDEO_FRAME_FORMAT (frame),
+      GST_ROUND_UP_16 (GST_VIDEO_FRAME_WIDTH (frame)),
+      GST_ROUND_UP_16 (GST_VIDEO_FRAME_HEIGHT (frame)));
+
   for (i = 0; i < 3; i++) {
-    buf[i].width = GST_VIDEO_FRAME_COMP_WIDTH (frame, i);
-    buf[i].height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, i);
+    buf[i].width = GST_VIDEO_INFO_COMP_WIDTH (&info, i);
+    buf[i].height = GST_VIDEO_INFO_COMP_HEIGHT (&info, i);
     buf[i].data = GST_VIDEO_FRAME_COMP_DATA (frame, i);
     buf[i].stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, i);
   }



More information about the gstreamer-commits mailing list