[FFmpeg-soc] [soc]: r1056 - in jpeg2000: j2kdec.c j2kenc.c

k.nowosad subversion at mplayerhq.hu
Mon Aug 20 16:48:13 CEST 2007


Author: k.nowosad
Date: Mon Aug 20 16:48:13 2007
New Revision: 1056

Log:
replaced Xsiz and Ysiz with width and height


Modified:
   jpeg2000/j2kdec.c
   jpeg2000/j2kenc.c

Modified: jpeg2000/j2kdec.c
==============================================================================
--- jpeg2000/j2kdec.c	(original)
+++ jpeg2000/j2kdec.c	Mon Aug 20 16:48:13 2007
@@ -107,7 +107,7 @@ typedef struct {
     AVCodecContext *avctx;
     AVFrame picture;
 
-    int Xsiz, Ysiz; ///< image width and height
+    int width, height; ///< image width and height
     int X0siz, Y0siz;
     int XT0siz, YT0siz;
     uint8_t cbps[4]; ///< numbps in components
@@ -184,7 +184,7 @@ static void dump(J2kDecoderContext *s, F
     fprintf(fd, "XSiz = %d, YSiz = %d, XTsiz = %d, YTsiz = %d\n"
                 "numXtiles = %d, numYtiles = %d, ncomponents = %d\n"
                 "tiles:\n",
-            s->Xsiz, s->Ysiz, s->XTsiz, s->YTsiz,
+            s->width, s->height, s->XTsiz, s->YTsiz,
             s->numXtiles, s->numYtiles, s->ncomponents);
     for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
         J2kTile *tile = s->tile + tileno;
@@ -293,8 +293,8 @@ static int get_siz(J2kDecoderContext *s)
     int i;
 
     bytestream_get_be16(&s->buf); ///< Rsiz (skipped)
-    s->Xsiz = bytestream_get_be32(&s->buf); ///< Xsiz
-    s->Ysiz = bytestream_get_be32(&s->buf); ///< Ysiz
+    s->width = bytestream_get_be32(&s->buf); ///< width
+    s->height = bytestream_get_be32(&s->buf); ///< height
     s->X0siz = bytestream_get_be32(&s->buf); ///< X0Siz
     s->Y0siz = bytestream_get_be32(&s->buf); ///< Y0Siz
 
@@ -314,8 +314,8 @@ static int get_siz(J2kDecoderContext *s)
             return -1;
     }
 
-    s->numXtiles = ff_j2k_ceildiv(s->Xsiz - s->XT0siz, s->XTsiz);
-    s->numYtiles = ff_j2k_ceildiv(s->Ysiz - s->YT0siz, s->YTsiz);
+    s->numXtiles = ff_j2k_ceildiv(s->width - s->XT0siz, s->XTsiz);
+    s->numYtiles = ff_j2k_ceildiv(s->height - s->YT0siz, s->YTsiz);
 
     s->tile = av_mallocz(s->numXtiles * s->numYtiles * sizeof(J2kTile));
     if (!s->tile)
@@ -329,8 +329,8 @@ static int get_siz(J2kDecoderContext *s)
             return -1;
     }
 
