00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00029 #ifndef AVCODEC_MJPEGDEC_H
00030 #define AVCODEC_MJPEGDEC_H
00031
00032 #include "libavutil/log.h"
00033
00034 #include "avcodec.h"
00035 #include "get_bits.h"
00036 #include "dsputil.h"
00037
00038 #define MAX_COMPONENTS 4
00039
00040 typedef struct MJpegDecodeContext {
00041 AVClass *class;
00042 AVCodecContext *avctx;
00043 GetBitContext gb;
00044
00045 int start_code;
00046 int buffer_size;
00047 uint8_t *buffer;
00048
00049 int16_t quant_matrixes[4][64];
00050 VLC vlcs[3][4];
00051 int qscale[4];
00052
00053 int org_height;
00054 int first_picture;
00055 int interlaced;
00056 int bottom_field;
00057 int lossless;
00058 int ls;
00059 int progressive;
00060 int rgb;
00061 int upscale_h;
00062 int chroma_height;
00063 int upscale_v;
00064 int rct;
00065 int pegasus_rct;
00066 int bits;
00067
00068 int maxval;
00069 int near;
00070 int t1,t2,t3;
00071 int reset;
00072
00073 int width, height;
00074 int mb_width, mb_height;
00075 int nb_components;
00076 int block_stride[MAX_COMPONENTS];
00077 int component_id[MAX_COMPONENTS];
00078 int h_count[MAX_COMPONENTS];
00079 int v_count[MAX_COMPONENTS];
00080 int comp_index[MAX_COMPONENTS];
00081 int dc_index[MAX_COMPONENTS];
00082 int ac_index[MAX_COMPONENTS];
00083 int nb_blocks[MAX_COMPONENTS];
00084 int h_scount[MAX_COMPONENTS];
00085 int v_scount[MAX_COMPONENTS];
00086 int h_max, v_max;
00087 int quant_index[4];
00088 int last_dc[MAX_COMPONENTS];
00089 AVFrame picture;
00090 AVFrame *picture_ptr;
00091 int got_picture;
00092 int linesize[MAX_COMPONENTS];
00093 int8_t *qscale_table;
00094 DECLARE_ALIGNED(16, DCTELEM, block)[64];
00095 DCTELEM (*blocks[MAX_COMPONENTS])[64];
00096 uint8_t *last_nnz[MAX_COMPONENTS];
00097 uint64_t coefs_finished[MAX_COMPONENTS];
00098 ScanTable scantable;
00099 DSPContext dsp;
00100
00101 int restart_interval;
00102 int restart_count;
00103
00104 int buggy_avid;
00105 int cs_itu601;
00106 int interlace_polarity;
00107
00108 int mjpb_skiptosod;
00109
00110 int cur_scan;
00111 int flipped;
00112
00113 uint16_t (*ljpeg_buffer)[4];
00114 unsigned int ljpeg_buffer_size;
00115
00116 int extern_huff;
00117 } MJpegDecodeContext;
00118
00119 int ff_mjpeg_decode_init(AVCodecContext *avctx);
00120 int ff_mjpeg_decode_end(AVCodecContext *avctx);
00121 int ff_mjpeg_decode_frame(AVCodecContext *avctx,
00122 void *data, int *data_size,
00123 AVPacket *avpkt);
00124 int ff_mjpeg_decode_dqt(MJpegDecodeContext *s);
00125 int ff_mjpeg_decode_dht(MJpegDecodeContext *s);
00126 int ff_mjpeg_decode_sof(MJpegDecodeContext *s);
00127 int ff_mjpeg_decode_sos(MJpegDecodeContext *s,
00128 const uint8_t *mb_bitmask, const AVFrame *reference);
00129 int ff_mjpeg_find_marker(MJpegDecodeContext *s,
00130 const uint8_t **buf_ptr, const uint8_t *buf_end,
00131 const uint8_t **unescaped_buf_ptr, int *unescaped_buf_size);
00132
00133 #endif