dvdata.h
Go to the documentation of this file.
1 /*
2  * Constants for DV codec
3  * Copyright (c) 2002 Fabrice Bellard
4  *
5  * This file is part of Libav.
6  *
7  * Libav 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.
11  *
12  * Libav 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.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
27 #ifndef AVCODEC_DVDATA_H
28 #define AVCODEC_DVDATA_H
29 
30 #include "avcodec.h"
31 #include "dsputil.h"
32 #include "get_bits.h"
33 #include "dv_profile.h"
34 
35 typedef struct DVVideoContext {
36  const DVprofile *sys;
40 
42 
43  void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
45  void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
48 
52  dv_sect_vaux = 0x56,
53  dv_sect_audio = 0x76,
54  dv_sect_video = 0x96,
55 };
56 
58  dv_header525 = 0x3f, /* see dv_write_pack for important details on */
59  dv_header625 = 0xbf, /* these two packs */
60  dv_timecode = 0x13,
70 };
71 
72 extern const uint8_t ff_dv_quant_shifts[22][4];
73 extern const uint8_t ff_dv_quant_offset[4];
74 
75 extern const int ff_dv_iweight_88[64];
76 extern const int ff_dv_iweight_248[64];
77 extern const int ff_dv_iweight_1080_y[64];
78 extern const int ff_dv_iweight_1080_c[64];
79 extern const int ff_dv_iweight_720_y[64];
80 extern const int ff_dv_iweight_720_c[64];
81 
82 #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
83 #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
84 #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1))
85 
86 /* minimum number of bytes to read from a DV stream in order to
87  determine the profile */
88 #define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */
89 
93 #define DV_MAX_FRAME_SIZE 576000
94 
98 #define DV_MAX_BPM 8
99 
100 #define TEX_VLC_BITS 9
101 
102 extern RL_VLC_ELEM ff_dv_rl_vlc[1184];
103 
105 int ff_dvvideo_init(AVCodecContext *avctx);
106 
107 static inline int dv_work_pool_size(const DVprofile *d)
108 {
109  int size = d->n_difchan*d->difseg_size*27;
110  if (DV_PROFILE_IS_1080i50(d))
111  size -= 3*27;
112  if (DV_PROFILE_IS_720p50(d))
113  size -= 4*27;
114  return size;
115 }
116 
117 static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
118 {
119  *mb_x = work_chunk->mb_coordinates[m] & 0xff;
120  *mb_y = work_chunk->mb_coordinates[m] >> 8;
121 
122  /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */
123  if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
124  *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */
125  }
126 }
127 
128 #endif /* AVCODEC_DVDATA_H */
const uint8_t ff_dv_quant_offset[4]
Definition: dvdata.c:56
int size
This structure describes decoded (raw) audio or video data.
Definition: avcodec.h:989
const int ff_dv_iweight_720_c[64]
Definition: dvdata.c:112
int(* me_cmp_func)(void *s, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
Definition: dsputil.h:176
struct DVVideoContext DVVideoContext
me_cmp_func ildct_cmp
Definition: dvdata.h:46
static void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
Definition: dvdata.h:117
int ff_dv_init_dynamic_tables(const DVprofile *d)
Definition: dv.c:178
dv_section_type
Definition: dvdata.h:49
const int ff_dv_iweight_248[64]
Definition: dvdata.c:68
uint8_t * buf
Definition: dvdata.h:39
#define DV_PROFILE_IS_720p50(p)
Definition: dvdata.h:84
AVCodecContext * avctx
Definition: dvdata.h:38
uint8_t
void(* get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size)
Definition: dvdata.h:43
bitstream reader API header.
static int dv_work_pool_size(const DVprofile *d)
Definition: dvdata.h:107
#define DV_PROFILE_IS_1080i50(p)
Definition: dvdata.h:83
uint16_t mb_coordinates[5]
Definition: dv_profile.h:30
void(* idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block)
Definition: dvdata.h:45
int height
Definition: dv_profile.h:47
int n_difchan
Definition: dv_profile.h:44
int difseg_size
Definition: dv_profile.h:43
const DVprofile * sys
Definition: dvdata.h:36
const int ff_dv_iweight_88[64]
Definition: dvdata.c:58
AVFrame picture
Definition: dvdata.h:37
static DCTELEM block[64]
Definition: dct-test.c:169
dv_pack_type
Definition: dvdata.h:57
RL_VLC_ELEM ff_dv_rl_vlc[1184]
Definition: dv.c:52
const int ff_dv_iweight_720_y[64]
Definition: dvdata.c:102
external API header
main external API structure.
Definition: avcodec.h:1339
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
void(* fdct[2])(DCTELEM *block)
Definition: dvdata.h:44
uint8_t dv_zigzag[2][64]
Definition: dvdata.h:41
const int ff_dv_iweight_1080_y[64]
The "inverse" DV100 weights are actually just the spec weights (zig-zagged).
Definition: dvdata.c:82
int ff_dvvideo_init(AVCodecContext *avctx)
Definition: dv.c:239
short DCTELEM
Definition: dsputil.h:39
const int ff_dv_iweight_1080_c[64]
Definition: dvdata.c:92
DSP utils.
const uint8_t ff_dv_quant_shifts[22][4]
Definition: dvdata.c:31