]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Making the number of blocks per macroblock dependent on the DV stream
authorromansh <romansh@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 19 Aug 2008 16:01:41 +0000 (16:01 +0000)
committerromansh <romansh@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Tue, 19 Aug 2008 16:01:41 +0000 (16:01 +0000)
specification

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14841 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/dv.c
libavcodec/dvdata.h

index 816ccae2694879db7463b7827ab93eb0efc66514..b2a29699da43737213bacc4a73e730882c273e19 100644 (file)
@@ -376,14 +376,14 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
     block1 = &sblock[0][0];
     mb1 = mb_data;
     init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80);
-    for(mb_index = 0; mb_index < 5; mb_index++, mb1 += 6, block1 += 6 * 64) {
+    for(mb_index = 0; mb_index < 5; mb_index++, mb1 += s->sys->bpm, block1 += s->sys->bpm * 64) {
         /* skip header */
         quant = buf_ptr[3] & 0x0f;
         buf_ptr += 4;
         init_put_bits(&pb, mb_bit_buffer, 80);
         mb = mb1;
         block = block1;
-        for(j = 0;j < 6; j++) {
+        for(j = 0;j < s->sys->bpm; j++) {
             last_index = block_sizes[j];
             init_get_bits(&gb, buf_ptr, last_index);
 
@@ -426,7 +426,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
         mb = mb1;
         init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
         flush_put_bits(&pb);
-        for(j = 0;j < 6; j++, block += 64, mb++) {
+        for(j = 0;j < s->sys->bpm; j++, block += 64, mb++) {
             if (mb->pos < 64 && get_bits_left(&gb) > 0) {
                 dv_decode_ac(&gb, mb, block);
                 /* if still not finished, no need to parse other blocks */
@@ -436,7 +436,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
         }
         /* all blocks are finished, so the extra bytes can be used at
            the video segment level */
-        if (j >= 6)
+        if (j >= s->sys->bpm)
             bit_copy(&vs_pb, &gb);
     }
 
@@ -449,7 +449,7 @@ static inline void dv_decode_video_segment(DVVideoContext *s,
     init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
     flush_put_bits(&vs_pb);
     for(mb_index = 0; mb_index < 5; mb_index++) {
-        for(j = 0;j < 6; j++) {
+        for(j = 0;j < s->sys->bpm; j++) {
             if (mb->pos < 64) {
 #ifdef VLC_DEBUG
                 printf("start %d:%d\n", mb_index, j);
index 48ddfccd7a6eb7acc5340c3937ccec8fb24df69a..06b15662e7c78a49f3fb79b163f279977a95f96c 100644 (file)
@@ -49,7 +49,7 @@ typedef struct DVprofile {
     AVRational       sar[2];              /* sample aspect ratios for 4:3 and 16:9 */
     const uint16_t  *video_place;         /* positions of all DV macro blocks */
     enum PixelFormat pix_fmt;             /* picture pixel format */
-
+    int              bpm;                 /* blocks per macroblock */
     int              audio_stride;        /* size of audio_shuffle table */
     int              audio_min_samples[3];/* min ammount of audio samples */
                                           /* for 48Khz, 44.1Khz and 32Khz */
@@ -2534,6 +2534,7 @@ static const DVprofile dv_profiles[] = {
       .sar = {{10, 11}, {40, 33}},
       .video_place = dv_place_411,
       .pix_fmt = PIX_FMT_YUV411P,
+      .bpm = 6,
       .audio_stride = 90,
       .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */
       .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
@@ -2551,6 +2552,7 @@ static const DVprofile dv_profiles[] = {
       .sar = {{59, 54}, {118, 81}},
       .video_place = dv_place_420,
       .pix_fmt = PIX_FMT_YUV420P,
+      .bpm = 6,
       .audio_stride = 108,
       .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */
       .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
@@ -2568,6 +2570,7 @@ static const DVprofile dv_profiles[] = {
       .sar = {{59, 54}, {118, 81}},
       .video_place = dv_place_411P,
       .pix_fmt = PIX_FMT_YUV411P,
+      .bpm = 6,
       .audio_stride = 108,
       .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */
       .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
@@ -2585,6 +2588,7 @@ static const DVprofile dv_profiles[] = {
       .sar = {{10, 11}, {40, 33}},
       .video_place = dv_place_422_525,
       .pix_fmt = PIX_FMT_YUV422P,
+      .bpm = 6,
       .audio_stride = 90,
       .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */
       .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
@@ -2602,6 +2606,7 @@ static const DVprofile dv_profiles[] = {
       .sar = {{59, 54}, {118, 81}},
       .video_place = dv_place_422_625,
       .pix_fmt = PIX_FMT_YUV422P,
+      .bpm = 6,
       .audio_stride = 108,
       .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */
       .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },