This is necessary to avoid target config settings bleeding into the host
compilation process with hardcoded tables and the DV VLC tables no longer
present as static tables in a header file.
53 | 54 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,118 @@ |
0 |
+/* |
|
1 |
+ * Constants for DV codec |
|
2 |
+ * Copyright (c) 2002 Fabrice Bellard |
|
3 |
+ * |
|
4 |
+ * This file is part of Libav. |
|
5 |
+ * |
|
6 |
+ * Libav is free software; you can redistribute it and/or |
|
7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
8 |
+ * License as published by the Free Software Foundation; either |
|
9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
10 |
+ * |
|
11 |
+ * Libav is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
+ * Lesser General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
17 |
+ * License along with Libav; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
+ */ |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * @file |
|
23 |
+ * Constants for DV codec. |
|
24 |
+ */ |
|
25 |
+ |
|
26 |
+#ifndef AVCODEC_DV_H |
|
27 |
+#define AVCODEC_DV_H |
|
28 |
+ |
|
29 |
+#include "avcodec.h" |
|
30 |
+#include "dsputil.h" |
|
31 |
+#include "get_bits.h" |
|
32 |
+#include "dv_profile.h" |
|
33 |
+ |
|
34 |
+typedef struct DVVideoContext { |
|
35 |
+ const DVprofile *sys; |
|
36 |
+ AVFrame picture; |
|
37 |
+ AVCodecContext *avctx; |
|
38 |
+ uint8_t *buf; |
|
39 |
+ |
|
40 |
+ uint8_t dv_zigzag[2][64]; |
|
41 |
+ |
|
42 |
+ void (*get_pixels)(int16_t *block, const uint8_t *pixels, int line_size); |
|
43 |
+ void (*fdct[2])(int16_t *block); |
|
44 |
+ void (*idct_put[2])(uint8_t *dest, int line_size, int16_t *block); |
|
45 |
+ me_cmp_func ildct_cmp; |
|
46 |
+} DVVideoContext; |
|
47 |
+ |
|
48 |
+enum dv_section_type { |
|
49 |
+ dv_sect_header = 0x1f, |
|
50 |
+ dv_sect_subcode = 0x3f, |
|
51 |
+ dv_sect_vaux = 0x56, |
|
52 |
+ dv_sect_audio = 0x76, |
|
53 |
+ dv_sect_video = 0x96, |
|
54 |
+}; |
|
55 |
+ |
|
56 |
+enum dv_pack_type { |
|
57 |
+ dv_header525 = 0x3f, /* see dv_write_pack for important details on */ |
|
58 |
+ dv_header625 = 0xbf, /* these two packs */ |
|
59 |
+ dv_timecode = 0x13, |
|
60 |
+ dv_audio_source = 0x50, |
|
61 |
+ dv_audio_control = 0x51, |
|
62 |
+ dv_audio_recdate = 0x52, |
|
63 |
+ dv_audio_rectime = 0x53, |
|
64 |
+ dv_video_source = 0x60, |
|
65 |
+ dv_video_control = 0x61, |
|
66 |
+ dv_video_recdate = 0x62, |
|
67 |
+ dv_video_rectime = 0x63, |
|
68 |
+ dv_unknown_pack = 0xff, |
|
69 |
+}; |
|
70 |
+ |
|
71 |
+#define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10) |
|
72 |
+#define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1)) |
|
73 |
+#define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1)) |
|
74 |
+ |
|
75 |
+/* minimum number of bytes to read from a DV stream in order to |
|
76 |
+ determine the profile */ |
|
77 |
+#define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */ |
|
78 |
+ |
|
79 |
+/** |
|
80 |
+ * largest possible DV frame, in bytes (1080i50) |
|
81 |
+ */ |
|
82 |
+#define DV_MAX_FRAME_SIZE 576000 |
|
83 |
+ |
|
84 |
+/** |
|
85 |
+ * maximum number of blocks per macroblock in any DV format |
|
86 |
+ */ |
|
87 |
+#define DV_MAX_BPM 8 |
|
88 |
+ |
|
89 |
+#define TEX_VLC_BITS 9 |
|
90 |
+ |
|
91 |
+extern RL_VLC_ELEM ff_dv_rl_vlc[1184]; |
|
92 |
+ |
|
93 |
+int ff_dv_init_dynamic_tables(const DVprofile *d); |
|
94 |
+int ff_dvvideo_init(AVCodecContext *avctx); |
|
95 |
+ |
|
96 |
+static inline int dv_work_pool_size(const DVprofile *d) |
|
97 |
+{ |
|
98 |
+ int size = d->n_difchan*d->difseg_size*27; |
|
99 |
+ if (DV_PROFILE_IS_1080i50(d)) |
|
100 |
+ size -= 3*27; |
|
101 |
+ if (DV_PROFILE_IS_720p50(d)) |
|
102 |
+ size -= 4*27; |
|
103 |
+ return size; |
|
104 |
+} |
|
105 |
+ |
|
106 |
+static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y) |
|
107 |
+{ |
|
108 |
+ *mb_x = work_chunk->mb_coordinates[m] & 0xff; |
|
109 |
+ *mb_y = work_chunk->mb_coordinates[m] >> 8; |
|
110 |
+ |
|
111 |
+ /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */ |
|
112 |
+ if (s->sys->height == 720 && !(s->buf[1]&0x0C)) { |
|
113 |
+ *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */ |
|
114 |
+ } |
|
115 |
+} |
|
116 |
+ |
|
117 |
+#endif /* AVCODEC_DV_H */ |
... | ... |
@@ -1,7 +1,4 @@ |
1 | 1 |
/* |
2 |
- * Constants for DV codec |
|
3 |
- * Copyright (c) 2002 Fabrice Bellard |
|
4 |
- * |
|
5 | 2 |
* This file is part of Libav. |
6 | 3 |
* |
7 | 4 |
* Libav is free software; you can redistribute it and/or |
... | ... |
@@ -19,55 +16,10 @@ |
19 | 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 |
*/ |
21 | 21 |
|
22 |
-/** |
|
23 |
- * @file |
|
24 |
- * Constants for DV codec. |
|
25 |
- */ |
|
26 |
- |
|
27 | 22 |
#ifndef AVCODEC_DVDATA_H |
28 | 23 |
#define AVCODEC_DVDATA_H |
29 | 24 |
|
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; |
|
37 |
- AVFrame picture; |
|
38 |
- AVCodecContext *avctx; |
|
39 |
- uint8_t *buf; |
|
40 |
- |
|
41 |
- uint8_t dv_zigzag[2][64]; |
|
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); |
|
46 |
- me_cmp_func ildct_cmp; |
|
47 |
-} DVVideoContext; |
|
48 |
- |
|
49 |
-enum dv_section_type { |
|
50 |
- dv_sect_header = 0x1f, |
|
51 |
- dv_sect_subcode = 0x3f, |
|
52 |
- dv_sect_vaux = 0x56, |
|
53 |
- dv_sect_audio = 0x76, |
|
54 |
- dv_sect_video = 0x96, |
|
55 |
-}; |
|
56 |
- |
|
57 |
-enum dv_pack_type { |
|
58 |
- dv_header525 = 0x3f, /* see dv_write_pack for important details on */ |
|
59 |
- dv_header625 = 0xbf, /* these two packs */ |
|
60 |
- dv_timecode = 0x13, |
|
61 |
- dv_audio_source = 0x50, |
|
62 |
- dv_audio_control = 0x51, |
|
63 |
- dv_audio_recdate = 0x52, |
|
64 |
- dv_audio_rectime = 0x53, |
|
65 |
- dv_video_source = 0x60, |
|
66 |
- dv_video_control = 0x61, |
|
67 |
- dv_video_recdate = 0x62, |
|
68 |
- dv_video_rectime = 0x63, |
|
69 |
- dv_unknown_pack = 0xff, |
|
70 |
-}; |
|
25 |
+#include <stdint.h> |
|
71 | 26 |
|
72 | 27 |
extern const uint8_t ff_dv_quant_shifts[22][4]; |
73 | 28 |
extern const uint8_t ff_dv_quant_offset[4]; |
... | ... |
@@ -79,50 +31,4 @@ extern const int ff_dv_iweight_1080_c[64]; |
79 | 79 |
extern const int ff_dv_iweight_720_y[64]; |
80 | 80 |
extern const int ff_dv_iweight_720_c[64]; |
81 | 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 |
- |
|
90 |
-/** |
|
91 |
- * largest possible DV frame, in bytes (1080i50) |
|
92 |
- */ |
|
93 |
-#define DV_MAX_FRAME_SIZE 576000 |
|
94 |
- |
|
95 |
-/** |
|
96 |
- * maximum number of blocks per macroblock in any DV format |
|
97 |
- */ |
|
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 |
- |
|
104 |
-int ff_dv_init_dynamic_tables(const DVprofile *d); |
|
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 | 82 |
#endif /* AVCODEC_DVDATA_H */ |
... | ... |
@@ -32,7 +32,7 @@ |
32 | 32 |
#include "avformat.h" |
33 | 33 |
#include "internal.h" |
34 | 34 |
#include "libavcodec/dv_profile.h" |
35 |
-#include "libavcodec/dvdata.h" |
|
35 |
+#include "libavcodec/dv.h" |
|
36 | 36 |
#include "libavutil/channel_layout.h" |
37 | 37 |
#include "libavutil/intreadwrite.h" |
38 | 38 |
#include "libavutil/mathematics.h" |