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.
This commit is contained in:
Sebastian Dröge 2012-01-25 18:24:07 +01:00
parent 544b7a35b0
commit b363d4a103

View file

@ -1057,6 +1057,7 @@ theora_enc_is_discontinuous (GstTheoraEnc * enc, GstClockTime timestamp,
static void static void
theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame) theora_enc_init_buffer (th_ycbcr_buffer buf, GstVideoFrame * frame)
{ {
GstVideoInfo info;
guint i; guint i;
/* According to Theora developer Timothy Terriberry, the Theora /* 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 * 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. * 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++) { for (i = 0; i < 3; i++) {
buf[i].width = GST_VIDEO_FRAME_COMP_WIDTH (frame, i); buf[i].width = GST_VIDEO_INFO_COMP_WIDTH (&info, i);
buf[i].height = GST_VIDEO_FRAME_COMP_HEIGHT (frame, i); buf[i].height = GST_VIDEO_INFO_COMP_HEIGHT (&info, i);
buf[i].data = GST_VIDEO_FRAME_COMP_DATA (frame, i); buf[i].data = GST_VIDEO_FRAME_COMP_DATA (frame, i);
buf[i].stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, i); buf[i].stride = GST_VIDEO_FRAME_COMP_STRIDE (frame, i);
} }