Path: blob/master/dep/ffmpeg/include/libavcodec/dirac.h
4216 views
/*1* Copyright (C) 2007 Marco Gerards <[email protected]>2* Copyright (C) 2009 David Conrad3* Copyright (C) 2011 Jordi Ortiz4*5* This file is part of FFmpeg.6*7* FFmpeg is free software; you can redistribute it and/or8* modify it under the terms of the GNU Lesser General Public9* License as published by the Free Software Foundation; either10* version 2.1 of the License, or (at your option) any later version.11*12* FFmpeg is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15* Lesser General Public License for more details.16*17* You should have received a copy of the GNU Lesser General Public18* License along with FFmpeg; if not, write to the Free Software19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20*/2122#ifndef AVCODEC_DIRAC_H23#define AVCODEC_DIRAC_H2425/**26* @file27* Interface to Dirac Decoder/Encoder28* @author Marco Gerards <[email protected]>29* @author David Conrad30* @author Jordi Ortiz31*/3233#include <stddef.h>34#include <stdint.h>3536#include "libavutil/pixfmt.h"37#include "libavutil/rational.h"3839/**40* The spec limits the number of wavelet decompositions to 4 for both41* level 1 (VC-2) and 128 (long-gop default).42* 5 decompositions is the maximum before >16-bit buffers are needed.43* Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting44* the others to 4 decompositions (or 3 for the fidelity filter).45*46* We use this instead of MAX_DECOMPOSITIONS to save some memory.47*/48#define MAX_DWT_LEVELS 54950/**51* Parse code values:52*53* Dirac Specification ->54* 9.6.1 Table 9.155*56* VC-2 Specification ->57* 10.4.1 Table 10.158*/5960enum DiracParseCodes {61DIRAC_PCODE_SEQ_HEADER = 0x00,62DIRAC_PCODE_END_SEQ = 0x10,63DIRAC_PCODE_AUX = 0x20,64DIRAC_PCODE_PAD = 0x30,65DIRAC_PCODE_PICTURE_CODED = 0x08,66DIRAC_PCODE_PICTURE_RAW = 0x48,67DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8,68DIRAC_PCODE_PICTURE_HQ = 0xE8,69DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A,70DIRAC_PCODE_INTER_NOREF_CO2 = 0x09,71DIRAC_PCODE_INTER_REF_CO1 = 0x0D,72DIRAC_PCODE_INTER_REF_CO2 = 0x0E,73DIRAC_PCODE_INTRA_REF_CO = 0x0C,74DIRAC_PCODE_INTRA_REF_RAW = 0x4C,75DIRAC_PCODE_INTRA_REF_PICT = 0xCC,76DIRAC_PCODE_MAGIC = 0x42424344,77};7879typedef struct DiracVersionInfo {80int major;81int minor;82} DiracVersionInfo;8384typedef struct AVDiracSeqHeader {85unsigned width;86unsigned height;87uint8_t chroma_format; ///< 0: 444 1: 422 2: 4208889uint8_t interlaced;90uint8_t top_field_first;9192uint8_t frame_rate_index; ///< index into dirac_frame_rate[]93uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[]9495uint16_t clean_width;96uint16_t clean_height;97uint16_t clean_left_offset;98uint16_t clean_right_offset;99100uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[]101uint8_t color_spec_index; ///< index into dirac_color_spec_presets[]102103int profile;104int level;105106AVRational framerate;107AVRational sample_aspect_ratio;108109enum AVPixelFormat pix_fmt;110enum AVColorRange color_range;111enum AVColorPrimaries color_primaries;112enum AVColorTransferCharacteristic color_trc;113enum AVColorSpace colorspace;114115DiracVersionInfo version;116int bit_depth;117} AVDiracSeqHeader;118119/**120* Parse a Dirac sequence header.121*122* @param dsh this function will allocate and fill an AVDiracSeqHeader struct123* and write it into this pointer. The caller must free it with124* av_free().125* @param buf the data buffer126* @param buf_size the size of the data buffer in bytes127* @param log_ctx if non-NULL, this function will log errors here128* @return 0 on success, a negative AVERROR code on failure129*/130int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh,131const uint8_t *buf, size_t buf_size,132void *log_ctx);133134#endif /* AVCODEC_DIRAC_H */135136137