Mercurial > libavcodec.hg
annotate dv.c @ 1598:932d306bf1dc libavcodec
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
| author | michael |
|---|---|
| date | Mon, 03 Nov 2003 13:26:22 +0000 |
| parents | e08df4d22d27 |
| children | 59f2fa833449 |
| rev | line source |
|---|---|
| 723 | 1 /* |
| 2 * DV decoder | |
| 3 * Copyright (c) 2002 Fabrice Bellard. | |
| 4 * | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
5 * DV encoder |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
6 * Copyright (c) 2003 Roman Shaposhnik. |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
7 * |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
8 * 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
|
9 * of DV technical info. |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
10 * |
| 723 | 11 * This library is free software; you can redistribute it and/or |
| 12 * modify it under the terms of the GNU Lesser General Public | |
| 13 * License as published by the Free Software Foundation; either | |
| 14 * version 2 of the License, or (at your option) any later version. | |
| 15 * | |
| 16 * This library is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 19 * Lesser General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU Lesser General Public | |
| 22 * License along with this library; if not, write to the Free Software | |
| 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 */ | |
| 1106 | 25 |
| 26 /** | |
| 27 * @file dv.c | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
28 * DV codec. |
| 1106 | 29 */ |
| 723 | 30 #include "avcodec.h" |
| 31 #include "dsputil.h" | |
| 32 #include "mpegvideo.h" | |
| 33 #include "simple_idct.h" | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
34 #include "dvdata.h" |
| 723 | 35 |
| 36 typedef struct DVVideoDecodeContext { | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
37 const DVprofile* sys; |
| 925 | 38 AVFrame picture; |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
39 |
| 1064 | 40 uint8_t dv_zigzag[2][64]; |
| 1567 | 41 uint8_t dv_idct_shift[2][22][64]; |
| 42 uint8_t dv_dct_shift[2][22][64]; | |
| 43 | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
44 void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size); |
| 1567 | 45 void (*fdct[2])(DCTELEM *block); |
| 46 void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block); | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
47 |
| 1567 | 48 GetBitContext gb; |
| 49 DCTELEM block[5*6][64] __align8; | |
| 723 | 50 } DVVideoDecodeContext; |
| 51 | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
52 #define TEX_VLC_BITS 9 |
| 723 | 53 /* XXX: also include quantization */ |
| 54 static RL_VLC_ELEM *dv_rl_vlc[1]; | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
55 static VLC_TYPE dv_vlc_codes[15][23]; |
| 723 | 56 |
| 1567 | 57 static void dv_build_unquantize_tables(DVVideoDecodeContext *s, uint8_t* perm) |
| 723 | 58 { |
| 725 | 59 int i, q, j; |
| 723 | 60 |
| 61 /* NOTE: max left shift is 6 */ | |
| 725 | 62 for(q = 0; q < 22; q++) { |
| 1567 | 63 /* 88DCT */ |
| 725 | 64 for(i = 1; i < 64; i++) { |
| 65 /* 88 table */ | |
| 1567 | 66 j = perm[i]; |
| 67 s->dv_idct_shift[0][q][j] = | |
| 725 | 68 dv_quant_shifts[q][dv_88_areas[i]] + 1; |
| 1567 | 69 s->dv_dct_shift[0][q][i] = |
| 70 dv_quant_shifts[q][dv_88_areas[ff_zigzag_direct[i]]] + 4; | |
| 725 | 71 } |
| 72 | |
| 1567 | 73 /* 248DCT */ |
| 725 | 74 for(i = 1; i < 64; i++) { |
| 75 /* 248 table */ | |
| 1567 | 76 s->dv_idct_shift[1][q][i] = |
| 77 dv_quant_shifts[q][dv_248_areas[i]] + 1; | |
| 78 s->dv_dct_shift[1][q][i] = | |
| 79 dv_quant_shifts[q][dv_248_areas[ff_zigzag248_direct[i]]] + 4; | |
| 723 | 80 } |
| 81 } | |
| 82 } | |
| 83 | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
84 static int dvvideo_init(AVCodecContext *avctx) |
| 723 | 85 { |
| 86 DVVideoDecodeContext *s = avctx->priv_data; | |
| 1567 | 87 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
|
88 static int done=0; |
| 1567 | 89 int i; |
| 723 | 90 |
| 91 if (!done) { | |
| 92 int i; | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
93 VLC dv_vlc; |
| 723 | 94 |
| 95 done = 1; | |
| 96 | |
| 97 /* NOTE: as a trick, we use the fact the no codes are unused | |
| 98 to accelerate the parsing of partial codes */ | |
| 99 init_vlc(&dv_vlc, TEX_VLC_BITS, NB_DV_VLC, | |
| 100 dv_vlc_len, 1, 1, dv_vlc_bits, 2, 2); | |
| 101 | |
| 102 dv_rl_vlc[0] = av_malloc(dv_vlc.table_size * sizeof(RL_VLC_ELEM)); | |
| 103 for(i = 0; i < dv_vlc.table_size; i++){ | |
| 104 int code= dv_vlc.table[i][0]; | |
| 105 int len = dv_vlc.table[i][1]; | |
| 106 int level, run; | |
| 107 | |
| 108 if(len<0){ //more bits needed | |
| 109 run= 0; | |
| 110 level= code; | |
| 111 } else if (code == (NB_DV_VLC - 1)) { | |
| 112 /* EOB */ | |
| 113 run = 0; | |
| 114 level = 256; | |
| 115 } else { | |
| 116 run= dv_vlc_run[code] + 1; | |
| 117 level= dv_vlc_level[code]; | |
| 118 } | |
| 119 dv_rl_vlc[0][i].len = len; | |
| 120 dv_rl_vlc[0][i].level = level; | |
| 121 dv_rl_vlc[0][i].run = run; | |
| 122 } | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
123 |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
124 memset(dv_vlc_codes, 0xff, sizeof(dv_vlc_codes)); |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
125 for (i = 0; i < NB_DV_VLC - 1; i++) { |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
126 if (dv_vlc_run[i] < 15 && dv_vlc_level[i] < 23 && dv_vlc_len[i] < 15) |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
127 dv_vlc_codes[dv_vlc_run[i]][dv_vlc_level[i]] = i; |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
128 } |
| 723 | 129 } |
| 725 | 130 |
| 1567 | 131 /* Generic DSP setup */ |
| 132 dsputil_init(&dsp, avctx); | |
| 133 s->get_pixels = dsp.get_pixels; | |
| 725 | 134 |
| 1567 | 135 /* 88DCT setup */ |
| 136 s->fdct[0] = dsp.fdct; | |
| 137 s->idct_put[0] = dsp.idct_put; | |
| 138 for (i=0; i<64; i++) | |
| 139 s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]]; | |
| 725 | 140 |
| 1567 | 141 /* 248DCT setup */ |
| 142 s->fdct[1] = dsp.fdct248; | |
| 143 s->idct_put[1] = simple_idct248_put; // FIXME: need to add it to DSP | |
| 144 memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); | |
| 725 | 145 |
| 723 | 146 /* XXX: do it only for constant case */ |
| 1567 | 147 dv_build_unquantize_tables(s, dsp.idct_permutation); |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
148 |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
149 /* 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
|
150 if (dv_codec_profile(avctx)) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
151 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
|
152 avctx->coded_frame = &s->picture; |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
153 |
| 723 | 154 return 0; |
| 155 } | |
| 156 | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
157 // #define VLC_DEBUG |
| 723 | 158 |
| 725 | 159 typedef struct BlockInfo { |
| 1064 | 160 const uint8_t *shift_table; |
| 161 const uint8_t *scan_table; | |
| 162 uint8_t pos; /* position in block */ | |
| 163 uint8_t eob_reached; /* true if EOB has been reached */ | |
| 164 uint8_t dct_mode; | |
| 165 uint8_t partial_bit_count; | |
| 166 uint16_t partial_bit_buffer; | |
| 725 | 167 int shift_offset; |
| 168 } BlockInfo; | |
| 723 | 169 |
| 170 /* block size in bits */ | |
| 1064 | 171 static const uint16_t block_sizes[6] = { |
| 723 | 172 112, 112, 112, 112, 80, 80 |
| 173 }; | |
| 174 | |
| 175 #ifndef ALT_BITSTREAM_READER | |
|
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
176 #warning only works with ALT_BITSTREAM_READER |
| 723 | 177 #endif |
| 178 | |
| 179 /* decode ac coefs */ | |
| 180 static void dv_decode_ac(DVVideoDecodeContext *s, | |
| 1008 | 181 BlockInfo *mb, DCTELEM *block, int last_index) |
| 723 | 182 { |
| 183 int last_re_index; | |
| 725 | 184 int shift_offset = mb->shift_offset; |
| 1064 | 185 const uint8_t *scan_table = mb->scan_table; |
| 186 const uint8_t *shift_table = mb->shift_table; | |
| 725 | 187 int pos = mb->pos; |
| 723 | 188 int level, pos1, sign, run; |
| 189 int partial_bit_count; | |
|
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
190 #ifndef ALT_BITSTREAM_READER //FIXME |
|
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
191 int re_index=0; |
|
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
192 int re1_index=0; |
|
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
193 #endif |
| 723 | 194 OPEN_READER(re, &s->gb); |
| 195 | |
| 196 #ifdef VLC_DEBUG | |
| 725 | 197 printf("start\n"); |
| 723 | 198 #endif |
| 199 | |
| 200 /* if we must parse a partial vlc, we do it here */ | |
| 725 | 201 partial_bit_count = mb->partial_bit_count; |
| 723 | 202 if (partial_bit_count > 0) { |
| 1064 | 203 uint8_t buf[4]; |
| 204 uint32_t v; | |
| 723 | 205 int l, l1; |
| 206 GetBitContext gb1; | |
| 207 | |
| 208 /* build the dummy bit buffer */ | |
| 209 l = 16 - partial_bit_count; | |
| 210 UPDATE_CACHE(re, &s->gb); | |
| 211 #ifdef VLC_DEBUG | |
| 212 printf("show=%04x\n", SHOW_UBITS(re, &s->gb, 16)); | |
| 213 #endif | |
| 725 | 214 v = (mb->partial_bit_buffer << l) | SHOW_UBITS(re, &s->gb, l); |
| 723 | 215 buf[0] = v >> 8; |
| 216 buf[1] = v; | |
| 217 #ifdef VLC_DEBUG | |
| 218 printf("v=%04x cnt=%d %04x\n", | |
| 725 | 219 v, partial_bit_count, (mb->partial_bit_buffer << l)); |
| 723 | 220 #endif |
| 221 /* try to read the codeword */ | |
|
1025
1f9afd8b9131
GetBitContext.size is allways multiplied by 8 -> use size_in_bits to avoid useless *8 in a few inner loops
michaelni
parents:
1008
diff
changeset
|
222 init_get_bits(&gb1, buf, 4*8); |
| 723 | 223 { |
| 224 OPEN_READER(re1, &gb1); | |
| 225 UPDATE_CACHE(re1, &gb1); | |
| 226 GET_RL_VLC(level, run, re1, &gb1, dv_rl_vlc[0], | |
| 227 TEX_VLC_BITS, 2); | |
| 228 l = re1_index; | |
| 229 CLOSE_READER(re1, &gb1); | |
| 230 } | |
| 231 #ifdef VLC_DEBUG | |
| 232 printf("****run=%d level=%d size=%d\n", run, level, l); | |
| 233 #endif | |
| 234 /* compute codeword length */ | |
| 235 l1 = (level != 256 && level != 0); | |
| 236 /* if too long, we cannot parse */ | |
| 237 l -= partial_bit_count; | |
| 238 if ((re_index + l + l1) > last_index) | |
| 239 return; | |
| 240 /* skip read bits */ | |
| 241 last_re_index = 0; /* avoid warning */ | |
| 242 re_index += l; | |
| 725 | 243 /* by definition, if we can read the vlc, all partial bits |
| 723 | 244 will be read (otherwise we could have read the vlc before) */ |
| 725 | 245 mb->partial_bit_count = 0; |
| 723 | 246 UPDATE_CACHE(re, &s->gb); |
| 247 goto handle_vlc; | |
| 248 } | |
| 249 | |
| 250 /* get the AC coefficients until last_index is reached */ | |
| 251 for(;;) { | |
| 252 UPDATE_CACHE(re, &s->gb); | |
| 253 #ifdef VLC_DEBUG | |
| 254 printf("%2d: bits=%04x index=%d\n", | |
| 255 pos, SHOW_UBITS(re, &s->gb, 16), re_index); | |
| 256 #endif | |
| 257 last_re_index = re_index; | |
| 258 GET_RL_VLC(level, run, re, &s->gb, dv_rl_vlc[0], | |
| 259 TEX_VLC_BITS, 2); | |
| 260 handle_vlc: | |
| 261 #ifdef VLC_DEBUG | |
| 262 printf("run=%d level=%d\n", run, level); | |
| 263 #endif | |
| 264 if (level == 256) { | |
| 265 if (re_index > last_index) { | |
| 266 cannot_read: | |
| 267 /* put position before read code */ | |
| 268 re_index = last_re_index; | |
| 725 | 269 mb->eob_reached = 0; |
| 723 | 270 break; |
| 271 } | |
| 272 /* EOB */ | |
| 725 | 273 mb->eob_reached = 1; |
| 723 | 274 break; |
| 275 } else if (level != 0) { | |
| 276 if ((re_index + 1) > last_index) | |
| 277 goto cannot_read; | |
| 278 sign = SHOW_SBITS(re, &s->gb, 1); | |
| 279 level = (level ^ sign) - sign; | |
| 280 LAST_SKIP_BITS(re, &s->gb, 1); | |
| 281 pos += run; | |
| 282 /* error */ | |
| 283 if (pos >= 64) { | |
| 284 goto read_error; | |
| 285 } | |
| 286 pos1 = scan_table[pos]; | |
| 725 | 287 level = level << (shift_table[pos1] + shift_offset); |
| 723 | 288 block[pos1] = level; |
| 289 // printf("run=%d level=%d shift=%d\n", run, level, shift_table[pos1]); | |
| 290 } else { | |
| 291 if (re_index > last_index) | |
| 292 goto cannot_read; | |
| 293 /* level is zero: means run without coding. No | |
| 294 sign is coded */ | |
| 295 pos += run; | |
| 296 /* error */ | |
| 297 if (pos >= 64) { | |
| 298 read_error: | |
| 299 #if defined(VLC_DEBUG) || 1 | |
|
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1567
diff
changeset
|
300 av_log(NULL, AV_LOG_ERROR, "error pos=%d\n", pos); |
| 723 | 301 #endif |
| 302 /* for errors, we consider the eob is reached */ | |
| 725 | 303 mb->eob_reached = 1; |
| 723 | 304 break; |
| 305 } | |
| 306 } | |
| 307 } | |
| 308 CLOSE_READER(re, &s->gb); | |
| 725 | 309 mb->pos = pos; |
| 723 | 310 } |
| 311 | |
| 312 static inline void bit_copy(PutBitContext *pb, GetBitContext *gb, int bits_left) | |
| 313 { | |
| 314 while (bits_left >= 16) { | |
| 315 put_bits(pb, 16, get_bits(gb, 16)); | |
| 316 bits_left -= 16; | |
| 317 } | |
| 318 if (bits_left > 0) { | |
| 319 put_bits(pb, bits_left, get_bits(gb, bits_left)); | |
| 320 } | |
| 321 } | |
| 322 | |
| 323 /* mb_x and mb_y are in units of 8 pixels */ | |
| 324 static inline void dv_decode_video_segment(DVVideoDecodeContext *s, | |
| 1064 | 325 uint8_t *buf_ptr1, |
| 326 const uint16_t *mb_pos_ptr) | |
| 723 | 327 { |
| 328 int quant, dc, dct_mode, class1, j; | |
| 329 int mb_index, mb_x, mb_y, v, last_index; | |
| 330 DCTELEM *block, *block1; | |
| 331 int c_offset, bits_left; | |
| 1064 | 332 uint8_t *y_ptr; |
| 725 | 333 BlockInfo mb_data[5 * 6], *mb, *mb1; |
| 1064 | 334 void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block); |
| 335 uint8_t *buf_ptr; | |
| 723 | 336 PutBitContext pb, vs_pb; |
| 1064 | 337 uint8_t mb_bit_buffer[80 + 4]; /* allow some slack */ |
| 725 | 338 int mb_bit_count; |
| 1064 | 339 uint8_t vs_bit_buffer[5 * 80 + 4]; /* allow some slack */ |
| 723 | 340 int vs_bit_count; |
| 341 | |
| 342 memset(s->block, 0, sizeof(s->block)); | |
| 343 | |
| 344 /* pass 1 : read DC and AC coefficients in blocks */ | |
| 345 buf_ptr = buf_ptr1; | |
| 346 block1 = &s->block[0][0]; | |
| 725 | 347 mb1 = mb_data; |
|
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
348 init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80); |
| 723 | 349 vs_bit_count = 0; |
| 350 for(mb_index = 0; mb_index < 5; mb_index++) { | |
| 351 /* skip header */ | |
| 352 quant = buf_ptr[3] & 0x0f; | |
| 353 buf_ptr += 4; | |
|
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
354 init_put_bits(&pb, mb_bit_buffer, 80); |
| 725 | 355 mb_bit_count = 0; |
| 356 mb = mb1; | |
| 723 | 357 block = block1; |
| 358 for(j = 0;j < 6; j++) { | |
| 359 /* NOTE: size is not important here */ | |
|
1025
1f9afd8b9131
GetBitContext.size is allways multiplied by 8 -> use size_in_bits to avoid useless *8 in a few inner loops
michaelni
parents:
1008
diff
changeset
|
360 init_get_bits(&s->gb, buf_ptr, 14*8); |
| 723 | 361 |
| 362 /* get the dc */ | |
| 363 dc = get_bits(&s->gb, 9); | |
| 364 dc = (dc << (32 - 9)) >> (32 - 9); | |
| 365 dct_mode = get_bits1(&s->gb); | |
| 725 | 366 mb->dct_mode = dct_mode; |
| 367 mb->scan_table = s->dv_zigzag[dct_mode]; | |
| 723 | 368 class1 = get_bits(&s->gb, 2); |
| 725 | 369 mb->shift_offset = (class1 == 3); |
| 1567 | 370 mb->shift_table = s->dv_idct_shift[dct_mode] |
| 723 | 371 [quant + dv_quant_offset[class1]]; |
| 372 dc = dc << 2; | |
| 373 /* convert to unsigned because 128 is not added in the | |
| 374 standard IDCT */ | |
| 375 dc += 1024; | |
| 376 block[0] = dc; | |
| 377 last_index = block_sizes[j]; | |
| 378 buf_ptr += last_index >> 3; | |
| 725 | 379 mb->pos = 0; |
| 380 mb->partial_bit_count = 0; | |
| 723 | 381 |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
382 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
383 printf("MB block: %d, %d ", mb_index, j); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
384 #endif |
| 725 | 385 dv_decode_ac(s, mb, block, last_index); |
| 723 | 386 |
| 387 /* write the remaining bits in a new buffer only if the | |
| 388 block is finished */ | |
|
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
389 bits_left = last_index - get_bits_count(&s->gb); |
| 725 | 390 if (mb->eob_reached) { |
| 391 mb->partial_bit_count = 0; | |
| 392 mb_bit_count += bits_left; | |
| 723 | 393 bit_copy(&pb, &s->gb, bits_left); |
| 394 } else { | |
| 395 /* should be < 16 bits otherwise a codeword could have | |
| 396 been parsed */ | |
| 725 | 397 mb->partial_bit_count = bits_left; |
| 398 mb->partial_bit_buffer = get_bits(&s->gb, bits_left); | |
| 723 | 399 } |
| 400 block += 64; | |
| 725 | 401 mb++; |
| 723 | 402 } |
| 403 | |
| 404 flush_put_bits(&pb); | |
| 405 | |
| 406 /* pass 2 : we can do it just after */ | |
| 407 #ifdef VLC_DEBUG | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
408 printf("***pass 2 size=%d MB#=%d\n", mb_bit_count, mb_index); |
| 723 | 409 #endif |
| 410 block = block1; | |
| 725 | 411 mb = mb1; |
|
1025
1f9afd8b9131
GetBitContext.size is allways multiplied by 8 -> use size_in_bits to avoid useless *8 in a few inner loops
michaelni
parents:
1008
diff
changeset
|
412 init_get_bits(&s->gb, mb_bit_buffer, 80*8); |
| 723 | 413 for(j = 0;j < 6; j++) { |
|
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
414 if (!mb->eob_reached && get_bits_count(&s->gb) < mb_bit_count) { |
| 725 | 415 dv_decode_ac(s, mb, block, mb_bit_count); |
| 723 | 416 /* if still not finished, no need to parse other blocks */ |
| 725 | 417 if (!mb->eob_reached) { |
| 723 | 418 /* we could not parse the current AC coefficient, |
| 419 so we add the remaining bytes */ | |
|
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
420 bits_left = mb_bit_count - get_bits_count(&s->gb); |
| 723 | 421 if (bits_left > 0) { |
| 725 | 422 mb->partial_bit_count += bits_left; |
| 423 mb->partial_bit_buffer = | |
| 424 (mb->partial_bit_buffer << bits_left) | | |
| 723 | 425 get_bits(&s->gb, bits_left); |
| 426 } | |
| 427 goto next_mb; | |
| 428 } | |
| 429 } | |
| 430 block += 64; | |
| 725 | 431 mb++; |
| 723 | 432 } |
| 433 /* all blocks are finished, so the extra bytes can be used at | |
| 434 the video segment level */ | |
|
1256
b8e1c17b8d7d
some libmpeg2 style bitstream reader fixes (no dv doesnt yet work with it)
michaelni
parents:
1228
diff
changeset
|
435 bits_left = mb_bit_count - get_bits_count(&s->gb); |
| 723 | 436 vs_bit_count += bits_left; |
| 437 bit_copy(&vs_pb, &s->gb, bits_left); | |
| 438 next_mb: | |
| 725 | 439 mb1 += 6; |
| 723 | 440 block1 += 6 * 64; |
| 441 } | |
| 442 | |
| 443 /* we need a pass other the whole video segment */ | |
| 444 flush_put_bits(&vs_pb); | |
| 445 | |
| 446 #ifdef VLC_DEBUG | |
| 447 printf("***pass 3 size=%d\n", vs_bit_count); | |
| 448 #endif | |
| 449 block = &s->block[0][0]; | |
| 450 mb = mb_data; | |
|
1025
1f9afd8b9131
GetBitContext.size is allways multiplied by 8 -> use size_in_bits to avoid useless *8 in a few inner loops
michaelni
parents:
1008
diff
changeset
|
451 init_get_bits(&s->gb, vs_bit_buffer, 5 * 80*8); |
| 723 | 452 for(mb_index = 0; mb_index < 5; mb_index++) { |
| 453 for(j = 0;j < 6; j++) { | |
| 725 | 454 if (!mb->eob_reached) { |
| 723 | 455 #ifdef VLC_DEBUG |
| 456 printf("start %d:%d\n", mb_index, j); | |
| 457 #endif | |
| 725 | 458 dv_decode_ac(s, mb, block, vs_bit_count); |
| 723 | 459 } |
| 460 block += 64; | |
| 725 | 461 mb++; |
| 723 | 462 } |
| 463 } | |
| 464 | |
| 465 /* compute idct and place blocks */ | |
| 466 block = &s->block[0][0]; | |
| 467 mb = mb_data; | |
| 468 for(mb_index = 0; mb_index < 5; mb_index++) { | |
| 469 v = *mb_pos_ptr++; | |
| 470 mb_x = v & 0xff; | |
| 471 mb_y = v >> 8; | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
472 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
|
473 if (s->sys->pix_fmt == PIX_FMT_YUV411P) |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
474 c_offset = (mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8); |
| 723 | 475 else |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
476 c_offset = ((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8); |
| 723 | 477 for(j = 0;j < 6; j++) { |
| 725 | 478 idct_put = s->idct_put[mb->dct_mode]; |
| 723 | 479 if (j < 4) { |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
480 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { |
| 737 | 481 /* 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
|
482 idct_put(y_ptr + (j * 8), s->picture.linesize[0], block); |
| 723 | 483 } else { |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
484 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
|
485 s->picture.linesize[0], block); |
| 723 | 486 } |
| 487 } else { | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
488 if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) { |
| 1540 | 489 uint64_t aligned_pixels[64/8]; |
| 1537 | 490 uint8_t *pixels= (uint8_t*)aligned_pixels; |
| 1540 | 491 uint8_t *c_ptr, *c_ptr1, *ptr; |
| 737 | 492 int y, linesize; |
| 493 /* NOTE: at end of line, the macroblock is handled as 420 */ | |
| 494 idct_put(pixels, 8, block); | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
495 linesize = s->picture.linesize[6 - j]; |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
496 c_ptr = s->picture.data[6 - j] + c_offset; |
| 737 | 497 ptr = pixels; |
| 498 for(y = 0;y < 8; y++) { | |
| 499 /* convert to 411P */ | |
|
1270
f5318caa93f4
seems i guessed correctly (last 411 chroma block isnt scaled but cut and reordered)
michaelni
parents:
1256
diff
changeset
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 c_ptr += linesize; |
| 737 | 506 ptr += 8; |
| 507 } | |
| 508 } else { | |
| 509 /* 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
|
510 idct_put(s->picture.data[6 - j] + c_offset, |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
511 s->picture.linesize[6 - j], block); |
| 737 | 512 } |
| 723 | 513 } |
| 514 block += 64; | |
| 725 | 515 mb++; |
| 723 | 516 } |
| 517 } | |
| 518 } | |
| 519 | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
520 /* Converts run and level (where level != 0) pair into vlc, returning bit size */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
521 static inline int dv_rl2vlc(int run, int l, uint32_t* vlc) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
522 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
523 int sign = l >> 8; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
524 int level = (l ^ sign) - sign; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
525 int size; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
526 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
527 sign = (sign & 1); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
528 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
529 if (run < 15 && level < 23 && dv_vlc_codes[run][level] != -1) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
530 *vlc = (dv_vlc_bits[dv_vlc_codes[run][level]] << 1) | sign; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
531 size = dv_vlc_len[dv_vlc_codes[run][level]] + 1; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
532 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
533 else { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
534 if (level < 23) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
535 *vlc = (dv_vlc_bits[dv_vlc_codes[0][level]] << 1) | sign; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
536 size = dv_vlc_len[dv_vlc_codes[0][level]] + 1; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
537 } else { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
538 *vlc = 0xfe00 | (level << 1) | sign; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
539 size = 16; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
540 } |
|
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 switch(run) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
543 case 0: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
544 break; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
545 case 1: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
546 case 2: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
547 *vlc |= ((0x7ce | (run - 1)) << size); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
548 size += 11; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
549 break; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
550 case 3: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
551 case 4: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
552 case 5: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
553 case 6: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
554 *vlc |= ((0xfac | (run - 3)) << size); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
555 size += 12; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
556 break; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
557 default: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
558 *vlc |= ((0x1f80 | (run - 1)) << size); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
559 size += 13; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
560 break; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
561 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
562 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
563 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
564 return size; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
565 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
566 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
567 typedef struct EncBlockInfo { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
568 int qno; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
569 int cno; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
570 int dct_mode; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
571 int block_size; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
572 DCTELEM *mb; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
573 PutBitContext pb; |
| 1567 | 574 const uint8_t* zigzag_scan; |
| 575 uint8_t *dv_shift; | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
576 } EncBlockInfo; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
577 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
578 static inline int dv_bits_left(EncBlockInfo* bi) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
579 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
580 return (bi->block_size - get_bit_count(&bi->pb)); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
581 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
582 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
583 static inline void dv_encode_ac(EncBlockInfo* bi, PutBitContext* heap) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
584 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
585 int i, level, size, run = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
586 uint32_t vlc; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
587 PutBitContext* cpb = &bi->pb; |
| 1567 | 588 int bias = (bi->cno == 3); |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
589 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
590 for (i=1; i<64; i++) { |
| 1567 | 591 level = bi->mb[bi->zigzag_scan[i]] / (1<<(bi->dv_shift[i] + bias)); |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
592 if (level != 0) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
593 size = dv_rl2vlc(run, level, &vlc); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
594 put_vlc: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
595 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
596 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
597 printf(" %3d:%3d", run, level); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
598 #endif |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
599 if (cpb == &bi->pb && size > dv_bits_left(bi)) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
600 size -= dv_bits_left(bi); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
601 put_bits(cpb, dv_bits_left(bi), vlc >> size); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
602 vlc = vlc & ((1<<size)-1); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
603 cpb = heap; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
604 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
605 put_bits(cpb, size, vlc); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
606 run = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
607 } else |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
608 run++; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
609 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
610 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
611 if (i == 64) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
612 size = 4; vlc = 6; /* End Of Block stamp */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
613 goto put_vlc; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
614 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
615 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
616 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
617 static inline void dv_redistr_bits(EncBlockInfo* bi, int count, uint8_t* extra_data, int extra_bits, PutBitContext* heap) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
618 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
619 int i; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
620 GetBitContext gb; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
621 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
622 init_get_bits(&gb, extra_data, extra_bits); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
623 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
624 for (i=0; i<count; i++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
625 int bits_left = dv_bits_left(bi); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
626 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
627 if (bits_left) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
628 printf("------------> inserting %d bytes in %d:%d\n", bits_left, i/6, i%6); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
629 #endif |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
630 if (bits_left > extra_bits) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
631 bit_copy(&bi->pb, &gb, extra_bits); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
632 extra_bits = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
633 break; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
634 } else |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
635 bit_copy(&bi->pb, &gb, bits_left); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
636 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
637 extra_bits -= bits_left; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
638 bi++; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
639 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
640 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
641 if (extra_bits > 0 && heap) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
642 bit_copy(heap, &gb, extra_bits); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
643 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
644 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
645 static inline void dv_set_class_number(EncBlockInfo* bi, int j) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
646 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
647 int i, max_ac = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
648 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
649 for (i=1; i<64; i++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
650 int ac = abs(bi->mb[ff_zigzag_direct[i]]) / 4; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
651 if (max_ac < ac) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
652 max_ac = ac; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
653 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
654 if (max_ac < 12) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
655 bi->cno = j; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
656 else if (max_ac < 24) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
657 bi->cno = j + 1; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
658 else if (max_ac < 36) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
659 bi->cno = j + 2; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
660 else |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
661 bi->cno = j + 3; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
662 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
663 if (bi->cno > 3) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
664 bi->cno = 3; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
665 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
666 |
| 1567 | 667 #define SQ(a) ((a)*(a)) |
| 668 static int dv_score_lines(DCTELEM *s, int stride) { | |
| 669 int score=0; | |
| 670 int x, y; | |
| 671 | |
| 672 for(y=0; y<4; y++) { | |
| 673 for(x=0; x<8; x+=4){ | |
| 674 score+= SQ(s[x ] - s[x +stride]) + SQ(s[x+1] - s[x+1+stride]) | |
| 675 +SQ(s[x+2] - s[x+2+stride]) + SQ(s[x+3] - s[x+3+stride]); | |
| 676 } | |
| 677 s+= stride; | |
| 678 } | |
| 679 | |
| 680 return score; | |
| 681 } | |
| 682 | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
683 /* |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
684 * This is a very rough initial implementaion. The performance is |
| 1567 | 685 * horrible and the weighting is missing. But it's missing from the |
| 686 * 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
|
687 */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
688 static inline void dv_encode_video_segment(DVVideoDecodeContext *s, |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
689 uint8_t *dif, |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
690 const uint16_t *mb_pos_ptr) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
691 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
692 int mb_index, i, j, v; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
693 int mb_x, mb_y, c_offset, linesize; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
694 uint8_t* y_ptr; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
695 uint8_t* data; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
696 int do_edge_wrap; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
697 DCTELEM *block; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
698 EncBlockInfo enc_blks[5*6]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
699 EncBlockInfo* enc_blk; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
700 int free_vs_bits; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
701 int extra_bits; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
702 PutBitContext extra_vs; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
703 uint8_t extra_vs_data[5*6*128]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
704 uint8_t extra_mb_data[6*128]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
705 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
706 int QNO = 15; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
707 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
708 /* Stage 1 -- doing DCT on 5 MBs */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
709 block = &s->block[0][0]; |
| 1567 | 710 enc_blk = &enc_blks[0]; |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
711 for(mb_index = 0; mb_index < 5; mb_index++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
712 v = *mb_pos_ptr++; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
713 mb_x = v & 0xff; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
714 mb_y = v >> 8; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
715 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
|
716 c_offset = (s->sys->pix_fmt == PIX_FMT_YUV411P) ? |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
717 ((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
|
718 (((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
|
719 do_edge_wrap = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
720 for(j = 0;j < 6; j++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
721 if (j < 4) { /* Four Y blocks */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
722 /* 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
|
723 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
|
724 data = y_ptr + (j * 8); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
725 } else { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
726 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
|
727 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
728 linesize = s->picture.linesize[0]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
729 } else { /* Cr and Cb blocks */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
730 /* 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
|
731 data = s->picture.data[6 - j] + c_offset; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
732 linesize = s->picture.linesize[6 - j]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
733 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
|
734 do_edge_wrap = 1; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
735 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
736 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
737 /* 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
|
738 if (do_edge_wrap) { /* Edge wrap copy: 4x16 -> 8x8 */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
739 uint8_t* d; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
740 DCTELEM *b = block; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
741 for (i=0;i<8;i++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
742 d = data + 8 * linesize; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
743 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
|
744 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
|
745 data += linesize; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
746 b += 8; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
747 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
748 } else { /* Simple copy: 8x8 -> 8x8 */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
749 s->get_pixels(block, data, linesize); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
750 } |
| 1567 | 751 |
| 752 if (dv_score_lines(block, 8) + dv_score_lines(block+8*4, 8) - 100 > | |
| 753 dv_score_lines(block, 16) + dv_score_lines(block+8, 16)) { | |
| 754 enc_blk->dct_mode = 1; | |
| 755 enc_blk->zigzag_scan = ff_zigzag248_direct; | |
| 756 } else { | |
| 757 enc_blk->dct_mode = 0; | |
| 758 enc_blk->zigzag_scan = ff_zigzag_direct; | |
| 759 } | |
| 760 enc_blk->mb = block; | |
| 761 enc_blk->block_size = block_sizes[j]; | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
762 |
| 1567 | 763 s->fdct[enc_blk->dct_mode](block); |
| 764 | |
| 765 dv_set_class_number(enc_blk, j/4*(j%2)); | |
| 766 | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
767 block += 64; |
| 1567 | 768 enc_blk++; |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
769 } |
|
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 |
| 1567 | 772 /* Stage 2 -- encoding by trial-and-error */ |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
773 encode_vs: |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
774 enc_blk = &enc_blks[0]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
775 for (i=0; i<5; i++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
776 uint8_t* p = dif + i*80 + 4; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
777 for (j=0; j<6; j++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
778 enc_blk->qno = QNO; |
| 1567 | 779 enc_blk->dv_shift = &(s->dv_dct_shift[0] |
| 780 [QNO + dv_quant_offset[enc_blk->cno]][0]); | |
|
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
781 init_put_bits(&enc_blk->pb, p, block_sizes[j]/8); |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
782 enc_blk++; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
783 p += block_sizes[j]/8; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
784 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
785 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
786 |
|
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
787 init_put_bits(&extra_vs, extra_vs_data, sizeof(extra_vs_data)); |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
788 free_vs_bits = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
789 enc_blk = &enc_blks[0]; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
790 for (i=0; i<5; i++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
791 PutBitContext extra_mb; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
792 EncBlockInfo* enc_blk2 = enc_blk; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
793 int free_mb_bits = 0; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
794 |
|
1522
79dddc5cd990
removed the obsolete and unused parameters of init_put_bits
alex
parents:
1507
diff
changeset
|
795 init_put_bits(&extra_mb, extra_mb_data, sizeof(extra_mb_data)); |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
796 dif[i*80 + 3] = enc_blk->qno; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
797 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
798 for (j=0; j<6; j++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
799 uint16_t dc = ((enc_blk->mb[0] >> 3) - 1024) >> 2; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
800 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
801 put_bits(&enc_blk->pb, 9, dc); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
802 put_bits(&enc_blk->pb, 1, enc_blk->dct_mode); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
803 put_bits(&enc_blk->pb, 2, enc_blk->cno); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
804 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
805 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
806 printf("[%d, %d]: ", i, j); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
807 #endif |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
808 dv_encode_ac(enc_blk, &extra_mb); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
809 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
810 printf("\n"); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
811 #endif |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
812 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
813 free_mb_bits += dv_bits_left(enc_blk); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
814 enc_blk++; |
|
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 /* We can't flush extra_mb just yet -- since it'll round up bit number */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
818 extra_bits = get_bit_count(&extra_mb); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
819 if (free_mb_bits > extra_bits) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
820 free_vs_bits += free_mb_bits - extra_bits; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
821 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
822 if (extra_bits) { /* FIXME: speed up things when free_mb_bits == 0 */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
823 flush_put_bits(&extra_mb); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
824 dv_redistr_bits(enc_blk2, 6, extra_mb_data, extra_bits, &extra_vs); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
825 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
826 } |
|
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 /* We can't flush extra_mb just yet -- since it'll round up bit number */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
829 extra_bits = get_bit_count(&extra_vs); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
830 if (extra_bits > free_vs_bits && QNO) { /* FIXME: very crude trial-and-error */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
831 QNO--; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
832 goto encode_vs; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
833 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
834 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
835 if (extra_bits) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
836 flush_put_bits(&extra_vs); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
837 dv_redistr_bits(&enc_blks[0], 5*6, extra_vs_data, extra_bits, NULL); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
838 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
839 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
840 for (i=0; i<6*5; i++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
841 flush_put_bits(&enc_blks[i].pb); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
842 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
843 printf("[%d:%d] qno=%d cno=%d\n", i/6, i%6, enc_blks[i].qno, enc_blks[i].cno); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
844 #endif |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
845 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
846 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
847 |
| 723 | 848 /* NOTE: exactly one frame must be given (120000 bytes for NTSC, |
| 849 144000 bytes for PAL) */ | |
| 850 static int dvvideo_decode_frame(AVCodecContext *avctx, | |
| 851 void *data, int *data_size, | |
| 1064 | 852 uint8_t *buf, int buf_size) |
| 723 | 853 { |
| 854 DVVideoDecodeContext *s = avctx->priv_data; | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
855 int ds, vs; |
| 1064 | 856 const uint16_t *mb_pos_ptr; |
| 723 | 857 |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
858 s->sys = dv_frame_profile(buf); |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
859 if (!s->sys || buf_size < s->sys->frame_size) |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
860 return -1; /* NOTE: we only accept several full frames */ |
| 723 | 861 |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
862 |
| 1228 | 863 if(s->picture.data[0]) |
| 864 avctx->release_buffer(avctx, &s->picture); | |
| 865 | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
866 s->picture.reference = 0; |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
867 avctx->pix_fmt = s->sys->pix_fmt; |
| 1507 | 868 avctx->width = s->sys->width; |
| 869 avctx->height = s->sys->height; | |
| 903 | 870 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
|
871 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
| 903 | 872 return -1; |
| 835 | 873 } |
|
1543
7542cb99b950
* providing MPEG codecs with a generic fields in AVFrame to use.
romansh
parents:
1540
diff
changeset
|
874 s->picture.interlaced_frame = 1; |
| 1547 | 875 s->picture.top_field_first = 0; |
| 835 | 876 |
| 723 | 877 /* for each DIF segment */ |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
878 mb_pos_ptr = s->sys->video_place; |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
879 for (ds = 0; ds < s->sys->difseg_size; ds++) { |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
880 buf += 6 * 80; /* skip DIF segment header */ |
| 723 | 881 |
| 882 for(vs = 0; vs < 27; vs++) { | |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
883 if ((vs % 3) == 0) |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
884 buf += 80; /* skip audio block */ |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
885 |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
886 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
887 printf("********************* %d, %d **********************\n", ds, vs); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
888 #endif |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
889 dv_decode_video_segment(s, buf, mb_pos_ptr); |
|
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
890 buf += 5 * 80; |
| 723 | 891 mb_pos_ptr += 5; |
| 892 } | |
| 893 } | |
| 894 | |
|
734
2d6b3e3d6c6f
10l - MMX/FPU state was not restored, causing nonsense fpu behaviour in caller (mplayer)
arpi_esp
parents:
733
diff
changeset
|
895 emms_c(); |
|
2d6b3e3d6c6f
10l - MMX/FPU state was not restored, causing nonsense fpu behaviour in caller (mplayer)
arpi_esp
parents:
733
diff
changeset
|
896 |
| 723 | 897 /* return image */ |
| 925 | 898 *data_size = sizeof(AVFrame); |
| 899 *(AVFrame*)data= s->picture; | |
| 903 | 900 |
|
1489
337d13aee605
* DV handling was streamlined for both muxing/demuxing and
romansh
parents:
1416
diff
changeset
|
901 return s->sys->frame_size; |
| 723 | 902 } |
| 903 | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
904 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
|
905 void *data) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
906 { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
907 DVVideoDecodeContext *s = c->priv_data; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
908 const uint16_t *mb_pos_ptr; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
909 int ds, vs; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
910 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
911 s->sys = dv_codec_profile(c); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
912 if (!s->sys) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
913 return -1; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
914 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
915 c->pix_fmt = s->sys->pix_fmt; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
916 s->picture = *((AVFrame *)data); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
917 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
918 /* for each DIF segment */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
919 mb_pos_ptr = s->sys->video_place; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
920 for (ds = 0; ds < s->sys->difseg_size; ds++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
921 buf += 6 * 80; /* skip DIF segment header */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
922 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
923 for(vs = 0; vs < 27; vs++) { |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
924 if ((vs % 3) == 0) |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
925 buf += 80; /* skip audio block */ |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
926 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
927 #ifdef VLC_DEBUG |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
928 printf("********************* %d, %d **********************\n", ds, vs); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
929 #endif |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
930 dv_encode_video_segment(s, buf, mb_pos_ptr); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
931 buf += 5 * 80; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
932 mb_pos_ptr += 5; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
933 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
934 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
935 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
936 emms_c(); |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
937 return s->sys->frame_size; |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
938 } |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
939 |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
940 static int dvvideo_end(AVCodecContext *avctx) |
| 723 | 941 { |
| 1214 | 942 avcodec_default_free_buffers(avctx); |
| 723 | 943 return 0; |
| 944 } | |
| 945 | |
| 946 AVCodec dvvideo_decoder = { | |
| 947 "dvvideo", | |
| 948 CODEC_TYPE_VIDEO, | |
| 949 CODEC_ID_DVVIDEO, | |
| 950 sizeof(DVVideoDecodeContext), | |
|
1493
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
951 dvvideo_init, |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
952 dvvideo_encode_frame, |
|
ad7e62df9962
* preAlpha DV encoding support -- there's still a truckload
romansh
parents:
1489
diff
changeset
|
953 dvvideo_end, |
| 723 | 954 dvvideo_decode_frame, |
| 835 | 955 CODEC_CAP_DR1, |
| 723 | 956 NULL |
| 957 }; |
