Merge commit 'daffed3b173c59d64907747bf3309e98a8974f4e'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 12:48:20 +0000 (13:48 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 12:48:20 +0000 (13:48 +0100)
* commit 'daffed3b173c59d64907747bf3309e98a8974f4e':
  ljpegenc: accept bgr24 instead of bgra

Conflicts:
libavcodec/ljpegenc.c
libavcodec/mjpegenc.c

Only whitespace merged, we continue to support both formats

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

@@@ -114,15 -111,9 +114,15 @@@ static int ljpeg_encode_frame(AVCodecCo
                  top[i]= left[i]= topleft[i]= buffer[0][i];
              }
              for(x = 0; x < width; x++) {
 -                buffer[x][1] =  ptr[3 * x + 0] -     ptr[3 * x + 1] + 0x100;
 -                buffer[x][2] =  ptr[3 * x + 2] -     ptr[3 * x + 1] + 0x100;
 -                buffer[x][0] = (ptr[3 * x + 0] + 2 * ptr[3 * x + 1] + ptr[3 * x + 2]) >> 2;
 +                if(avctx->pix_fmt == AV_PIX_FMT_BGR24){
-                     buffer[x][1] = ptr[3*x+0] - ptr[3*x+1] + 0x100;
-                     buffer[x][2] = ptr[3*x+2] - ptr[3*x+1] + 0x100;
-                     buffer[x][0] = (ptr[3*x+0] + 2*ptr[3*x+1] + ptr[3*x+2])>>2;
++                    buffer[x][1] =  ptr[3 * x + 0] -     ptr[3 * x + 1] + 0x100;
++                    buffer[x][2] =  ptr[3 * x + 2] -     ptr[3 * x + 1] + 0x100;
++                    buffer[x][0] = (ptr[3 * x + 0] + 2 * ptr[3 * x + 1] + ptr[3 * x + 2]) >> 2;
 +                }else{
-                 buffer[x][1] = ptr[4*x+0] - ptr[4*x+1] + 0x100;
-                 buffer[x][2] = ptr[4*x+2] - ptr[4*x+1] + 0x100;
-                 buffer[x][0] = (ptr[4*x+0] + 2*ptr[4*x+1] + ptr[4*x+2])>>2;
++                    buffer[x][1] =  ptr[4 * x + 0] -     ptr[4 * x + 1] + 0x100;
++                    buffer[x][2] =  ptr[4 * x + 2] -     ptr[4 * x + 1] + 0x100;
++                    buffer[x][0] = (ptr[4 * x + 0] + 2 * ptr[4 * x + 1] + ptr[4 * x + 2]) >> 2;
 +                }
  
                  for(i=0;i<3;i++) {
                      int pred, diff;
@@@ -215,10 -184,9 +215,10 @@@ void ff_mjpeg_encode_picture_header(AVC
  
      av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift,
                                       &chroma_v_shift);
 -
      if (avctx->codec->id == AV_CODEC_ID_LJPEG &&
-         (avctx->pix_fmt == AV_PIX_FMT_BGR0
 -        avctx->pix_fmt   == AV_PIX_FMT_BGR24) {
++        (   avctx->pix_fmt == AV_PIX_FMT_BGR0
 +         || avctx->pix_fmt == AV_PIX_FMT_BGRA
 +         || avctx->pix_fmt == AV_PIX_FMT_BGR24)) {
          vsample[0] = hsample[0] =
          vsample[1] = hsample[1] =
          vsample[2] = hsample[2] = 1;