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