mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '86eb2eaac629909d6ee4067c6f1e485a4e70473d'
* commit '86eb2eaac629909d6ee4067c6f1e485a4e70473d': mjpegenc: do not pass MpegEncContext to ff_mjpeg_encode_dc() Conflicts: libavcodec/mjpegenc.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
0f057ea3c5
@ -132,9 +132,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
|
||||
diff= ((left[i] - pred + 0x100)&0x1FF) - 0x100;
|
||||
|
||||
if(i==0)
|
||||
ff_mjpeg_encode_dc(s, diff, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
|
||||
ff_mjpeg_encode_dc(&s->pb, diff, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
|
||||
else
|
||||
ff_mjpeg_encode_dc(s, diff, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
ff_mjpeg_encode_dc(&s->pb, diff, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,9 +175,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
|
||||
}
|
||||
|
||||
if(i==0)
|
||||
ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
|
||||
ff_mjpeg_encode_dc(&s->pb, *ptr - pred, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
|
||||
else
|
||||
ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
ff_mjpeg_encode_dc(&s->pb, *ptr - pred, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,19 +187,19 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
|
||||
int x, y, h, v, linesize;
|
||||
h = s->mjpeg_hsample[i];
|
||||
v = s->mjpeg_vsample[i];
|
||||
linesize= p->linesize[i];
|
||||
linesize = pict->linesize[i];
|
||||
|
||||
for(y=0; y<v; y++){
|
||||
for(x=0; x<h; x++){
|
||||
int pred;
|
||||
|
||||
ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
ptr = pict->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
|
||||
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
|
||||
|
||||
if(i==0)
|
||||
ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
|
||||
ff_mjpeg_encode_dc(&s->pb, *ptr - pred, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
|
||||
else
|
||||
ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
ff_mjpeg_encode_dc(&s->pb, *ptr - pred, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -402,13 +402,13 @@ void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
|
||||
put_marker(pb, EOI);
|
||||
}
|
||||
|
||||
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
||||
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
||||
uint8_t *huff_size, uint16_t *huff_code)
|
||||
{
|
||||
int mant, nbits;
|
||||
|
||||
if (val == 0) {
|
||||
put_bits(&s->pb, huff_size[0], huff_code[0]);
|
||||
put_bits(pb, huff_size[0], huff_code[0]);
|
||||
} else {
|
||||
mant = val;
|
||||
if (val < 0) {
|
||||
@ -418,9 +418,9 @@ void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
||||
|
||||
nbits= av_log2_16bit(val) + 1;
|
||||
|
||||
put_bits(&s->pb, huff_size[nbits], huff_code[nbits]);
|
||||
put_bits(pb, huff_size[nbits], huff_code[nbits]);
|
||||
|
||||
put_sbits(&s->pb, nbits, mant);
|
||||
put_sbits(pb, nbits, mant);
|
||||
}
|
||||
}
|
||||
|
||||
@ -437,11 +437,11 @@ static void encode_block(MpegEncContext *s, int16_t *block, int n)
|
||||
dc = block[0]; /* overflow is impossible */
|
||||
val = dc - s->last_dc[component];
|
||||
if (n < 4) {
|
||||
ff_mjpeg_encode_dc(s, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance);
|
||||
ff_mjpeg_encode_dc(&s->pb, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance);
|
||||
huff_size_ac = m->huff_size_ac_luminance;
|
||||
huff_code_ac = m->huff_code_ac_luminance;
|
||||
} else {
|
||||
ff_mjpeg_encode_dc(s, val, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
ff_mjpeg_encode_dc(&s->pb, val, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
|
||||
huff_size_ac = m->huff_size_ac_chrominance;
|
||||
huff_code_ac = m->huff_code_ac_chrominance;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
||||
uint16_t intra_matrix[64]);
|
||||
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
||||
void ff_mjpeg_encode_dc(PutBitContext *pb, int val,
|
||||
uint8_t *huff_size, uint16_t *huff_code);
|
||||
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user