diff options
author | Kieran Kunhya <kieran@kunhya.com> | 2016-01-30 17:39:48 +0000 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2017-03-09 18:37:29 +0100 |
commit | 5f794aa1653aa04c1da7397e9ccacad947fadf5f (patch) | |
tree | ba72470c5a0dba26709381bdcbbee7c4c2b45f72 /libavcodec/cfhd.h | |
parent | f6790b5e1075133ee39be91105f1135db7afd259 (diff) | |
download | ffmpeg-5f794aa1653aa04c1da7397e9ccacad947fadf5f.tar.gz |
Add Cineform HD Decoder
Decodes YUV 4:2:2 10-bit and RGB 12-bit files.
Older files with more subbands, skips, Bayer, alpha not supported.
Further fixes and refactorings by Anton Khirnov <anton@khirnov.net>,
Diego Biurrun <diego@biurrun.de>, Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/cfhd.h')
-rw-r--r-- | libavcodec/cfhd.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/libavcodec/cfhd.h b/libavcodec/cfhd.h new file mode 100644 index 0000000000..c5da0b6ec7 --- /dev/null +++ b/libavcodec/cfhd.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2015 Kieran Kunhya + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * 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. + * + * Libav is distributed in the hope that it will be useful, + * 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 + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_CFHD_H +#define AVCODEC_CFHD_H + +#include <stdint.h> + +#include "avcodec.h" +#include "bitstream.h" + +#define VLC_BITS 9 +#define SUBBAND_COUNT 10 + +typedef struct CFHD_RL_VLC_ELEM { + int16_t level; + int8_t len; + uint16_t run; +} CFHD_RL_VLC_ELEM; + +#define DWT_LEVELS 3 + +typedef struct SubBand { + int level; + int orientation; + ptrdiff_t stride; + int a_width; + int width; + int a_height; + int height; + int pshift; + int quant; + uint8_t *ibuf; +} SubBand; + +typedef struct Plane { + int width; + int height; + ptrdiff_t stride; + + int16_t *idwt_buf; + int16_t *idwt_tmp; + + /* TODO: merge this into SubBand structure */ + int16_t *subband[SUBBAND_COUNT]; + int16_t *l_h[8]; + + SubBand band[DWT_LEVELS][4]; +} Plane; + +typedef struct CFHDContext { + AVCodecContext *avctx; + + CFHD_RL_VLC_ELEM table_9_rl_vlc[2088]; + VLC vlc_9; + + CFHD_RL_VLC_ELEM table_18_rl_vlc[4572]; + VLC vlc_18; + + BitstreamContext bc; + + int coded_width; + int coded_height; + int cropped_height; + enum AVPixelFormat coded_format; + + int a_width; + int a_height; + int a_format; + + int bpc; // bits per channel/component + int channel_cnt; + int subband_cnt; + int channel_num; + uint8_t lowpass_precision; + uint16_t quantisation; + int wavelet_depth; + int pshift; + + int codebook; + int subband_num; + int level; + int subband_num_actual; + + uint8_t prescale_shift[3]; + Plane plane[4]; +} CFHDContext; + +int ff_cfhd_init_vlcs(CFHDContext *s); + +#endif /* AVCODEC_CFHD_H */ |