• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/mjpegdec.h

Go to the documentation of this file.
00001 /*
00002  * MJPEG decoder
00003  * Copyright (c) 2000, 2001 Fabrice Bellard
00004  * Copyright (c) 2003 Alex Beregszaszi
00005  * Copyright (c) 2003-2004 Michael Niedermayer
00006  *
00007  * This file is part of Libav.
00008  *
00009  * Libav is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * Libav is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with Libav; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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; /* current 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;  /* size given at codec init */
00054     int first_picture;    /* true if decoding first picture */
00055     int interlaced;     /* true if interlaced */
00056     int bottom_field;   /* true if bottom field */
00057     int lossless;
00058     int ls;
00059     int progressive;
00060     int rgb;
00061     int rct;            /* standard rct */
00062     int pegasus_rct;    /* pegasus reversible colorspace transform */
00063     int bits;           /* bits per component */
00064 
00065     int maxval;
00066     int near;         
00067     int t1,t2,t3;
00068     int reset;        
00069 
00070     int width, height;
00071     int mb_width, mb_height;
00072     int nb_components;
00073     int block_stride[MAX_COMPONENTS];
00074     int component_id[MAX_COMPONENTS];
00075     int h_count[MAX_COMPONENTS]; /* horizontal and vertical count for each component */
00076     int v_count[MAX_COMPONENTS];
00077     int comp_index[MAX_COMPONENTS];
00078     int dc_index[MAX_COMPONENTS];
00079     int ac_index[MAX_COMPONENTS];
00080     int nb_blocks[MAX_COMPONENTS];
00081     int h_scount[MAX_COMPONENTS];
00082     int v_scount[MAX_COMPONENTS];
00083     int h_max, v_max; /* maximum h and v counts */
00084     int quant_index[4];   /* quant table index for each component */
00085     int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
00086     AVFrame picture; /* picture structure */
00087     AVFrame *picture_ptr; /* pointer to picture structure */
00088     int got_picture;                                
00089     int linesize[MAX_COMPONENTS];                   
00090     int8_t *qscale_table;
00091     DECLARE_ALIGNED(16, DCTELEM, block)[64];
00092     DCTELEM (*blocks[MAX_COMPONENTS])[64]; 
00093     uint8_t *last_nnz[MAX_COMPONENTS];
00094     uint64_t coefs_finished[MAX_COMPONENTS]; 
00095     ScanTable scantable;
00096     DSPContext dsp;
00097 
00098     int restart_interval;
00099     int restart_count;
00100 
00101     int buggy_avid;
00102     int cs_itu601;
00103     int interlace_polarity;
00104 
00105     int mjpb_skiptosod;
00106 
00107     int cur_scan; /* current scan, used by JPEG-LS */
00108     int flipped; /* true if picture is flipped */
00109 
00110     uint16_t (*ljpeg_buffer)[4];
00111     unsigned int ljpeg_buffer_size;
00112 
00113     int extern_huff;
00114 } MJpegDecodeContext;
00115 
00116 int ff_mjpeg_decode_init(AVCodecContext *avctx);
00117 int ff_mjpeg_decode_end(AVCodecContext *avctx);
00118 int ff_mjpeg_decode_frame(AVCodecContext *avctx,
00119                           void *data, int *data_size,
00120                           AVPacket *avpkt);
00121 int ff_mjpeg_decode_dqt(MJpegDecodeContext *s);
00122 int ff_mjpeg_decode_dht(MJpegDecodeContext *s);
00123 int ff_mjpeg_decode_sof(MJpegDecodeContext *s);
00124 int ff_mjpeg_decode_sos(MJpegDecodeContext *s,
00125                         const uint8_t *mb_bitmask, const AVFrame *reference);
00126 int ff_mjpeg_find_marker(MJpegDecodeContext *s,
00127                          const uint8_t **buf_ptr, const uint8_t *buf_end,
00128                          const uint8_t **unescaped_buf_ptr, int *unescaped_buf_size);
00129 
00130 #endif /* AVCODEC_MJPEGDEC_H */
Generated on Sat Mar 17 2012 12:57:46 for Libav by doxygen 1.7.1