-    s->avctx->width = s->Xsiz - s->X0siz;
-    s->avctx->height = s->Ysiz - s->Y0siz;
+    s->avctx->width = s->width - s->X0siz;
+    s->avctx->height = s->height - s->Y0siz;
 
     switch(s->ncomponents){
         case 1: s->avctx->pix_fmt = PIX_FMT_GRAY8; break;
@@ -514,9 +514,9 @@ static int init_tile(J2kDecoderContext *
         int gbandno = 0; ///< global bandno
 
         comp->x0 = FFMAX(p * s->XTsiz + s->XT0siz, s->X0siz);
-        comp->x1 = FFMIN((p+1)*s->XTsiz + s->XT0siz, s->Xsiz);
+        comp->x1 = FFMIN((p+1)*s->XTsiz + s->XT0siz, s->width);
         comp->y0 = FFMAX(q * s->YTsiz + s->YT0siz, s->Y0siz);
-        comp->y1 = FFMIN((q+1)*s->YTsiz + s->YT0siz, s->Ysiz);
+        comp->y1 = FFMIN((q+1)*s->YTsiz + s->YT0siz, s->height);
 
         comp->data = av_malloc((comp->y1 - comp->y0) * (comp->x1 -comp->x0) * sizeof(int));
         if (comp->data == NULL)

Modified: jpeg2000/j2kenc.c
==============================================================================
--- jpeg2000/j2kenc.c	(original)
+++ jpeg2000/j2kenc.c	Mon Aug 20 16:48:13 2007
@@ -90,7 +90,7 @@ typedef struct {
     AVCodecContext *avctx;
     AVFrame *picture;
 
-    int Xsiz, Ysiz; // image width and height
+    int width, height; // image width and height
     uint8_t cbps[4]; // numbps in components
     uint8_t bbps[4][32][3]; // numbps in bands
     uint8_t expn[4][32][3]; // quantization exponents
@@ -154,7 +154,7 @@ static void dump(J2kEncoderContext *s, F
     fprintf(fd, "XSiz = %d, YSiz = %d, XTsiz = %d, YTsiz = %d\n"
                 "numXtiles = %d, numYtiles = %d, ncomponents = %d\n"
                 "tiles:\n",
-            s->Xsiz, s->Ysiz, s->XTsiz, s->YTsiz,
+            s->width, s->height, s->XTsiz, s->YTsiz,
             s->numXtiles, s->numYtiles, s->ncomponents);
     for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
         J2kTile *tile = s->tile + tileno;
@@ -292,8 +292,8 @@ static void put_siz(J2kEncoderContext *s
     put_marker(s, J2K_SIZ);
     bytestream_put_be16(&s->buf, 38 + 3 * s->ncomponents); // Lsiz
     bytestream_put_be16(&s->buf, 0); // Rsiz
-    bytestream_put_be32(&s->buf, s->Xsiz); // Xsiz
-    bytestream_put_be32(&s->buf, s->Ysiz); // Ysiz
+    bytestream_put_be32(&s->buf, s->width); // width
+    bytestream_put_be32(&s->buf, s->height); // height
     bytestream_put_be32(&s->buf, 0); // X0Siz
     bytestream_put_be32(&s->buf, 0); // Y0Siz
 
@@ -363,8 +363,8 @@ static int init_tiles(J2kEncoderContext 
 {
     int y, x, tno, compno, reslevelno, bandno, i;
 
-    s->numXtiles = ff_j2k_ceildiv(s->Xsiz, s->XTsiz);
-    s->numYtiles = ff_j2k_ceildiv(s->Ysiz, s->YTsiz);
+    s->numXtiles = ff_j2k_ceildiv(s->width, s->XTsiz);
+    s->numYtiles = ff_j2k_ceildiv(s->height, s->YTsiz);
 
     s->tile = av_malloc(s->numXtiles * s->numYtiles * sizeof(J2kTile));
     if (s->tile == NULL)
@@ -381,9 +381,9 @@ static int init_tiles(J2kEncoderContext 
             J2kComponent *comp = tile->comp + compno;
 
             comp->x0 = p * s->XTsiz;
-            comp->x1 = FFMIN((p+1)*s->XTsiz, s->Xsiz);
+            comp->x1 = FFMIN((p+1)*s->XTsiz, s->width);
             comp->y0 = q * s->YTsiz;
-            comp->y1 = FFMIN((q+1)*s->YTsiz, s->Ysiz);
+            comp->y1 = FFMIN((q+1)*s->YTsiz, s->height);
 
             comp->data = av_malloc((comp->y1 - comp->y0) * (comp->x1 -comp->x0) * sizeof(int));
             if (comp->data == NULL)
@@ -1055,8 +1055,8 @@ static int encode_frame(AVCodecContext *
     // init:
     s->buf = s->buf_start = buf;
     s->buf_end = buf + buf_size;
-    s->Xsiz = avctx->width;
-    s->Ysiz = avctx->height;
+    s->width = avctx->width;
+    s->height = avctx->height;
 
     s->nguardbits = 1;
     s->lambda = s->picture->quality * LAMBDA_SCALE;



More information about the FFmpeg-soc mailing list