diff options
| author | Carl Eugen Hoyos <[email protected]> | 2012-01-19 23:11:53 +0100 | 
|---|---|---|
| committer | Carl Eugen Hoyos <[email protected]> | 2012-01-19 23:31:22 +0100 | 
| commit | e209a3777791f44fd716f6829f17686f35deb47a (patch) | |
| tree | 5043aaae693bf5699835939fa4a373f09b5f18e9 | |
| parent | 21a100610977a163fe6480b5cf4c25f34f64b86b (diff) | |
Simplify 32bit png decoding.
| -rw-r--r-- | libavcodec/pngdec.c | 22 | ||||
| -rw-r--r-- | libavcodec/version.h | 2 | 
2 files changed, 7 insertions, 17 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index b439329e36..307dd1abbd 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -101,17 +101,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width,          bpp = bits_per_pixel >> 3;          d = dst;          s = src; -        if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) { -            for(x = 0; x < width; x++) { -                j = x & 7; -                if ((dsp_mask << j) & 0x80) { -                    *(uint32_t *)d = (s[3] << 24) | (s[0] << 16) | (s[1] << 8) | s[2]; -                } -                d += bpp; -                if ((mask << j) & 0x80) -                    s += bpp; -            } -        } else {              for(x = 0; x < width; x++) {                  j = x & 7;                  if ((dsp_mask << j) & 0x80) { @@ -121,7 +110,6 @@ static void png_put_interlaced_row(uint8_t *dst, int width,                  if ((mask << j) & 0x80)                      s += bpp;              } -        }          break;      }  } @@ -265,7 +253,10 @@ static av_always_inline void convert_to_rgb32_loco(uint8_t *dst, const uint8_t *              r = (r+g)&0xff;              b = (b+g)&0xff;          } -        *(uint32_t *)dst = (a << 24) | (r << 16) | (g << 8) | b; +        dst[0] = r; +        dst[1] = g; +        dst[2] = b; +        dst[3] = a;          dst += 4;          src += 4;      } @@ -276,7 +267,7 @@ static void convert_to_rgb32(uint8_t *dst, const uint8_t *src, int width, int lo      if(loco)          convert_to_rgb32_loco(dst, src, width, 1);      else -        convert_to_rgb32_loco(dst, src, width, 0); +        memcpy(dst, src, width * 4);  }  static void deloco_rgb24(uint8_t *dst, int size) @@ -339,7 +330,6 @@ static void png_handle_row(PNGDecContext *s)                  got_line = 1;              }              if ((png_pass_dsp_ymask[s->pass] << (s->y & 7)) & 0x80) { -                /* NOTE: RGB32 is handled directly in png_put_interlaced_row */                  png_put_interlaced_row(ptr, s->width, s->bits_per_pixel, s->pass,                                         s->color_type, s->last_row);              } @@ -484,7 +474,7 @@ static int decode_frame(AVCodecContext *avctx,                      avctx->pix_fmt = PIX_FMT_RGB24;                  } else if (s->bit_depth == 8 &&                             s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { -                    avctx->pix_fmt = PIX_FMT_RGB32; +                    avctx->pix_fmt = PIX_FMT_RGBA;                  } else if (s->bit_depth == 8 &&                             s->color_type == PNG_COLOR_TYPE_GRAY) {                      avctx->pix_fmt = PIX_FMT_GRAY8; diff --git a/libavcodec/version.h b/libavcodec/version.h index b897458241..75cae12605 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@  #define LIBAVCODEC_VERSION_MAJOR 53  #define LIBAVCODEC_VERSION_MINOR 57 -#define LIBAVCODEC_VERSION_MICRO 103 +#define LIBAVCODEC_VERSION_MICRO 104  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \                                                 LIBAVCODEC_VERSION_MINOR, \  | 
