Commit 5f794aa1 authored by Kieran Kunhya's avatar Kieran Kunhya Committed by Luca Barbato

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: 's avatarDiego Biurrun <diego@biurrun.de>
parent f6790b5e
......@@ -11,6 +11,7 @@ version <next>:
- Apple Pixlet decoder
- The x86 assembler default switched from yasm to nasm, pass
--x86asmexe=yasm to configure to restore the old behavior.
- Cineform HD decoder
version 12:
......
......@@ -626,6 +626,7 @@ following image formats are supported:
@tab Amiga CD video codec
@item Chinese AVS video @tab E @tab X
@tab AVS1-P2, JiZhun profile, encoding through external library libxavs
@item Cineform HD @tab @tab X
@item Delphine Software International CIN video @tab @tab X
@tab Codec used in Delphine Software International games.
@item Discworld II BMV Video @tab @tab X
......
......@@ -180,6 +180,7 @@ OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \
cavsdata.o mpeg12data.o
OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o
OBJS-$(CONFIG_CDXL_DECODER) += cdxl.o
OBJS-$(CONFIG_CFHD_DECODER) += cfhd.o cfhddata.o
OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
OBJS-$(CONFIG_CLJR_DECODER) += cljrdec.o
OBJS-$(CONFIG_CLJR_ENCODER) += cljrenc.o
......
......@@ -127,6 +127,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(CAVS, cavs);
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_DECODER(CINEPAK, cinepak);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
......
......@@ -415,6 +415,7 @@ enum AVCodecID {
AV_CODEC_ID_TRUEMOTION2RT,
AV_CODEC_ID_AV1,
AV_CODEC_ID_PIXLET,
AV_CODEC_ID_CFHD,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
......
This diff is collapsed.
/*
* 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 */
This diff is collapsed.
......@@ -1428,6 +1428,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_CFHD,
.type = AVMEDIA_TYPE_VIDEO,
.name = "cfhd",
.long_name = NULL_IF_CONFIG_SMALL("Cineform HD"),
.props = AV_CODEC_PROP_LOSSY,
},
/* various PCM "codecs" */
{
......
......@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 35
#define LIBAVCODEC_VERSION_MINOR 36
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -368,6 +368,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_RSCC, MKTAG('I', 'S', 'C', 'C') },
{ AV_CODEC_ID_MAGICYUV, MKTAG('M', 'A', 'G', 'Y') },
{ AV_CODEC_ID_AV1, MKTAG('A', 'V', '0', '1') },
{ AV_CODEC_ID_CFHD, MKTAG('C', 'F', 'H', 'D') },
{ AV_CODEC_ID_NONE, 0 }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment