FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dv.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 FFmpeg.
6  *
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.
11  *
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.
16  *
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
20  */
21 
22 /**
23  * @file
24  * Constants for DV codec.
25  */
26 
27 #ifndef AVCODEC_DV_H
28 #define AVCODEC_DV_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)(int16_t *block, const uint8_t *pixels, int line_size);
44  void (*fdct[2])(int16_t *block);
45  void (*idct_put[2])(uint8_t *dest, int line_size, int16_t *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 #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
73 #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
74 #define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1))
75 
76 
77 /**
78  * largest possible DV frame, in bytes (1080i50)
79  */
80 #define DV_MAX_FRAME_SIZE 576000
81 
82 /**
83  * maximum number of blocks per macroblock in any DV format
84  */
85 #define DV_MAX_BPM 8
86 
87 #define TEX_VLC_BITS 9
88 
89 extern RL_VLC_ELEM ff_dv_rl_vlc[1184];
90 
93 
94 static inline int dv_work_pool_size(const DVprofile *d)
95 {
96  int size = d->n_difchan*d->difseg_size*27;
97  if (DV_PROFILE_IS_1080i50(d))
98  size -= 3*27;
99  if (DV_PROFILE_IS_720p50(d))
100  size -= 4*27;
101  return size;
102 }
103 
104 static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
105 {
106  *mb_x = work_chunk->mb_coordinates[m] & 0xff;
107  *mb_y = work_chunk->mb_coordinates[m] >> 8;
108 
109  /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */
110  if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
111  *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */
112  }
113 }
114 
115 #endif /* AVCODEC_DV_H */