Mercurial > libavcodec.hg
annotate dv.c @ 2847:712c84b9d8ce libavcodec
optimizations
dc coeff rounding fix
class=3 num of bits fix
do interlaced check & idct only if CODEC_FLAG_INTERLACED_DCT
author | michael |
---|---|
date | Tue, 30 Aug 2005 20:03:19 +0000 |
parents | d9f4b93e81c5 |
children | c4311f623fd5 |
rev | line source |
---|---|
723 | 1 /* |
2 * DV decoder | |
3 * Copyright (c) 2002 Fabrice Bellard. | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
4 * Copyright (c) 2004 Roman Shaposhnik. |
723 | 5 * |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
6 * DV encoder |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
7 * Copyright (c) 2003 Roman Shaposhnik. |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
8 * |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
9 * Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
10 * of DV technical info. |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
11 * |
723 | 12 * This library is free software; you can redistribute it and/or |
13 * modify it under the terms of the GNU Lesser General Public | |
14 * License as published by the Free Software Foundation; either | |
15 * version 2 of the License, or (at your option) any later version. | |
16 * | |
17 * This library is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 * Lesser General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU Lesser General Public | |
23 * License along with this library; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 */ | |
1106 | 26 |
27 /** | |
28 * @file dv.c | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
29 * DV codec. |
1106 | 30 */ |
723 | 31 #include "avcodec.h" |
32 #include "dsputil.h" | |
33 #include "mpegvideo.h" | |
34 #include "simple_idct.h" | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
35 #include "dvdata.h" |
723 | 36 |
2847 | 37 //#undef NDEBUG |
38 //#include <assert.h> | |
39 | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
40 typedef struct DVVideoContext { |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
41 const DVprofile* sys; |
925 | 42 AVFrame picture; |
2847 | 43 AVCodecContext *avctx; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
44 uint8_t *buf; |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
45 |
1064 | 46 uint8_t dv_zigzag[2][64]; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
47 uint8_t dv_idct_shift[2][2][22][64]; |
1567 | 48 |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
49 void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size); |
1567 | 50 void (*fdct[2])(DCTELEM *block); |
51 void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block); | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
52 } DVVideoContext; |
723 | 53 |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
54 #define TEX_VLC_BITS 9 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
55 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
56 #ifdef DV_CODEC_TINY_TARGET |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
57 #define DV_VLC_MAP_RUN_SIZE 15 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
58 #define DV_VLC_MAP_LEV_SIZE 23 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
59 #else |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
60 #define DV_VLC_MAP_RUN_SIZE 64 |
2847 | 61 #define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
62 #endif |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
63 |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
64 /* MultiThreading */ |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
65 static uint8_t** dv_anchor; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
66 |
723 | 67 /* XXX: also include quantization */ |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
68 static RL_VLC_ELEM *dv_rl_vlc; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
69 /* VLC encoding lookup table */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
70 static struct dv_vlc_pair { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
71 uint32_t vlc; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
72 uint8_t size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
73 } (*dv_vlc_map)[DV_VLC_MAP_LEV_SIZE] = NULL; |
723 | 74 |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
75 static void dv_build_unquantize_tables(DVVideoContext *s, uint8_t* perm) |
723 | 76 { |
725 | 77 int i, q, j; |
723 | 78 |
79 /* NOTE: max left shift is 6 */ | |
725 | 80 for(q = 0; q < 22; q++) { |
1567 | 81 /* 88DCT */ |
725 | 82 for(i = 1; i < 64; i++) { |
83 /* 88 table */ | |
1567 | 84 j = perm[i]; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
85 s->dv_idct_shift[0][0][q][j] = |
725 | 86 dv_quant_shifts[q][dv_88_areas[i]] + 1; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
87 s->dv_idct_shift[1][0][q][j] = s->dv_idct_shift[0][0][q][j] + 1; |
725 | 88 } |
89 | |
1567 | 90 /* 248DCT */ |
725 | 91 for(i = 1; i < 64; i++) { |
92 /* 248 table */ | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
93 s->dv_idct_shift[0][1][q][i] = |
1567 | 94 dv_quant_shifts[q][dv_248_areas[i]] + 1; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
95 s->dv_idct_shift[1][1][q][i] = s->dv_idct_shift[0][1][q][i] + 1; |
723 | 96 } |
97 } | |
98 } | |
99 | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
100 static int dvvideo_init(AVCodecContext *avctx) |
723 | 101 { |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
102 DVVideoContext *s = avctx->priv_data; |
1567 | 103 DSPContext dsp; |
1070
6da5ae9ee199
more #ifdef CONFIG_ENCODERS patch by (Wolfgang Hesseler <qv at multimediaware dot com>) with modifications by me (s/WOLFGANG/CONFIG_ENCODERS/ and some other fixes)
michaelni
parents:
1064
diff
changeset
|
104 static int done=0; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
105 int i, j; |
723 | 106 |
107 if (!done) { | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
108 VLC dv_vlc; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
109 uint16_t new_dv_vlc_bits[NB_DV_VLC*2]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
110 uint8_t new_dv_vlc_len[NB_DV_VLC*2]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
111 uint8_t new_dv_vlc_run[NB_DV_VLC*2]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
112 int16_t new_dv_vlc_level[NB_DV_VLC*2]; |
723 | 113 |
114 done = 1; | |
115 | |
2845
d9f4b93e81c5
Fix for memleak in dv.c patch by (Burkhard Plaum; plaum, ipf uni-stuttgart de)
michael
parents:
2822
diff
changeset
|
116 dv_vlc_map = av_mallocz_static(DV_VLC_MAP_LEV_SIZE*DV_VLC_MAP_RUN_SIZE*sizeof(struct dv_vlc_pair)); |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
117 if (!dv_vlc_map) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
118 return -ENOMEM; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
119 |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
120 /* dv_anchor lets each thread know its Id */ |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
121 dv_anchor = av_malloc(12*27*sizeof(void*)); |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
122 if (!dv_anchor) { |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
123 return -ENOMEM; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
124 } |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
125 for (i=0; i<12*27; i++) |
1904 | 126 dv_anchor[i] = (void*)(size_t)i; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
127 |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
128 /* it's faster to include sign bit in a generic VLC parsing scheme */ |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
129 for (i=0, j=0; i<NB_DV_VLC; i++, j++) { |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
130 new_dv_vlc_bits[j] = dv_vlc_bits[i]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
131 new_dv_vlc_len[j] = dv_vlc_len[i]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
132 new_dv_vlc_run[j] = dv_vlc_run[i]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
133 new_dv_vlc_level[j] = dv_vlc_level[i]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
134 |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
135 if (dv_vlc_level[i]) { |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
136 new_dv_vlc_bits[j] <<= 1; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
137 new_dv_vlc_len[j]++; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
138 |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
139 j++; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
140 new_dv_vlc_bits[j] = (dv_vlc_bits[i] << 1) | 1; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
141 new_dv_vlc_len[j] = dv_vlc_len[i] + 1; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
142 new_dv_vlc_run[j] = dv_vlc_run[i]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
143 new_dv_vlc_level[j] = -dv_vlc_level[i]; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
144 } |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
145 } |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
146 |
723 | 147 /* NOTE: as a trick, we use the fact the no codes are unused |
148 to accelerate the parsing of partial codes */ | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
149 init_vlc(&dv_vlc, TEX_VLC_BITS, j, |
2370
26560d4fdb1f
Memory leak fix patch by (Burkhard Plaum <plaum >at< ipf.uni-stuttgart )dot( de>)
michael
parents:
2247
diff
changeset
|
150 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0); |
723 | 151 |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
152 dv_rl_vlc = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM)); |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
153 if (!dv_rl_vlc) { |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
154 av_free(dv_anchor); |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
155 return -ENOMEM; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
156 } |
723 | 157 for(i = 0; i < dv_vlc.table_size; i++){ |
158 int code= dv_vlc.table[i][0]; | |
159 int len = dv_vlc.table[i][1]; | |
160 int level, run; | |
161 | |
162 if(len<0){ //more bits needed | |
163 run= 0; | |
164 level= code; | |
165 } else { | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
166 run= new_dv_vlc_run[code] + 1; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
167 level= new_dv_vlc_level[code]; |
723 | 168 } |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
169 dv_rl_vlc[i].len = len; |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
170 dv_rl_vlc[i].level = level; |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
171 dv_rl_vlc[i].run = run; |
723 | 172 } |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
173 free_vlc(&dv_vlc); |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
174 |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
175 for (i = 0; i < NB_DV_VLC - 1; i++) { |
2027
3a78447c3b53
oops, forgot to commit that change from the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1994
diff
changeset
|
176 if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE) |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
177 continue; |
2027
3a78447c3b53
oops, forgot to commit that change from the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1994
diff
changeset
|
178 #ifdef DV_CODEC_TINY_TARGET |
3a78447c3b53
oops, forgot to commit that change from the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1994
diff
changeset
|
179 if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE) |
3a78447c3b53
oops, forgot to commit that change from the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1994
diff
changeset
|
180 continue; |
3a78447c3b53
oops, forgot to commit that change from the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1994
diff
changeset
|
181 #endif |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
182 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
183 if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
184 continue; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
185 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
186 dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc = dv_vlc_bits[i] << |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
187 (!!dv_vlc_level[i]); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
188 dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size = dv_vlc_len[i] + |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
189 (!!dv_vlc_level[i]); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
190 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
191 for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
192 #ifdef DV_CODEC_TINY_TARGET |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
193 for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
194 if (dv_vlc_map[i][j].size == 0) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
195 dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc | |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
196 (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size)); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
197 dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
198 dv_vlc_map[0][j].size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
199 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
200 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
201 #else |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
202 for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
203 if (dv_vlc_map[i][j].size == 0) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
204 dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc | |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
205 (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size)); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
206 dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size + |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
207 dv_vlc_map[0][j].size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
208 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
209 dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc = |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
210 dv_vlc_map[i][j].vlc | 1; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
211 dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size = |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
212 dv_vlc_map[i][j].size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
213 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
214 #endif |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
215 } |
723 | 216 } |
725 | 217 |
1567 | 218 /* Generic DSP setup */ |
219 dsputil_init(&dsp, avctx); | |
220 s->get_pixels = dsp.get_pixels; | |
725 | 221 |
1567 | 222 /* 88DCT setup */ |
223 s->fdct[0] = dsp.fdct; | |
224 s->idct_put[0] = dsp.idct_put; | |
225 for (i=0; i<64; i++) | |
226 s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]]; | |
725 | 227 |
1567 | 228 /* 248DCT setup */ |
229 s->fdct[1] = dsp.fdct248; | |
230 s->idct_put[1] = simple_idct248_put; // FIXME: need to add it to DSP | |
231 memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); | |
725 | 232 |
723 | 233 /* XXX: do it only for constant case */ |
1567 | 234 dv_build_unquantize_tables(s, dsp.idct_permutation); |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
235 |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
236 /* FIXME: I really don't think this should be here */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
237 if (dv_codec_profile(avctx)) |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
238 avctx->pix_fmt = dv_codec_profile(avctx)->pix_fmt; |
1543
7542cb99b950
* providing MPEG codecs with a generic fields in AVFrame to use.
romansh
parents:
1540
diff
changeset
|
239 avctx->coded_frame = &s->picture; |
2847 | 240 s->avctx= avctx; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
241 |
723 | 242 return 0; |
243 } | |
244 | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
245 // #define VLC_DEBUG |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
246 // #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__) |
723 | 247 |
725 | 248 typedef struct BlockInfo { |
1064 | 249 const uint8_t *shift_table; |
250 const uint8_t *scan_table; | |
251 uint8_t pos; /* position in block */ | |
252 uint8_t dct_mode; | |
253 uint8_t partial_bit_count; | |
254 uint16_t partial_bit_buffer; | |
725 | 255 int shift_offset; |
256 } BlockInfo; | |
723 | 257 |
258 /* block size in bits */ | |
1064 | 259 static const uint16_t block_sizes[6] = { |
723 | 260 112, 112, 112, 112, 80, 80 |
261 }; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
262 /* bit budget for AC only in 5 MBs */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
263 static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
264 /* see dv_88_areas and dv_248_areas for details */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
265 static const int mb_area_start[5] = { 1, 6, 21, 43, 64 }; |
723 | 266 |
267 #ifndef ALT_BITSTREAM_READER | |
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
268 #warning only works with ALT_BITSTREAM_READER |
2614
5e24800ab329
various fixes related to the non alt_bitstream_reader
michael
parents:
2453
diff
changeset
|
269 static int re_index; //Hack to make it compile |
723 | 270 #endif |
271 | |
1895
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
272 static inline int get_bits_left(GetBitContext *s) |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
273 { |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
274 return s->size_in_bits - get_bits_count(s); |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
275 } |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
276 |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
277 static inline int get_bits_size(GetBitContext *s) |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
278 { |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
279 return s->size_in_bits; |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
280 } |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
281 |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
282 static inline int put_bits_left(PutBitContext* s) |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
283 { |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
284 return (s->buf_end - s->buf) * 8 - put_bits_count(s); |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
285 } |
e5687117cc7f
* removing casualties of battle of the wits and English language
romansh
parents:
1887
diff
changeset
|
286 |
723 | 287 /* decode ac coefs */ |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
288 static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) |
723 | 289 { |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
290 int last_index = get_bits_size(gb); |
1064 | 291 const uint8_t *scan_table = mb->scan_table; |
292 const uint8_t *shift_table = mb->shift_table; | |
725 | 293 int pos = mb->pos; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
294 int partial_bit_count = mb->partial_bit_count; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
295 int level, pos1, run, vlc_len, index; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
296 |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
297 OPEN_READER(re, gb); |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
298 UPDATE_CACHE(re, gb); |
723 | 299 |
300 /* if we must parse a partial vlc, we do it here */ | |
301 if (partial_bit_count > 0) { | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
302 re_cache = ((unsigned)re_cache >> partial_bit_count) | |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
303 (mb->partial_bit_buffer << (sizeof(re_cache)*8 - partial_bit_count)); |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
304 re_index -= partial_bit_count; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
305 mb->partial_bit_count = 0; |
723 | 306 } |
307 | |
308 /* get the AC coefficients until last_index is reached */ | |
309 for(;;) { | |
310 #ifdef VLC_DEBUG | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
311 printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index); |
723 | 312 #endif |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
313 /* our own optimized GET_RL_VLC */ |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
314 index = NEG_USR32(re_cache, TEX_VLC_BITS); |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
315 vlc_len = dv_rl_vlc[index].len; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
316 if (vlc_len < 0) { |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
317 index = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -vlc_len) + dv_rl_vlc[index].level; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
318 vlc_len = TEX_VLC_BITS - vlc_len; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
319 } |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
320 level = dv_rl_vlc[index].level; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
321 run = dv_rl_vlc[index].run; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
322 |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
323 /* gotta check if we're still within gb boundaries */ |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
324 if (re_index + vlc_len > last_index) { |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
325 /* should be < 16 bits otherwise a codeword could have been parsed */ |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
326 mb->partial_bit_count = last_index - re_index; |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
327 mb->partial_bit_buffer = NEG_USR32(re_cache, mb->partial_bit_count); |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
328 re_index = last_index; |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
329 break; |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
330 } |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
331 re_index += vlc_len; |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
332 |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
333 #ifdef VLC_DEBUG |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
334 printf("run=%d level=%d\n", run, level); |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
335 #endif |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
336 pos += run; |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
337 if (pos >= 64) |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
338 break; |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
339 |
2847 | 340 assert(level); |
341 pos1 = scan_table[pos]; | |
342 block[pos1] = level << shift_table[pos1]; | |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
343 |
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
344 UPDATE_CACHE(re, gb); |
723 | 345 } |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
346 CLOSE_READER(re, gb); |
725 | 347 mb->pos = pos; |
723 | 348 } |
349 | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
350 static inline void bit_copy(PutBitContext *pb, GetBitContext *gb) |
723 | 351 { |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
352 int bits_left = get_bits_left(gb); |
2847 | 353 while (bits_left >= MIN_CACHE_BITS) { |
354 put_bits(pb, MIN_CACHE_BITS, get_bits(gb, MIN_CACHE_BITS)); | |
355 bits_left -= MIN_CACHE_BITS; | |
723 | 356 } |
357 if (bits_left > 0) { | |
358 put_bits(pb, bits_left, get_bits(gb, bits_left)); | |
359 } | |
360 } | |
361 | |
362 /* mb_x and mb_y are in units of 8 pixels */ | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
363 static inline void dv_decode_video_segment(DVVideoContext *s, |
1064 | 364 uint8_t *buf_ptr1, |
365 const uint16_t *mb_pos_ptr) | |
723 | 366 { |
367 int quant, dc, dct_mode, class1, j; | |
368 int mb_index, mb_x, mb_y, v, last_index; | |
369 DCTELEM *block, *block1; | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
370 int c_offset; |
1064 | 371 uint8_t *y_ptr; |
372 void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block); | |
373 uint8_t *buf_ptr; | |
723 | 374 PutBitContext pb, vs_pb; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
375 GetBitContext gb; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
376 BlockInfo mb_data[5 * 6], *mb, *mb1; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
377 DCTELEM sblock[5*6][64] __align8; |
2847 | 378 uint8_t mb_bit_buffer[80 + 4] __align8; /* allow some slack */ |
379 uint8_t vs_bit_buffer[5 * 80 + 4] __align8; /* allow some slack */ | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
380 |
2847 | 381 assert((((int)mb_bit_buffer)&7)==0); |
382 assert((((int)vs_bit_buffer)&7)==0); | |
383 | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
384 memset(sblock, 0, sizeof(sblock)); |
723 | 385 |
386 /* pass 1 : read DC and AC coefficients in blocks */ | |
387 buf_ptr = buf_ptr1; | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
388 block1 = &sblock[0][0]; |
725 | 389 mb1 = mb_data; |
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
390 init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80); |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
391 for(mb_index = 0; mb_index < 5; mb_index++, mb1 += 6, block1 += 6 * 64) { |
723 | 392 /* skip header */ |
393 quant = buf_ptr[3] & 0x0f; | |
394 buf_ptr += 4; | |
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
395 init_put_bits(&pb, mb_bit_buffer, 80); |
725 | 396 mb = mb1; |
723 | 397 block = block1; |
398 for(j = 0;j < 6; j++) { | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
399 last_index = block_sizes[j]; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
400 init_get_bits(&gb, buf_ptr, last_index); |
723 | 401 |
402 /* get the dc */ | |
2247 | 403 dc = get_sbits(&gb, 9); |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
404 dct_mode = get_bits1(&gb); |
725 | 405 mb->dct_mode = dct_mode; |
406 mb->scan_table = s->dv_zigzag[dct_mode]; | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
407 class1 = get_bits(&gb, 2); |
1905
2761950695cc
* some significant clean-up of the dv_decode_ac (it looks real
romansh
parents:
1904
diff
changeset
|
408 mb->shift_table = s->dv_idct_shift[class1 == 3][dct_mode] |
723 | 409 [quant + dv_quant_offset[class1]]; |
410 dc = dc << 2; | |
411 /* convert to unsigned because 128 is not added in the | |
412 standard IDCT */ | |
413 dc += 1024; | |
414 block[0] = dc; | |
415 buf_ptr += last_index >> 3; | |
725 | 416 mb->pos = 0; |
417 mb->partial_bit_count = 0; | |
723 | 418 |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
419 #ifdef VLC_DEBUG |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
420 printf("MB block: %d, %d ", mb_index, j); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
421 #endif |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
422 dv_decode_ac(&gb, mb, block); |
723 | 423 |
424 /* write the remaining bits in a new buffer only if the | |
425 block is finished */ | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
426 if (mb->pos >= 64) |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
427 bit_copy(&pb, &gb); |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
428 |
723 | 429 block += 64; |
725 | 430 mb++; |
723 | 431 } |
432 | |
433 /* pass 2 : we can do it just after */ | |
434 #ifdef VLC_DEBUG | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
435 printf("***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index); |
723 | 436 #endif |
437 block = block1; | |
725 | 438 mb = mb1; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
439 init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb)); |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
440 flush_put_bits(&pb); |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
441 for(j = 0;j < 6; j++, block += 64, mb++) { |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
442 if (mb->pos < 64 && get_bits_left(&gb) > 0) { |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
443 dv_decode_ac(&gb, mb, block); |
723 | 444 /* if still not finished, no need to parse other blocks */ |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
445 if (mb->pos < 64) |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
446 break; |
723 | 447 } |
448 } | |
449 /* all blocks are finished, so the extra bytes can be used at | |
450 the video segment level */ | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
451 if (j >= 6) |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
452 bit_copy(&vs_pb, &gb); |
723 | 453 } |
454 | |
455 /* we need a pass other the whole video segment */ | |
456 #ifdef VLC_DEBUG | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
457 printf("***pass 3 size=%d\n", put_bits_count(&vs_pb)); |
723 | 458 #endif |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
459 block = &sblock[0][0]; |
723 | 460 mb = mb_data; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
461 init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb)); |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
462 flush_put_bits(&vs_pb); |
723 | 463 for(mb_index = 0; mb_index < 5; mb_index++) { |
464 for(j = 0;j < 6; j++) { | |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
465 if (mb->pos < 64) { |
723 | 466 #ifdef VLC_DEBUG |
467 printf("start %d:%d\n", mb_index, j); | |
468 #endif | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
469 dv_decode_ac(&gb, mb, block); |
723 | 470 } |
1886
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
471 if (mb->pos >= 64 && mb->pos < 127) |
fbcf02596520
* DV decoder simplifications. Now it looks to be 6% faster. At least
romansh
parents:
1875
diff
changeset
|
472 av_log(NULL, AV_LOG_ERROR, "AC EOB marker is absent pos=%d\n", mb->pos); |
723 | 473 block += 64; |
725 | 474 mb++; |
723 | 475 } |
476 } | |
477 | |
478 /* compute idct and place blocks */ | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
479 block = &sblock[0][0]; |
723 | 480 mb = mb_data; |
481 for(mb_index = 0; mb_index < 5; mb_index++) { | |
482 v = *mb_pos_ptr++; | |
483 mb_x = v & 0xff; | |
484 mb_y = v >> 8; | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
485 y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8); |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
486 if (s->sys->pix_fmt == PIX_FMT_YUV411P) |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
487 c_offset = (mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8); |
723 | 488 else |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
489 c_offset = ((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8); |
723 | 490 for(j = 0;j < 6; j++) { |
725 | 491 idct_put = s->idct_put[mb->dct_mode]; |
723 | 492 if (j < 4) { |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
493 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { |
737 | 494 /* NOTE: at end of line, the macroblock is handled as 420 */ |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
495 idct_put(y_ptr + (j * 8), s->picture.linesize[0], block); |
723 | 496 } else { |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
497 idct_put(y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->picture.linesize[0]), |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
498 s->picture.linesize[0], block); |
723 | 499 } |
500 } else { | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
501 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) { |
1540 | 502 uint64_t aligned_pixels[64/8]; |
1537 | 503 uint8_t *pixels= (uint8_t*)aligned_pixels; |
1540 | 504 uint8_t *c_ptr, *c_ptr1, *ptr; |
737 | 505 int y, linesize; |
506 /* NOTE: at end of line, the macroblock is handled as 420 */ | |
507 idct_put(pixels, 8, block); | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
508 linesize = s->picture.linesize[6 - j]; |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
509 c_ptr = s->picture.data[6 - j] + c_offset; |
737 | 510 ptr = pixels; |
511 for(y = 0;y < 8; y++) { | |
512 /* convert to 411P */ | |
1270
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
513 c_ptr1 = c_ptr + 8*linesize; |
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
514 c_ptr[0]= ptr[0]; c_ptr1[0]= ptr[4]; |
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
515 c_ptr[1]= ptr[1]; c_ptr1[1]= ptr[5]; |
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
516 c_ptr[2]= ptr[2]; c_ptr1[2]= ptr[6]; |
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
517 c_ptr[3]= ptr[3]; c_ptr1[3]= ptr[7]; |
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
518 c_ptr += linesize; |
737 | 519 ptr += 8; |
520 } | |
521 } else { | |
522 /* don't ask me why they inverted Cb and Cr ! */ | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
523 idct_put(s->picture.data[6 - j] + c_offset, |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
524 s->picture.linesize[6 - j], block); |
737 | 525 } |
723 | 526 } |
527 block += 64; | |
725 | 528 mb++; |
723 | 529 } |
530 } | |
531 } | |
532 | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
533 #ifdef DV_CODEC_TINY_TARGET |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
534 /* Converts run and level (where level != 0) pair into vlc, returning bit size */ |
2847 | 535 static always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc) |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
536 { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
537 int size; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
538 if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
539 *vlc = dv_vlc_map[run][level].vlc | sign; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
540 size = dv_vlc_map[run][level].size; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
541 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
542 else { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
543 if (level < DV_VLC_MAP_LEV_SIZE) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
544 *vlc = dv_vlc_map[0][level].vlc | sign; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
545 size = dv_vlc_map[0][level].size; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
546 } else { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
547 *vlc = 0xfe00 | (level << 1) | sign; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
548 size = 16; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
549 } |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
550 if (run) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
551 *vlc |= ((run < 16) ? dv_vlc_map[run-1][0].vlc : |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
552 (0x1f80 | (run - 1))) << size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
553 size += (run < 16) ? dv_vlc_map[run-1][0].size : 13; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
554 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
555 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
556 |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
557 return size; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
558 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
559 |
2847 | 560 static always_inline int dv_rl2vlc_size(int run, int level) |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
561 { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
562 int size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
563 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
564 if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
565 size = dv_vlc_map[run][level].size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
566 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
567 else { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
568 size = (level < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][level].size : 16; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
569 if (run) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
570 size += (run < 16) ? dv_vlc_map[run-1][0].size : 13; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
571 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
572 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
573 return size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
574 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
575 #else |
2847 | 576 static always_inline int dv_rl2vlc(int run, int l, int sign, uint32_t* vlc) |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
577 { |
2847 | 578 *vlc = dv_vlc_map[run][l].vlc | sign; |
579 return dv_vlc_map[run][l].size; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
580 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
581 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
582 static always_inline int dv_rl2vlc_size(int run, int l) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
583 { |
2847 | 584 return dv_vlc_map[run][l].size; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
585 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
586 #endif |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
587 |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
588 typedef struct EncBlockInfo { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
589 int area_q[4]; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
590 int bit_size[4]; |
2847 | 591 int prev[5]; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
592 int cur_ac; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
593 int cno; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
594 int dct_mode; |
2847 | 595 DCTELEM mb[64]; |
596 uint8_t next[64]; | |
597 uint8_t sign[64]; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
598 uint8_t partial_bit_count; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
599 uint32_t partial_bit_buffer; /* we can't use uint16_t here */ |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
600 } EncBlockInfo; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
601 |
2847 | 602 static always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi, PutBitContext* pb_pool, |
603 PutBitContext* pb_end) | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
604 { |
2847 | 605 int prev; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
606 int bits_left; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
607 PutBitContext* pb = pb_pool; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
608 int size = bi->partial_bit_count; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
609 uint32_t vlc = bi->partial_bit_buffer; |
2847 | 610 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
611 bi->partial_bit_count = bi->partial_bit_buffer = 0; |
2847 | 612 for(;;){ |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
613 /* Find suitable storage space */ |
1875
45a1592dadca
* moving some of the commonly used bit reading/writing functions
romansh
parents:
1726
diff
changeset
|
614 for (; size > (bits_left = put_bits_left(pb)); pb++) { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
615 if (bits_left) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
616 size -= bits_left; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
617 put_bits(pb, bits_left, vlc >> size); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
618 vlc = vlc & ((1<<size)-1); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
619 } |
2847 | 620 if (pb + 1 >= pb_end) { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
621 bi->partial_bit_count = size; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
622 bi->partial_bit_buffer = vlc; |
2847 | 623 return pb; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
624 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
625 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
626 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
627 /* Store VLC */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
628 put_bits(pb, size, vlc); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
629 |
2847 | 630 if(bi->cur_ac>=64) |
631 break; | |
632 | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
633 /* Construct the next VLC */ |
2847 | 634 prev= bi->cur_ac; |
635 bi->cur_ac = bi->next[prev]; | |
636 if(bi->cur_ac < 64){ | |
637 size = dv_rl2vlc(bi->cur_ac - prev - 1, bi->mb[bi->cur_ac], bi->sign[bi->cur_ac], &vlc); | |
638 } else { | |
639 size = 4; vlc = 6; /* End Of Block stamp */ | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
640 } |
2847 | 641 } |
642 return pb; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
643 } |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
644 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
645 static always_inline void dv_set_class_number(DCTELEM* blk, EncBlockInfo* bi, |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
646 const uint8_t* zigzag_scan, int bias) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
647 { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
648 int i, area; |
2847 | 649 static const int classes[] = {12, 24, 36, 0xffff}; |
650 int max=12; | |
651 int prev=0; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
652 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
653 bi->mb[0] = blk[0]; |
2847 | 654 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
655 for (area = 0; area < 4; area++) { |
2847 | 656 bi->prev[area] = prev; |
657 bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :) | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
658 for (i=mb_area_start[area]; i<mb_area_start[area+1]; i++) { |
2847 | 659 int level = blk[zigzag_scan[i]]; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
660 |
2847 | 661 if (level+15 > 30U) { |
662 bi->sign[i] = (level>>31)&1; | |
663 bi->mb[i] = level= ABS(level)>>4; | |
664 if(level>max) max= level; | |
665 bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, level); | |
666 bi->next[prev]= i; | |
667 prev= i; | |
668 } | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
669 } |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
670 } |
2847 | 671 bi->next[prev]= i; |
672 for(bi->cno = 0; max > classes[bi->cno]; bi->cno++); | |
673 | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
674 bi->cno += bias; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
675 |
2847 | 676 if (bi->cno >= 3) { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
677 bi->cno = 3; |
2847 | 678 prev=0; |
679 i= bi->next[prev]; | |
680 for (area = 0; area < 4; area++) { | |
681 bi->prev[area] = prev; | |
682 bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :) | |
683 for (; i<mb_area_start[area+1]; i= bi->next[i]) { | |
684 bi->mb[i] >>=1; | |
685 | |
686 if (bi->mb[i]) { | |
687 bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, bi->mb[i]); | |
688 bi->next[prev]= i; | |
689 prev= i; | |
690 } | |
691 } | |
692 } | |
693 bi->next[prev]= i; | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
694 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
695 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
696 |
2847 | 697 //FIXME replace this by dsputil |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
698 #define SC(x, y) ((s[x] - s[y]) ^ ((s[x] - s[y]) >> 7)) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
699 static always_inline int dv_guess_dct_mode(DCTELEM *blk) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
700 DCTELEM *s; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
701 int score88 = 0; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
702 int score248 = 0; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
703 int i; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
704 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
705 /* Compute 8-8 score (small values give a better chance for 8-8 DCT) */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
706 s = blk; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
707 for(i=0; i<7; i++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
708 score88 += SC(0, 8) + SC(1, 9) + SC(2, 10) + SC(3, 11) + |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
709 SC(4, 12) + SC(5,13) + SC(6, 14) + SC(7, 15); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
710 s += 8; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
711 } |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
712 /* Compute 2-4-8 score (small values give a better chance for 2-4-8 DCT) */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
713 s = blk; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
714 for(i=0; i<6; i++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
715 score248 += SC(0, 16) + SC(1,17) + SC(2, 18) + SC(3, 19) + |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
716 SC(4, 20) + SC(5,21) + SC(6, 22) + SC(7, 23); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
717 s += 8; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
718 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
719 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
720 return (score88 - score248 > -10); |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
721 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
722 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
723 static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos) |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
724 { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
725 int size[5]; |
2847 | 726 int i, j, k, a, prev; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
727 EncBlockInfo* b; |
2847 | 728 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
729 do { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
730 b = blks; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
731 for (i=0; i<5; i++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
732 if (!qnos[i]) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
733 continue; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
734 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
735 qnos[i]--; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
736 size[i] = 0; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
737 for (j=0; j<6; j++, b++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
738 for (a=0; a<4; a++) { |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
739 if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) { |
2847 | 740 b->bit_size[a] = 1; // 4 areas 4 bits for EOB :) |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
741 b->area_q[a]++; |
2847 | 742 prev= b->prev[a]; |
743 for (k= b->next[prev] ; k<mb_area_start[a+1]; k= b->next[k]) { | |
744 b->mb[k] >>= 1; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
745 if (b->mb[k]) { |
2847 | 746 b->bit_size[a] += dv_rl2vlc_size(k - prev - 1, b->mb[k]); |
747 prev= k; | |
748 } else { | |
749 b->next[prev] = b->next[k]; | |
750 } | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
751 } |
2847 | 752 b->prev[a+1]= prev; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
753 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
754 size[i] += b->bit_size[a]; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
755 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
756 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
757 } |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
758 } while ((vs_total_ac_bits < size[0] + size[1] + size[2] + size[3] + size[4]) && |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
759 (qnos[0]|qnos[1]|qnos[2]|qnos[3]|qnos[4])); |
1567 | 760 } |
761 | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
762 /* |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
763 * This is a very rough initial implementaion. The performance is |
1567 | 764 * horrible and the weighting is missing. But it's missing from the |
765 * decoding step also -- so at least we're on the same page with decoder ;-) | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
766 */ |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
767 static inline void dv_encode_video_segment(DVVideoContext *s, |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
768 uint8_t *dif, |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
769 const uint16_t *mb_pos_ptr) |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
770 { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
771 int mb_index, i, j, v; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
772 int mb_x, mb_y, c_offset, linesize; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
773 uint8_t* y_ptr; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
774 uint8_t* data; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
775 uint8_t* ptr; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
776 int do_edge_wrap; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
777 DCTELEM block[64] __align8; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
778 EncBlockInfo enc_blks[5*6]; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
779 PutBitContext pbs[5*6]; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
780 PutBitContext* pb; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
781 EncBlockInfo* enc_blk; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
782 int vs_bit_size = 0; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
783 int qnos[5]; |
2847 | 784 |
785 assert((((int)block) & 7) == 0); | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
786 |
1567 | 787 enc_blk = &enc_blks[0]; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
788 pb = &pbs[0]; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
789 for(mb_index = 0; mb_index < 5; mb_index++) { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
790 v = *mb_pos_ptr++; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
791 mb_x = v & 0xff; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
792 mb_y = v >> 8; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
793 y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
794 c_offset = (s->sys->pix_fmt == PIX_FMT_YUV411P) ? |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
795 ((mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8)) : |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
796 (((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8)); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
797 do_edge_wrap = 0; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
798 qnos[mb_index] = 15; /* No quantization */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
799 ptr = dif + mb_index*80 + 4; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
800 for(j = 0;j < 6; j++) { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
801 if (j < 4) { /* Four Y blocks */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
802 /* NOTE: at end of line, the macroblock is handled as 420 */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
803 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
804 data = y_ptr + (j * 8); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
805 } else { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
806 data = y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->picture.linesize[0]); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
807 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
808 linesize = s->picture.linesize[0]; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
809 } else { /* Cr and Cb blocks */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
810 /* don't ask Fabrice why they inverted Cb and Cr ! */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
811 data = s->picture.data[6 - j] + c_offset; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
812 linesize = s->picture.linesize[6 - j]; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
813 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
814 do_edge_wrap = 1; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
815 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
816 |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
817 /* Everything is set up -- now just copy data -> DCT block */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
818 if (do_edge_wrap) { /* Edge wrap copy: 4x16 -> 8x8 */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
819 uint8_t* d; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
820 DCTELEM *b = block; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
821 for (i=0;i<8;i++) { |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
822 d = data + 8 * linesize; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
823 b[0] = data[0]; b[1] = data[1]; b[2] = data[2]; b[3] = data[3]; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
824 b[4] = d[0]; b[5] = d[1]; b[6] = d[2]; b[7] = d[3]; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
825 data += linesize; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
826 b += 8; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
827 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
828 } else { /* Simple copy: 8x8 -> 8x8 */ |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
829 s->get_pixels(block, data, linesize); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
830 } |
1567 | 831 |
2847 | 832 if(s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) |
833 enc_blk->dct_mode = dv_guess_dct_mode(block); | |
834 else | |
835 enc_blk->dct_mode = 0; | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
836 enc_blk->area_q[0] = enc_blk->area_q[1] = enc_blk->area_q[2] = enc_blk->area_q[3] = 0; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
837 enc_blk->partial_bit_count = 0; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
838 enc_blk->partial_bit_buffer = 0; |
2847 | 839 enc_blk->cur_ac = 0; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
840 |
1567 | 841 s->fdct[enc_blk->dct_mode](block); |
842 | |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
843 dv_set_class_number(block, enc_blk, |
2847 | 844 enc_blk->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct, j/4); |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
845 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
846 init_put_bits(pb, ptr, block_sizes[j]/8); |
2847 | 847 put_bits(pb, 9, (uint16_t)(((enc_blk->mb[0] >> 3) - 1024 + 2) >> 2)); |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
848 put_bits(pb, 1, enc_blk->dct_mode); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
849 put_bits(pb, 2, enc_blk->cno); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
850 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
851 vs_bit_size += enc_blk->bit_size[0] + enc_blk->bit_size[1] + |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
852 enc_blk->bit_size[2] + enc_blk->bit_size[3]; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
853 ++enc_blk; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
854 ++pb; |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
855 ptr += block_sizes[j]/8; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
856 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
857 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
858 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
859 if (vs_total_ac_bits < vs_bit_size) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
860 dv_guess_qnos(&enc_blks[0], &qnos[0]); |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
861 |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
862 for (i=0; i<5; i++) { |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
863 dif[i*80 + 3] = qnos[i]; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
864 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
865 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
866 /* First pass over individual cells only */ |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
867 for (j=0; j<5*6; j++) |
2847 | 868 dv_encode_ac(&enc_blks[j], &pbs[j], &pbs[j+1]); |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
869 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
870 /* Second pass over each MB space */ |
2847 | 871 for (j=0; j<5*6; j+=6) { |
872 pb= &pbs[j]; | |
873 for (i=0; i<6; i++) { | |
874 if (enc_blks[i+j].partial_bit_count) | |
875 pb=dv_encode_ac(&enc_blks[i+j], pb, &pbs[j+6]); | |
876 } | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
877 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
878 |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
879 /* Third and final pass over the whole vides segment space */ |
2847 | 880 pb= &pbs[0]; |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
881 for (j=0; j<5*6; j++) { |
2847 | 882 if (enc_blks[j].partial_bit_count) |
883 pb=dv_encode_ac(&enc_blks[j], pb, &pbs[6*5]); | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
884 } |
1631
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
885 |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
886 for (j=0; j<5*6; j++) |
59f2fa833449
* 3x encoding speedup. Finally we seem to be on par with libdv
romansh
parents:
1598
diff
changeset
|
887 flush_put_bits(&pbs[j]); |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
888 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
889 |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
890 static int dv_decode_mt(AVCodecContext *avctx, void* sl) |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
891 { |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
892 DVVideoContext *s = avctx->priv_data; |
1904 | 893 int slice = (size_t)sl; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
894 dv_decode_video_segment(s, &s->buf[((slice/27)*6+(slice/3)+slice*5+7)*80], |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
895 &s->sys->video_place[slice*5]); |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
896 return 0; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
897 } |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
898 |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
899 static int dv_encode_mt(AVCodecContext *avctx, void* sl) |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
900 { |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
901 DVVideoContext *s = avctx->priv_data; |
1904 | 902 int slice = (size_t)sl; |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
903 dv_encode_video_segment(s, &s->buf[((slice/27)*6+(slice/3)+slice*5+7)*80], |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
904 &s->sys->video_place[slice*5]); |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
905 return 0; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
906 } |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
907 |
723 | 908 /* NOTE: exactly one frame must be given (120000 bytes for NTSC, |
909 144000 bytes for PAL) */ | |
910 static int dvvideo_decode_frame(AVCodecContext *avctx, | |
911 void *data, int *data_size, | |
1064 | 912 uint8_t *buf, int buf_size) |
723 | 913 { |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
914 DVVideoContext *s = avctx->priv_data; |
1726 | 915 |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
916 s->sys = dv_frame_profile(buf); |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
917 if (!s->sys || buf_size < s->sys->frame_size) |
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
918 return -1; /* NOTE: we only accept several full frames */ |
723 | 919 |
1228 | 920 if(s->picture.data[0]) |
921 avctx->release_buffer(avctx, &s->picture); | |
922 | |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
923 s->picture.reference = 0; |
2822
fdedaa2e6da4
DV video encoder/decoder doesn't set keyframe and picture type properties patch by (Edward Hervey:bilboed,gmail com)
michael
parents:
2661
diff
changeset
|
924 s->picture.key_frame = 1; |
fdedaa2e6da4
DV video encoder/decoder doesn't set keyframe and picture type properties patch by (Edward Hervey:bilboed,gmail com)
michael
parents:
2661
diff
changeset
|
925 s->picture.pict_type = FF_I_TYPE; |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
926 avctx->pix_fmt = s->sys->pix_fmt; |
1507 | 927 avctx->width = s->sys->width; |
928 avctx->height = s->sys->height; | |
903 | 929 if(avctx->get_buffer(avctx, &s->picture) < 0) { |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1567
diff
changeset
|
930 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
903 | 931 return -1; |
835 | 932 } |
1543
7542cb99b950
* providing MPEG codecs with a generic fields in AVFrame to use.
romansh
parents:
1540
diff
changeset
|
933 s->picture.interlaced_frame = 1; |
1547 | 934 s->picture.top_field_first = 0; |
835 | 935 |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
936 s->buf = buf; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
937 avctx->execute(avctx, dv_decode_mt, (void**)&dv_anchor[0], NULL, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
938 s->sys->difseg_size * 27); |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
939 |
734
2d6b3e3d6c6f
10l - MMX/FPU state was not restored, causing nonsense fpu behaviour in caller (mplayer)
arpi_esp
parents:
733
diff
changeset
|
940 emms_c(); |
2d6b3e3d6c6f
10l - MMX/FPU state was not restored, causing nonsense fpu behaviour in caller (mplayer)
arpi_esp
parents:
733
diff
changeset
|
941 |
723 | 942 /* return image */ |
925 | 943 *data_size = sizeof(AVFrame); |
944 *(AVFrame*)data= s->picture; | |
903 | 945 |
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
946 return s->sys->frame_size; |
723 | 947 } |
948 | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
949 static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
950 void *data) |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
951 { |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
952 DVVideoContext *s = c->priv_data; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
953 |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
954 s->sys = dv_codec_profile(c); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
955 if (!s->sys) |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
956 return -1; |
2422 | 957 if(buf_size < s->sys->frame_size) |
958 return -1; | |
959 | |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
960 c->pix_fmt = s->sys->pix_fmt; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
961 s->picture = *((AVFrame *)data); |
2822
fdedaa2e6da4
DV video encoder/decoder doesn't set keyframe and picture type properties patch by (Edward Hervey:bilboed,gmail com)
michael
parents:
2661
diff
changeset
|
962 s->picture.key_frame = 1; |
fdedaa2e6da4
DV video encoder/decoder doesn't set keyframe and picture type properties patch by (Edward Hervey:bilboed,gmail com)
michael
parents:
2661
diff
changeset
|
963 s->picture.pict_type = FF_I_TYPE; |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
964 |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
965 s->buf = buf; |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
966 c->execute(c, dv_encode_mt, (void**)&dv_anchor[0], NULL, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
967 s->sys->difseg_size * 27); |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
968 |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
969 emms_c(); |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
970 return s->sys->frame_size; |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
971 } |
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
972 |
2661
b2846918585c
a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents:
2614
diff
changeset
|
973 #ifdef CONFIG_DVVIDEO_ENCODER |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
974 AVCodec dvvideo_encoder = { |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
975 "dvvideo", |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
976 CODEC_TYPE_VIDEO, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
977 CODEC_ID_DVVIDEO, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
978 sizeof(DVVideoContext), |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
979 dvvideo_init, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
980 dvvideo_encode_frame, |
1994 | 981 NULL, |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
982 NULL, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
983 CODEC_CAP_DR1, |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
984 NULL |
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
985 }; |
2661
b2846918585c
a few #ifdef CONFIG_X_ENCODER, patch by (Roine Gustafsson <roine users.sourceforge net]
michael
parents:
2614
diff
changeset
|
986 #endif // CONFIG_DVVIDEO_ENCODER |
723 | 987 |
988 AVCodec dvvideo_decoder = { | |
989 "dvvideo", | |
990 CODEC_TYPE_VIDEO, | |
991 CODEC_ID_DVVIDEO, | |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
992 sizeof(DVVideoContext), |
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
993 dvvideo_init, |
1887
85fe2f4633ec
* DV decoding/encoding now supports MultiThreading for up to 324 CPUs ;-)
romansh
parents:
1886
diff
changeset
|
994 NULL, |
1994 | 995 NULL, |
723 | 996 dvvideo_decode_frame, |
835 | 997 CODEC_CAP_DR1, |
723 | 998 NULL |
999 }; |