2 * Constants for DV codec
3 * Copyright (c) 2002 Fabrice Bellard
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * Constants for DV codec.
27 #ifndef AVCODEC_DVDATA_H
28 #define AVCODEC_DVDATA_H
30 #include "libavutil/rational.h"
33 typedef struct DVwork_chunk {
35 uint16_t mb_coordinates[5];
39 * DVprofile is used to express the differences between various
40 * DV flavors. For now it's primarily used for differentiating
41 * 525/60 and 625/50, but the plans are to use it for various
42 * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
44 typedef struct DVprofile {
45 int dsf; /* value of the dsf in the DV header */
46 int video_stype; /* stype for VAUX source pack */
47 int frame_size; /* total size of one frame in bytes */
48 int difseg_size; /* number of DIF segments per DIF channel */
49 int n_difchan; /* number of DIF channels per frame */
50 AVRational time_base; /* 1/framerate */
51 int ltc_divisor; /* FPS from the LTS standpoint */
52 int height; /* picture height in pixels */
53 int width; /* picture width in pixels */
54 AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
55 DVwork_chunk *work_chunks; /* each thread gets its own chunk of frame to work on */
56 uint32_t *idct_factor; /* set of iDCT factor tables */
57 enum PixelFormat pix_fmt; /* picture pixel format */
58 int bpm; /* blocks per macroblock */
59 const uint8_t *block_sizes; /* AC block sizes, in bits */
60 int audio_stride; /* size of audio_shuffle table */
61 int audio_min_samples[3]; /* min amount of audio samples */
62 /* for 48kHz, 44.1kHz and 32kHz */
63 int audio_samples_dist[5]; /* how many samples are supposed to be */
64 /* in each frame in a 5 frames window */
65 const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
68 enum dv_section_type {
69 dv_sect_header = 0x1f,
70 dv_sect_subcode = 0x3f,
77 dv_header525 = 0x3f, /* see dv_write_pack for important details on */
78 dv_header625 = 0xbf, /* these two packs */
80 dv_audio_source = 0x50,
81 dv_audio_control = 0x51,
82 dv_audio_recdate = 0x52,
83 dv_audio_rectime = 0x53,
84 dv_video_source = 0x60,
85 dv_video_control = 0x61,
86 dv_video_recdate = 0x62,
87 dv_video_rectime = 0x63,
88 dv_unknown_pack = 0xff,
91 #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
92 #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
93 #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1))
95 /* minimum number of bytes to read from a DV stream in order to
96 determine the profile */
97 #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */
100 * largest possible DV frame, in bytes (1080i50)
102 #define DV_MAX_FRAME_SIZE 576000
105 * maximum number of blocks per macroblock in any DV format
109 const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
110 const uint8_t* frame, unsigned buf_size);
111 const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys,
112 const uint8_t* frame, unsigned buf_size);
113 const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec);
115 #endif /* AVCODEC_DVDATA_H */