[xiph-commits] r11357 - in trunk/theora: . lib

msmith at svn.xiph.org msmith at svn.xiph.org
Sun May 7 05:28:44 PDT 2006


Author: msmith
Date: 2006-05-07 05:28:40 -0700 (Sun, 07 May 2006)
New Revision: 11357

Modified:
   trunk/theora/CHANGES
   trunk/theora/lib/encoder_toplevel.c
   trunk/theora/lib/toplevel.c
Log:
Make offset_y mean what applications use it as.



Modified: trunk/theora/CHANGES
===================================================================
--- trunk/theora/CHANGES	2006-05-06 23:47:20 UTC (rev 11356)
+++ trunk/theora/CHANGES	2006-05-07 12:28:40 UTC (rev 11357)
@@ -6,6 +6,9 @@
  * Fix invalid array indexing in PixelLineSearch()
  * Improve robustness against invalid input
  * General warning cleanup
+ * The offset_y member now means what every application thought it meant
+   (offset from the top). This will mean some old files (those with a 
+   non-centered image created with a buggy encoder) will display differently.
 
 libtheora 1.0alpha5 (2005 August 20)
 

Modified: trunk/theora/lib/encoder_toplevel.c
===================================================================
--- trunk/theora/lib/encoder_toplevel.c	2006-05-06 23:47:20 UTC (rev 11356)
+++ trunk/theora/lib/encoder_toplevel.c	2006-05-07 12:28:40 UTC (rev 11357)
@@ -1042,6 +1042,7 @@
 /* build the initial short header for stream recognition and format */
 int theora_encode_header(theora_state *t, ogg_packet *op){
   CP_INSTANCE *cpi=(CP_INSTANCE *)(t->internal_encode);
+  int offset_y;
 
 #ifndef LIBOGG2
   oggpackB_reset(cpi->oggbuffer);
@@ -1060,7 +1061,12 @@
   oggpackB_write(cpi->oggbuffer,cpi->pb.info.frame_width,24);
   oggpackB_write(cpi->oggbuffer,cpi->pb.info.frame_height,24);
   oggpackB_write(cpi->oggbuffer,cpi->pb.info.offset_x,8);
-  oggpackB_write(cpi->oggbuffer,cpi->pb.info.offset_y,8);
+  /* Applications use offset_y to mean offset from the top of the image; the
+   * meaning in the bitstream is the opposite (from the bottom). Transform.
+   */
+  offset_y = cpi->pb.info.height - cpi->pb.info.frame_height - 
+    cpi->pb.info.offset_y;
+  oggpackB_write(cpi->oggbuffer,offset_y,8);
 
   oggpackB_write(cpi->oggbuffer,cpi->pb.info.fps_numerator,32);
   oggpackB_write(cpi->oggbuffer,cpi->pb.info.fps_denominator,32);

Modified: trunk/theora/lib/toplevel.c
===================================================================
--- trunk/theora/lib/toplevel.c	2006-05-06 23:47:20 UTC (rev 11356)
+++ trunk/theora/lib/toplevel.c	2006-05-07 12:28:40 UTC (rev 11357)
@@ -132,6 +132,8 @@
   ci->offset_x=ret;
   theora_read(opb,8,&ret);
   ci->offset_y=ret;
+  /* Change offset_y to have the meaning everyone expects it to have */
+  ci->offset_y = ci->height - ci->frame_height - ci->offset_y;
 
   theora_read(opb,32,&ret);
   ci->fps_numerator=ret;



More information about the commits mailing list