Merge commit '55c4cba2a7037161ea56b2d55b347c8381df7f1e'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 30 Jul 2013 07:50:26 +0000 (09:50 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 30 Jul 2013 07:50:26 +0000 (09:50 +0200)
* commit '55c4cba2a7037161ea56b2d55b347c8381df7f1e':
  huffyuvenc: BGRA support

Conflicts:
libavcodec/huffyuvenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/huffyuvenc.c

@@@ -55,11 -54,12 +55,12 @@@ static inline int sub_left_prediction(H
  }
  
  static inline void sub_left_prediction_bgr32(HYuvContext *s, uint8_t *dst,
 -                                             uint8_t *src, int w,
 +                                             const uint8_t *src, int w,
-                                              int *red, int *green, int *blue, int *alpha)
+                                              int *red, int *green, int *blue,
+                                              int *alpha)
  {
      int i;
-     int r,g,b,a;
+     int r, g, b, a;
      r = *red;
      g = *green;
      b = *blue;
@@@ -157,8 -157,8 +162,8 @@@ static av_cold int encode_init(AVCodecC
      case AV_PIX_FMT_YUV420P:
      case AV_PIX_FMT_YUV422P:
          if (s->width & 1) {
-             av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n");
+             av_log(avctx, AV_LOG_ERROR, "Width must be even for this colorspace.\n");
 -            return -1;
 +            return AVERROR(EINVAL);
          }
          s->bitstream_bpp = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 12 : 16;
          break;
@@@ -389,21 -387,25 +395,25 @@@ static inline int encode_bgra_bitstream
          return -1;
      }
  
- #define LOAD3\
-             int g =  s->temp[0][planes==3 ? 3*i + 1 : 4*i + G];\
-             int b = (s->temp[0][planes==3 ? 3*i + 2 : 4*i + B] - g) & 0xff;\
-             int r = (s->temp[0][planes==3 ? 3*i + 0 : 4*i + R] - g) & 0xff;\
-             int a =  s->temp[0][planes*i + A];
- #define STAT3\
-             s->stats[0][b]++;\
-             s->stats[1][g]++;\
-             s->stats[2][r]++;\
-             if(planes==4) s->stats[2][a]++;
- #define WRITE3\
-             put_bits(&s->pb, s->len[1][g], s->bits[1][g]);\
-             put_bits(&s->pb, s->len[0][b], s->bits[0][b]);\
-             put_bits(&s->pb, s->len[2][r], s->bits[2][r]);\
-             if(planes==4) put_bits(&s->pb, s->len[2][a], s->bits[2][a]);
+ #define LOAD_GBRA                                                       \
+     int g = s->temp[0][planes == 3 ? 3 * i + 1 : 4 * i + G];            \
 -    int b = s->temp[0][planes == 3 ? 3 * i + 2 : 4 * i + B] - g & 0xFF; \
 -    int r = s->temp[0][planes == 3 ? 3 * i + 0 : 4 * i + R] - g & 0xFF; \
++    int b =(s->temp[0][planes == 3 ? 3 * i + 2 : 4 * i + B] - g) & 0xFF;\
++    int r =(s->temp[0][planes == 3 ? 3 * i + 0 : 4 * i + R] - g) & 0xFF;\
+     int a = s->temp[0][planes * i + A];
+ #define STAT_BGRA                                                       \
+     s->stats[0][b]++;                                                   \
+     s->stats[1][g]++;                                                   \
+     s->stats[2][r]++;                                                   \
+     if (planes == 4)                                                    \
+         s->stats[2][a]++;
+ #define WRITE_GBRA                                                      \
+     put_bits(&s->pb, s->len[1][g], s->bits[1][g]);                      \
+     put_bits(&s->pb, s->len[0][b], s->bits[0][b]);                      \
+     put_bits(&s->pb, s->len[2][r], s->bits[2][r]);                      \
+     if (planes == 4)                                                    \
+         put_bits(&s->pb, s->len[2][a], s->bits[2][a]);
  
      if ((s->flags & CODEC_FLAG_PASS1) &&
          (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)) {