mjpegenc.h 2.01 KB
Newer Older
1 2
/*
 * MJPEG encoder
3
 * Copyright (c) 2000, 2001 Fabrice Bellard
4 5 6
 * Copyright (c) 2003 Alex Beregszaszi
 * Copyright (c) 2003-2004 Michael Niedermayer
 *
7 8 9 10
 * Support for external huffman table, various fixes (AVID workaround),
 * aspecting, new decode_frame mechanism and apple mjpeg-b support
 *                                  by Alex Beregszaszi
 *
11
 * This file is part of Libav.
12
 *
13
 * Libav is free software; you can redistribute it and/or
14 15 16 17
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
18
 * Libav is distributed in the hope that it will be useful,
19 20 21 22 23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
24
 * License along with Libav; if not, write to the Free Software
25 26 27 28
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

/**
29
 * @file
30 31 32
 * MJPEG encoder.
 */

33 34
#ifndef AVCODEC_MJPEGENC_H
#define AVCODEC_MJPEGENC_H
35

Diego Biurrun's avatar
Diego Biurrun committed
36 37
#include <stdint.h>

38
#include "mjpeg.h"
39
#include "mpegvideo.h"
40
#include "put_bits.h"
41 42

typedef struct MJpegContext {
43
    uint8_t huff_size_dc_luminance[12]; //FIXME use array [3] instead of lumi / chroma, for easier addressing
44 45 46 47 48 49 50 51 52 53
    uint16_t huff_code_dc_luminance[12];
    uint8_t huff_size_dc_chrominance[12];
    uint16_t huff_code_dc_chrominance[12];

    uint8_t huff_size_ac_luminance[256];
    uint16_t huff_code_ac_luminance[256];
    uint8_t huff_size_ac_chrominance[256];
    uint16_t huff_code_ac_chrominance[256];
} MJpegContext;

54
static inline void put_marker(PutBitContext *p, enum JpegMarker code)
55 56 57 58 59
{
    put_bits(p, 8, 0xff);
    put_bits(p, 8, code);
}

60 61
int  ff_mjpeg_encode_init(MpegEncContext *s);
void ff_mjpeg_encode_close(MpegEncContext *s);
62
void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[8][64]);
63

64
#endif /* AVCODEC_MJPEGENC_H */