libavcodec/huffyuv.h
2ca5ca29
 /*
7cf8918b
  * Copyright (c) 2002-2014 Michael Niedermayer <michaelni@gmx.at>
2ca5ca29
  *
  * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of
  * the algorithm used
  *
def18e54
  * This file is part of FFmpeg.
2ca5ca29
  *
def18e54
  * FFmpeg is free software; you can redistribute it and/or
2ca5ca29
  * 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.
  *
def18e54
  * FFmpeg is distributed in the hope that it will be useful,
2ca5ca29
  * 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
def18e54
  * License along with FFmpeg; if not, write to the Free Software
2ca5ca29
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
  * @file
  * huffyuv codec for libavcodec.
  */
 
 #ifndef AVCODEC_HUFFYUV_H
 #define AVCODEC_HUFFYUV_H
 
 #include <stdint.h>
 
 #include "avcodec.h"
c67b449b
 #include "bswapdsp.h"
2ca5ca29
 #include "get_bits.h"
0d439fbe
 #include "huffyuvdsp.h"
512f3ffe
 #include "huffyuvencdsp.h"
2ca5ca29
 #include "put_bits.h"
f70d7eb2
 #include "lossless_videodsp.h"
2ca5ca29
 
4ba85600
 #define VLC_BITS 12
2ca5ca29
 
53167ecf
 #define MAX_BITS 16
b53aab1a
 #define MAX_N (1<<MAX_BITS)
53167ecf
 #define MAX_VLC_N 16384
b53aab1a
 
2ca5ca29
 typedef enum Predictor {
     LEFT = 0,
     PLANE,
     MEDIAN,
 } Predictor;
 
 typedef struct HYuvContext {
14677807
     AVClass *class;
2ca5ca29
     AVCodecContext *avctx;
     Predictor predictor;
     GetBitContext gb;
     PutBitContext pb;
     int interlaced;
     int decorrelate;
     int bitstream_bpp;
     int version;
     int yuy2;                               //use yuy2 instead of 422P
     int bgr32;                              //use bgr32 instead of bgr24
27b1e63f
     int bps;
534a8947
     int n;                                  // 1<<bps
53167ecf
     int vlc_n;                              // number of vlc codes (FFMIN(1<<bps, MAX_VLC_N))
27b1e63f
     int alpha;
     int chroma;
     int yuv;
     int chroma_h_shift;
     int chroma_v_shift;
2ca5ca29
     int width, height;
     int flags;
     int context;
     int picture_number;
     int last_slice_end;
     uint8_t *temp[3];
b53aab1a
     uint16_t *temp16[3];                    ///< identical to temp but 16bit type
53167ecf
     uint64_t stats[4][MAX_VLC_N];
     uint8_t len[4][MAX_VLC_N];
     uint32_t bits[4][MAX_VLC_N];
2ca5ca29
     uint32_t pix_bgr_map[1<<VLC_BITS];
13f3092b
     VLC vlc[8];                             //Y,U,V,A,YY,YU,YV,AA
2ca5ca29
     uint8_t *bitstream_buffer;
     unsigned int bitstream_buffer_size;
c67b449b
     BswapDSPContext bdsp;
0d439fbe
     HuffYUVDSPContext hdsp;
512f3ffe
     HuffYUVEncDSPContext hencdsp;
f70d7eb2
     LLVidDSPContext llviddsp;
14677807
     int non_determ; // non-deterministic, multi-threaded encoder allowed
2ca5ca29
 } HYuvContext;
 
 void ff_huffyuv_common_init(AVCodecContext *s);
 void ff_huffyuv_common_end(HYuvContext *s);
 int  ff_huffyuv_alloc_temp(HYuvContext *s);
b53aab1a
 int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n);
2ca5ca29
 
 #endif /* AVCODEC_HUFFYUV_H */