add a proper prefix to all mjpeg encoder exported functions

Originally committed as revision 9058 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Aurelien Jacobs 18 years ago
parent d9c9259f89
commit 44301eaa55
  1. 16
      libavcodec/ljpegenc.c
  2. 23
      libavcodec/mjpegenc.c
  3. 16
      libavcodec/mjpegenc.h
  4. 13
      libavcodec/mpegvideo.c

@ -52,7 +52,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
p->pict_type= FF_I_TYPE;
p->key_frame= 1;
mjpeg_picture_header(s);
ff_mjpeg_encode_picture_header(s);
s->header_bits= put_bits_count(&s->pb);
@ -96,9 +96,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
diff= ((left[i] - pred + 0x100)&0x1FF) - 0x100;
if(i==0)
mjpeg_encode_dc(s, diff, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
ff_mjpeg_encode_dc(s, diff, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
else
mjpeg_encode_dc(s, diff, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
ff_mjpeg_encode_dc(s, diff, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
}
}
}
@ -141,9 +141,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
}
if(i==0)
mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
ff_mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
else
mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
ff_mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
}
}
}
@ -164,9 +164,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
if(i==0)
mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
ff_mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
else
mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
ff_mjpeg_encode_dc(s, (int8_t)(*ptr - pred), m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
}
}
}
@ -177,7 +177,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
emms_c();
mjpeg_picture_trailer(s);
ff_mjpeg_encode_picture_trailer(s);
s->picture_number++;
flush_put_bits(&s->pb);

@ -44,7 +44,7 @@
#undef TWOMATRIXES
int mjpeg_init(MpegEncContext *s)
int ff_mjpeg_encode_init(MpegEncContext *s)
{
MJpegContext *m;
@ -77,7 +77,7 @@ int mjpeg_init(MpegEncContext *s)
return 0;
}
void mjpeg_close(MpegEncContext *s)
void ff_mjpeg_encode_close(MpegEncContext *s)
{
av_free(s->mjpeg_ctx);
}
@ -197,7 +197,7 @@ static void jpeg_put_comments(MpegEncContext *s)
}
}
void mjpeg_picture_header(MpegEncContext *s)
void ff_mjpeg_encode_picture_header(MpegEncContext *s)
{
const int lossless= s->avctx->codec_id != CODEC_ID_MJPEG;
@ -335,16 +335,16 @@ static void escape_FF(MpegEncContext *s, int start)
}
}
void ff_mjpeg_stuffing(PutBitContext * pbc)
void ff_mjpeg_encode_stuffing(PutBitContext * pbc)
{
int length;
length= (-put_bits_count(pbc))&7;
if(length) put_bits(pbc, length, (1<<length)-1);
}
void mjpeg_picture_trailer(MpegEncContext *s)
void ff_mjpeg_encode_picture_trailer(MpegEncContext *s)
{
ff_mjpeg_stuffing(&s->pb);
ff_mjpeg_encode_stuffing(&s->pb);
flush_put_bits(&s->pb);
assert((s->header_bits&7)==0);
@ -354,8 +354,8 @@ void mjpeg_picture_trailer(MpegEncContext *s)
put_marker(&s->pb, EOI);
}
void mjpeg_encode_dc(MpegEncContext *s, int val,
uint8_t *huff_size, uint16_t *huff_code)
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
uint8_t *huff_size, uint16_t *huff_code)
{
int mant, nbits;
@ -389,11 +389,11 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
dc = block[0]; /* overflow is impossible */
val = dc - s->last_dc[component];
if (n < 4) {
mjpeg_encode_dc(s, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance);
ff_mjpeg_encode_dc(s, 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 {
mjpeg_encode_dc(s, val, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
ff_mjpeg_encode_dc(s, 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;
}
@ -434,8 +434,7 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]);
}
void mjpeg_encode_mb(MpegEncContext *s,
DCTELEM block[6][64])
void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64])
{
int i;
for(i=0;i<5;i++) {

@ -48,13 +48,13 @@ typedef struct MJpegContext {
uint16_t huff_code_ac_chrominance[256];
} MJpegContext;
int mjpeg_init(MpegEncContext *s);
void mjpeg_close(MpegEncContext *s);
void mjpeg_picture_header(MpegEncContext *s);
void mjpeg_picture_trailer(MpegEncContext *s);
void ff_mjpeg_stuffing(PutBitContext *pbc);
void mjpeg_encode_dc(MpegEncContext *s, int val,
uint8_t *huff_size, uint16_t *huff_code);
void mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]);
int ff_mjpeg_encode_init(MpegEncContext *s);
void ff_mjpeg_encode_close(MpegEncContext *s);
void ff_mjpeg_encode_picture_header(MpegEncContext *s);
void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
void ff_mjpeg_encode_stuffing(PutBitContext *pbc);
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
uint8_t *huff_size, uint16_t *huff_code);
void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]);
#endif /* MJPEGENC_H */

@ -1204,7 +1204,8 @@ int MPV_encode_init(AVCodecContext *avctx)
s->mjpeg_hsample[0] = 2;
s->mjpeg_hsample[1] = 2>>chroma_h_shift;
s->mjpeg_hsample[2] = 2>>chroma_h_shift;
if (!(ENABLE_MJPEG_ENCODER || ENABLE_LJPEG_ENCODER) || mjpeg_init(s) < 0)
if (!(ENABLE_MJPEG_ENCODER || ENABLE_LJPEG_ENCODER)
|| ff_mjpeg_encode_init(s) < 0)
return -1;
avctx->delay=0;
s->low_delay=1;
@ -1398,7 +1399,7 @@ int MPV_encode_end(AVCodecContext *avctx)
MPV_common_end(s);
if ((ENABLE_MJPEG_ENCODER || ENABLE_LJPEG_ENCODER) && s->out_format == FMT_MJPEG)
mjpeg_close(s);
ff_mjpeg_encode_close(s);
av_freep(&avctx->extradata);
@ -2544,7 +2545,7 @@ vbv_retry:
MPV_frame_end(s);
if (ENABLE_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
mjpeg_picture_trailer(s);
ff_mjpeg_encode_picture_trailer(s);
if(avctx->rc_buffer_size){
RateControlContext *rcc= &s->rc_context;
@ -4594,7 +4595,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x,
h263_encode_mb(s, s->block, motion_x, motion_y); break;
case CODEC_ID_MJPEG:
if (ENABLE_MJPEG_ENCODER)
mjpeg_encode_mb(s, s->block);
ff_mjpeg_encode_mb(s, s->block);
break;
default:
assert(0);
@ -4896,7 +4897,7 @@ static void write_slice_end(MpegEncContext *s){
ff_mpeg4_stuffing(&s->pb);
}else if(ENABLE_MJPEG_ENCODER && s->out_format == FMT_MJPEG){
ff_mjpeg_stuffing(&s->pb);
ff_mjpeg_encode_stuffing(&s->pb);
}
align_put_bits(&s->pb);
@ -5763,7 +5764,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
switch(s->out_format) {
case FMT_MJPEG:
if (ENABLE_MJPEG_ENCODER)
mjpeg_picture_header(s);
ff_mjpeg_encode_picture_header(s);
break;
case FMT_H261:
if (ENABLE_H261_ENCODER)

Loading…
Cancel
Save