comparison dv.c @ 7615:290fd3ae1219 libavcodec

Making the number of blocks per macroblock dependent on the DV stream specification
author romansh
date Tue, 19 Aug 2008 16:01:41 +0000
parents 1afa1171b7b2
children 685ef77c9fe5
comparison
equal deleted inserted replaced
7614:1afa1171b7b2 7615:290fd3ae1219
374 /* pass 1 : read DC and AC coefficients in blocks */ 374 /* pass 1 : read DC and AC coefficients in blocks */
375 buf_ptr = buf_ptr1; 375 buf_ptr = buf_ptr1;
376 block1 = &sblock[0][0]; 376 block1 = &sblock[0][0];
377 mb1 = mb_data; 377 mb1 = mb_data;
378 init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80); 378 init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80);
379 for(mb_index = 0; mb_index < 5; mb_index++, mb1 += 6, block1 += 6 * 64) { 379 for(mb_index = 0; mb_index < 5; mb_index++, mb1 += s->sys->bpm, block1 += s->sys->bpm * 64) {
380 /* skip header */ 380 /* skip header */
381 quant = buf_ptr[3] & 0x0f; 381 quant = buf_ptr[3] & 0x0f;
382 buf_ptr += 4; 382 buf_ptr += 4;
383 init_put_bits(&pb, mb_bit_buffer, 80); 383 init_put_bits(&pb, mb_bit_buffer, 80);
384 mb = mb1; 384 mb = mb1;
385 block = block1; 385 block = block1;
386 for(j = 0;j < 6; j++) { 386 for(j = 0;j < s->sys->bpm; j++) {
387 last_index = block_sizes[j]; 387 last_index = block_sizes[j];
388 init_get_bits(&gb, buf_ptr, last_index); 388 init_get_bits(&gb, buf_ptr, last_index);
389 389
390 /* get the dc */ 390 /* get the dc */
391 dc = get_sbits(&gb, 9); 391 dc = get_sbits(&gb, 9);
424 #endif 424 #endif
425 block = block1; 425 block = block1;
426 mb = mb1; 426 mb = mb1;
427 init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb)); 427 init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
428 flush_put_bits(&pb); 428 flush_put_bits(&pb);
429 for(j = 0;j < 6; j++, block += 64, mb++) { 429 for(j = 0;j < s->sys->bpm; j++, block += 64, mb++) {
430 if (mb->pos < 64 && get_bits_left(&gb) > 0) { 430 if (mb->pos < 64 && get_bits_left(&gb) > 0) {
431 dv_decode_ac(&gb, mb, block); 431 dv_decode_ac(&gb, mb, block);
432 /* if still not finished, no need to parse other blocks */ 432 /* if still not finished, no need to parse other blocks */
433 if (mb->pos < 64) 433 if (mb->pos < 64)
434 break; 434 break;
435 } 435 }
436 } 436 }
437 /* all blocks are finished, so the extra bytes can be used at 437 /* all blocks are finished, so the extra bytes can be used at
438 the video segment level */ 438 the video segment level */
439 if (j >= 6) 439 if (j >= s->sys->bpm)
440 bit_copy(&vs_pb, &gb); 440 bit_copy(&vs_pb, &gb);
441 } 441 }
442 442
443 /* we need a pass other the whole video segment */ 443 /* we need a pass other the whole video segment */
444 #ifdef VLC_DEBUG 444 #ifdef VLC_DEBUG
447 block = &sblock[0][0]; 447 block = &sblock[0][0];
448 mb = mb_data; 448 mb = mb_data;
449 init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb)); 449 init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
450 flush_put_bits(&vs_pb); 450 flush_put_bits(&vs_pb);
451 for(mb_index = 0; mb_index < 5; mb_index++) { 451 for(mb_index = 0; mb_index < 5; mb_index++) {
452 for(j = 0;j < 6; j++) { 452 for(j = 0;j < s->sys->bpm; j++) {
453 if (mb->pos < 64) { 453 if (mb->pos < 64) {
454 #ifdef VLC_DEBUG 454 #ifdef VLC_DEBUG
455 printf("start %d:%d\n", mb_index, j); 455 printf("start %d:%d\n", mb_index, j);
456 #endif 456 #endif
457 dv_decode_ac(&gb, mb, block); 457 dv_decode_ac(&gb, mb, block);