[xiph-commits] r11358 - in branches/theora-mmx: . include/theora lib

j at svn.xiph.org j at svn.xiph.org
Sun May 7 05:41:13 PDT 2006


Author: j
Date: 2006-05-07 05:41:03 -0700 (Sun, 07 May 2006)
New Revision: 11358

Modified:
   branches/theora-mmx/
   branches/theora-mmx/CHANGES
   branches/theora-mmx/include/theora/theora.h
   branches/theora-mmx/lib/encoder_toplevel.c
   branches/theora-mmx/lib/toplevel.c
Log:
merge changes from trunk


Property changes on: branches/theora-mmx
___________________________________________________________________
Name: branch-point
   - 11141
   + 11357

Modified: branches/theora-mmx/CHANGES
===================================================================
--- branches/theora-mmx/CHANGES	2006-05-07 12:28:40 UTC (rev 11357)
+++ branches/theora-mmx/CHANGES	2006-05-07 12:41:03 UTC (rev 11358)
@@ -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: branches/theora-mmx/include/theora/theora.h
===================================================================
--- branches/theora-mmx/include/theora/theora.h	2006-05-07 12:28:40 UTC (rev 11357)
+++ branches/theora-mmx/include/theora/theora.h	2006-05-07 12:41:03 UTC (rev 11358)
@@ -104,7 +104,7 @@
  * this is what the width and height members represent. To
  * handle other sizes, a crop rectangle is specified in 
  * frame_height and frame_width, offset_x and offset_y. The
- * offset and size should still be a power of 2 to avoid
+ * offset and size should still be a multiple of 2 to avoid
  * chroma sampling shifts.
  *
  * Frame rate, in frames per second is stored as a rational

Modified: branches/theora-mmx/lib/encoder_toplevel.c
===================================================================
--- branches/theora-mmx/lib/encoder_toplevel.c	2006-05-07 12:28:40 UTC (rev 11357)
+++ branches/theora-mmx/lib/encoder_toplevel.c	2006-05-07 12:41:03 UTC (rev 11358)
@@ -1045,6 +1045,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);
@@ -1063,7 +1064,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: branches/theora-mmx/lib/toplevel.c
===================================================================
--- branches/theora-mmx/lib/toplevel.c	2006-05-07 12:28:40 UTC (rev 11357)
+++ branches/theora-mmx/lib/toplevel.c	2006-05-07 12:41:03 UTC (rev 11358)
@@ -133,6 +133,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