Merge commit 'daffed3b173c59d64907747bf3309e98a8974f4e'

* 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>
pull/48/merge
Michael Niedermayer 11 years ago
commit fb98ca575d
  1. 12
      libavcodec/ljpegenc.c
  2. 2
      libavcodec/mjpegenc.c

@ -115,13 +115,13 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
for(x = 0; x < width; x++) {
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++) {

@ -216,7 +216,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
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_BGR0
|| avctx->pix_fmt == AV_PIX_FMT_BGRA
|| avctx->pix_fmt == AV_PIX_FMT_BGR24)) {
vsample[0] = hsample[0] =

Loading…
Cancel
Save