[xiph-cvs] cvs commit: theora/lib toplevel.c

Ralph Giles giles at xiph.org
Tue Jun 3 15:39:27 PDT 2003



giles       03/06/03 18:39:27

  Modified:    examples encoder_example.c
               include/theora theora.h
               lib      toplevel.c
  Log:
  Correct errors in the previous implementation of the crop rectangle. The
  crop rectangle dimensions and offset were being rounded to the nearest
  16. Instead, we use the full 24 bits to store the dimensions and use 8
  for each offset. This limits the 'lossless crop' option discussed in
  design, but I don't think that's very useful and can probably be done by
  throwing out the extra macroblocks anyway.
  
  Also give the new fields better names.

Revision  Changes    Path
1.14      +5 -5      theora/examples/encoder_example.c

Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/theora/examples/encoder_example.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- encoder_example.c	3 Jun 2003 20:38:13 -0000	1.13
+++ encoder_example.c	3 Jun 2003 22:39:26 -0000	1.14
@@ -12,7 +12,7 @@
 
   function: example encoder application; makes an Ogg Theora/Vorbis 
             file from YUV4MPEG2 and WAV input
-  last mod: $Id: encoder_example.c,v 1.13 2003/06/03 20:38:13 mauricio Exp $
+  last mod: $Id: encoder_example.c,v 1.14 2003/06/03 22:39:26 giles Exp $
 
  ********************************************************************/
 
@@ -577,10 +577,10 @@
   
   ti.width=video_x_canvas;
   ti.height=video_y_canvas;
-  ti.pixel_width=video_x;
-  ti.pixel_height=video_y;
-  ti.x_offset=video_x_offset;
-  ti.y_offset=video_y_offset;
+  ti.frame_width=video_x;
+  ti.frame_height=video_y;
+  ti.offset_x=video_x_offset;
+  ti.offset_y=video_y_offset;
   ti.fps_numerator=video_hzn;
   ti.fps_denominator=video_hzd;
   ti.aspect_numerator=video_an;

<p><p>1.8       +5 -5      theora/include/theora/theora.h

Index: theora.h
===================================================================
RCS file: /usr/local/cvsroot/theora/include/theora/theora.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- theora.h	3 Jun 2003 20:38:13 -0000	1.7
+++ theora.h	3 Jun 2003 22:39:26 -0000	1.8
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: 
-  last mod: $Id: theora.h,v 1.7 2003/06/03 20:38:13 mauricio Exp $
+  last mod: $Id: theora.h,v 1.8 2003/06/03 22:39:26 giles Exp $
 
  ********************************************************************/
 
@@ -38,10 +38,10 @@
 typedef struct{
   ogg_uint32_t  width;
   ogg_uint32_t  height;
-  ogg_uint32_t  pixel_width;
-  ogg_uint32_t  pixel_height;
-  ogg_uint32_t  x_offset;
-  ogg_uint32_t  y_offset;
+  ogg_uint32_t  frame_width;
+  ogg_uint32_t  frame_height;
+  ogg_uint32_t  offset_x;
+  ogg_uint32_t  offset_y;
   ogg_uint32_t  fps_numerator;
   ogg_uint32_t  fps_denominator;
   ogg_uint32_t  aspect_numerator;

<p><p>1.20      +11 -9     theora/lib/toplevel.c

Index: toplevel.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- toplevel.c	3 Jun 2003 20:38:13 -0000	1.19
+++ toplevel.c	3 Jun 2003 22:39:26 -0000	1.20
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: 
-  last mod: $Id: toplevel.c,v 1.19 2003/06/03 20:38:13 mauricio Exp $
+  last mod: $Id: toplevel.c,v 1.20 2003/06/03 22:39:26 giles Exp $
 
  ********************************************************************/
 
@@ -1038,10 +1038,11 @@
 
   oggpackB_write(&cpi->oggbuffer,cpi->pb.info.width>>4,16);
   oggpackB_write(&cpi->oggbuffer,cpi->pb.info.height>>4,16);
-  oggpackB_write(&cpi->oggbuffer,cpi->pb.info.pixel_width>>4,16);
-  oggpackB_write(&cpi->oggbuffer,cpi->pb.info.pixel_height>>4,16);
-  oggpackB_write(&cpi->oggbuffer,cpi->pb.info.x_offset>>4,16);
-  oggpackB_write(&cpi->oggbuffer,cpi->pb.info.y_offset>>4,16);
+  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);
+
   oggpackB_write(&cpi->oggbuffer,cpi->pb.info.fps_numerator,32);
   oggpackB_write(&cpi->oggbuffer,cpi->pb.info.fps_denominator,32);
   oggpackB_write(&cpi->oggbuffer,cpi->pb.info.aspect_numerator,24);
@@ -1199,10 +1200,11 @@
 
   c->width=oggpackB_read(&opb,16)<<4;
   c->height=oggpackB_read(&opb,16)<<4;
-  c->pixel_width=oggpackB_read(&opb,16)<<4;
-  c->pixel_height=oggpackB_read(&opb,16)<<4;
-  c->x_offset=oggpackB_read(&opb,16)<<4;
-  c->y_offset=oggpackB_read(&opb,16)<<4;
+  c->frame_width=oggpackB_read(&opb,24);
+  c->frame_height=oggpackB_read(&opb,24);
+  c->offset_x=oggpackB_read(&opb,8);
+  c->offset_y=oggpackB_read(&opb,8);
+
   c->fps_numerator=oggpackB_read(&opb,32);
   c->fps_denominator=oggpackB_read(&opb,32);
   c->aspect_numerator=oggpackB_read(&opb,24);

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list