Add function to compute ceil(log2(x)).
[FFMpeg-mirror/lagarith.git] / libavcodec / mjpegenc.h
blob7a861b84c4fe9d2072f7aac516d0d07c65f2e52e
1 /*
2 * MJPEG encoder
3 * Copyright (c) 2000, 2001 Fabrice Bellard
4 * Copyright (c) 2003 Alex Beregszaszi
5 * Copyright (c) 2003-2004 Michael Niedermayer
7 * Support for external huffman table, various fixes (AVID workaround),
8 * aspecting, new decode_frame mechanism and apple mjpeg-b support
9 * by Alex Beregszaszi
11 * This file is part of FFmpeg.
13 * FFmpeg is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
18 * FFmpeg is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with FFmpeg; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 /**
29 * @file libavcodec/mjpegenc.h
30 * MJPEG encoder.
33 #ifndef AVCODEC_MJPEGENC_H
34 #define AVCODEC_MJPEGENC_H
36 #include "dsputil.h"
37 #include "mpegvideo.h"
39 typedef struct MJpegContext {
40 uint8_t huff_size_dc_luminance[12]; //FIXME use array [3] instead of lumi / chrom, for easier addressing
41 uint16_t huff_code_dc_luminance[12];
42 uint8_t huff_size_dc_chrominance[12];
43 uint16_t huff_code_dc_chrominance[12];
45 uint8_t huff_size_ac_luminance[256];
46 uint16_t huff_code_ac_luminance[256];
47 uint8_t huff_size_ac_chrominance[256];
48 uint16_t huff_code_ac_chrominance[256];
49 } MJpegContext;
51 int ff_mjpeg_encode_init(MpegEncContext *s);
52 void ff_mjpeg_encode_close(MpegEncContext *s);
53 void ff_mjpeg_encode_picture_header(MpegEncContext *s);
54 void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
55 void ff_mjpeg_encode_stuffing(PutBitContext *pbc);
56 void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
57 uint8_t *huff_size, uint16_t *huff_code);
58 void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]);
60 #endif /* AVCODEC_MJPEGENC_H */