]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/texturedspenc.c
mpeg12dec: move setting first_field to mpeg_field_start()
[ffmpeg] / libavcodec / texturedspenc.c
index a351bea5f08db21e57cd81afe835a6a6ccacefc8..27aaa78d53875083044705da7e7477dc57d958db 100644 (file)
@@ -181,7 +181,7 @@ static unsigned int match_colors(const uint8_t *block, ptrdiff_t stride,
     int x, y, k = 0;
     int c0_point, half_point, c3_point;
     uint8_t color[16];
-    const int indexMap[8] = {
+    static const int indexMap[8] = {
         0 << 30, 2 << 30, 0 << 30, 2 << 30,
         3 << 30, 3 << 30, 1 << 30, 1 << 30,
     };
@@ -213,7 +213,7 @@ static unsigned int match_colors(const uint8_t *block, ptrdiff_t stride,
      * the same inside that subinterval.
      *
      * Relying on this 1d approximation isn't always optimal in terms of
-     * euclidean distance, but it's very close and a lot faster.
+     * Euclidean distance, but it's very close and a lot faster.
      *
      * http://cbloomrants.blogspot.com/2008/12/12-08-08-dxtc-summary.html */
     c0_point   = (stops[1] + stops[3]) >> 1;
@@ -309,7 +309,7 @@ static void optimize_colors(const uint8_t *block, ptrdiff_t stride,
     if (fabs(vfb) > magn)
         magn = fabs(vfb);
 
-    /* if magnitudo is too small, default to luminance */
+    /* if magnitude is too small, default to luminance */
     if (magn < 4.0f) {
         /* JPEG YCbCr luma coefs, scaled by 1000 */
         v_r = 299;
@@ -359,8 +359,8 @@ static int refine_colors(const uint8_t *block, ptrdiff_t stride,
     /* Additional magic to save a lot of multiplies in the accumulating loop.
      * The tables contain precomputed products of weights for least squares
      * system, accumulated inside one 32-bit register */
-    const int w1tab[4] = { 3, 0, 2, 1 };
-    const int prods[4] = { 0x090000, 0x000900, 0x040102, 0x010402 };
+    static const int w1tab[4] = { 3, 0, 2, 1 };
+    static const int prods[4] = { 0x090000, 0x000900, 0x040102, 0x010402 };
 
     /* Check if all pixels have the same index */
     if ((mask ^ (mask << 2)) < 4) {
@@ -583,14 +583,10 @@ static void rgba2ycocg(uint8_t *dst, const uint8_t *pixel)
     int b =  pixel[2];
     int t = (2 + r + b) >> 2;
 
-    int y  = av_clip_uint8(g + t);
-    int co = av_clip_uint8(128 + ((r - b + 1) >> 1));
-    int cg = av_clip_uint8(128 + g - t);
-
-    dst[0] = (uint8_t) co;
-    dst[1] = (uint8_t) cg;
+    dst[0] = av_clip_uint8(128 + ((r - b + 1) >> 1));   /* Co */
+    dst[1] = av_clip_uint8(128 + g - t);                /* Cg */
     dst[2] = 0;
-    dst[3] = (uint8_t) y;
+    dst[3] = av_clip_uint8(g + t);                      /* Y */
 }
 
 /**