Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master: (25 commits)
Replace custom DEBUG preprocessor trickery by the standard one.
vorbis: Remove non-compiling debug statement.
vorbis: Remove pointless DEBUG #ifdef around debug output macros.
cook: Remove non-compiling debug output.
Remove pointless #ifdefs around function declarations in a header.
Replace #ifdef + av_log() combinations by av_dlog().
Replace custom debug output functions by av_dlog().
cook: Remove unused debug functions.
Remove stray extra arguments from av_dlog() invocations.
targa: fix big-endian build
v4l2: remove one forgotten use of AVFormatParameters.pix_fmt.
vfwcap: add a framerate private option.
v4l2: add a framerate private option.
libdc1394: add a framerate private option.
fbdev: add a framerate private option.
bktr: add a framerate private option.
oma: check avio_read() return value
nutdec: remove unused variable
Remove unused variables
swscale: allocate larger buffer to handle altivec overreads.
...

Conflicts:
ffmpeg.c
libavcodec/dca.c
libavcodec/dirac.c
libavcodec/error_resilience.c
libavcodec/h264.c
libavcodec/mpeg12.c
libavcodec/mpeg4videodec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo_enc.c
libavcodec/pthread.c
libavcodec/rv10.c
libavcodec/s302m.c
libavcodec/shorten.c
libavcodec/truemotion2.c
libavcodec/utils.c
libavdevice/dv1394.c
libavdevice/fbdev.c
libavdevice/libdc1394.c
libavdevice/v4l2.c
libavformat/4xm.c
libavformat/apetag.c
libavformat/asfdec.c
libavformat/avidec.c
libavformat/mmf.c
libavformat/mpeg.c
libavformat/mpegenc.c
libavformat/mpegts.c
libavformat/oggdec.c
libavformat/oggparseogm.c
libavformat/rl2.c
libavformat/rmdec.c
libavformat/rpl.c
libavformat/rtpdec_latm.c
libavformat/sauce.c
libavformat/sol.c
libswscale/utils.c
tests/ref/vsynth1/error
tests/ref/vsynth2/error

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/06/03 12:19:30
Showing 70 changed files
... ...
@@ -1077,6 +1077,8 @@ HAVE_LIST="
1077 1077
     isatty
1078 1078
     kbhit
1079 1079
     ldbrx
1080
+    libdc1394_1
1081
+    libdc1394_2
1080 1082
     llrint
1081 1083
     llrintf
1082 1084
     local_aligned_16
... ...
@@ -2914,7 +2916,6 @@ check_mathfunc truncf
2914 2914
 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
2915 2915
 enabled libcelt    && require libcelt celt/celt.h celt_decode -lcelt0
2916 2916
 enabled frei0r     && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
2917
-enabled libdc1394  && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
2918 2917
 enabled libdirac   && require_pkg_config dirac                          \
2919 2918
     "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h"  \
2920 2919
     "dirac_decoder_init dirac_encoder_init"
... ...
@@ -2946,6 +2947,15 @@ enabled libxavs    && require  libxavs xavs.h xavs_encoder_encode -lxavs
2946 2946
 enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
2947 2947
 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
2948 2948
 
2949
+# libdc1394 check
2950
+if enabled libdc1394; then
2951
+    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
2952
+        enable libdc1394_2; } ||
2953
+    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
2954
+        enable libdc1394_1; } ||
2955
+    die "ERROR: No version of libdc1394 found "
2956
+fi
2957
+
2949 2958
 SDL_CONFIG="${cross_prefix}sdl-config"
2950 2959
 if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
2951 2960
     check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
... ...
@@ -1242,7 +1242,7 @@ static void do_video_out(AVFormatContext *s,
1242 1242
             }
1243 1243
         }
1244 1244
         sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,
1245
-                  0, ost->resample_height, ost->resample_frame.data, ost->resample_frame.linesize);
1245
+              0, ost->resample_height, final_picture->data, final_picture->linesize);
1246 1246
     }
1247 1247
 #endif
1248 1248
 
... ...
@@ -3723,7 +3723,6 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
3723 3723
 static void new_data_stream(AVFormatContext *oc, int file_idx)
3724 3724
 {
3725 3725
     AVStream *st;
3726
-    AVOutputStream *ost av_unused;
3727 3726
     AVCodec *codec=NULL;
3728 3727
     AVCodecContext *data_enc;
3729 3728
 
... ...
@@ -3732,7 +3731,7 @@ static void new_data_stream(AVFormatContext *oc, int file_idx)
3732 3732
         fprintf(stderr, "Could not alloc stream\n");
3733 3733
         ffmpeg_exit(1);
3734 3734
     }
3735
-    ost = new_output_stream(oc, file_idx);
3735
+    new_output_stream(oc, file_idx);
3736 3736
     data_enc = st->codec;
3737 3737
     output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
3738 3738
     if (!data_stream_copy) {
... ...
@@ -1760,7 +1760,7 @@ static int http_parse_request(HTTPContext *c)
1760 1760
                 }
1761 1761
             }
1762 1762
 
1763
-#ifdef DEBUG_WMP
1763
+#ifdef DEBUG
1764 1764
             http_log("\nGot request:\n%s\n", c->buffer);
1765 1765
 #endif
1766 1766
 
... ...
@@ -1790,7 +1790,7 @@ static int http_parse_request(HTTPContext *c)
1790 1790
         return 0;
1791 1791
     }
1792 1792
 
1793
-#ifdef DEBUG_WMP
1793
+#ifdef DEBUG
1794 1794
     if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
1795 1795
         http_log("\nGot request:\n%s\n", c->buffer);
1796 1796
 #endif
... ...
@@ -312,7 +312,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
312 312
                                      int win, int group_len, const float lambda)
313 313
 {
314 314
     BandCodingPath path[120][12];
315
-    int w, swb, cb, start, start2, size;
315
+    int w, swb, cb, start, size;
316 316
     int i, j;
317 317
     const int max_sfb  = sce->ics.max_sfb;
318 318
     const int run_bits = sce->ics.num_windows == 1 ? 5 : 3;
... ...
@@ -330,7 +330,6 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
330 330
         path[0][cb].run      = 0;
331 331
     }
332 332
     for (swb = 0; swb < max_sfb; swb++) {
333
-        start2 = start;
334 333
         size = sce->ics.swb_sizes[swb];
335 334
         if (sce->zeroes[win*16 + swb]) {
336 335
             for (cb = 0; cb < 12; cb++) {
... ...
@@ -414,7 +413,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
414 414
                                   int win, int group_len, const float lambda)
415 415
 {
416 416
     BandCodingPath path[120][12];
417
-    int w, swb, cb, start, start2, size;
417
+    int w, swb, cb, start, size;
418 418
     int i, j;
419 419
     const int max_sfb  = sce->ics.max_sfb;
420 420
     const int run_bits = sce->ics.num_windows == 1 ? 5 : 3;
... ...
@@ -432,7 +431,6 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
432 432
         path[0][cb].run      = 0;
433 433
     }
434 434
     for (swb = 0; swb < max_sfb; swb++) {
435
-        start2 = start;
436 435
         size = sce->ics.swb_sizes[swb];
437 436
         if (sce->zeroes[win*16 + swb]) {
438 437
             for (cb = 0; cb < 12; cb++) {
... ...
@@ -1007,12 +1005,11 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
1007 1007
                                        SingleChannelElement *sce,
1008 1008
                                        const float lambda)
1009 1009
 {
1010
-    int start = 0, i, w, w2, g;
1010
+    int i, w, w2, g;
1011 1011
     int minq = 255;
1012 1012
 
1013 1013
     memset(sce->sf_idx, 0, sizeof(sce->sf_idx));
1014 1014
     for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
1015
-        start = w*128;
1016 1015
         for (g = 0; g < sce->ics.num_swb; g++) {
1017 1016
             for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
1018 1017
                 FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
... ...
@@ -30,6 +30,7 @@
30 30
  * add temporal noise shaping
31 31
  ***********************************/
32 32
 
33
+#include "libavutil/opt.h"
33 34
 #include "avcodec.h"
34 35
 #include "put_bits.h"
35 36
 #include "dsputil.h"
... ...
@@ -489,7 +490,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
489 489
     AACEncContext *s = avctx->priv_data;
490 490
     int16_t *samples = s->samples, *samples2, *la;
491 491
     ChannelElement *cpe;
492
-    int i, ch, w, chans, tag, start_ch;
492
+    int i, ch, w, g, chans, tag, start_ch;
493 493
     const uint8_t *chan_map = aac_chan_configs[avctx->channels-1];
494 494
     int chan_el_counter[4];
495 495
     FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
... ...
@@ -587,8 +588,16 @@ static int aac_encode_frame(AVCodecContext *avctx,
587 587
                 }
588 588
             }
589 589
             s->cur_channel = start_ch;
590
-            if (cpe->common_window && s->coder->search_for_ms)
591
-                s->coder->search_for_ms(s, cpe, s->lambda);
590
+            if (s->options.stereo_mode && cpe->common_window) {
591
+                if (s->options.stereo_mode > 0) {
592
+                    IndividualChannelStream *ics = &cpe->ch[0].ics;
593
+                    for (w = 0; w < ics->num_windows; w += ics->group_len[w])
594
+                        for (g = 0;  g < ics->num_swb; g++)
595
+                            cpe->ms_mask[w*16+g] = 1;
596
+                } else if (s->coder->search_for_ms) {
597
+                    s->coder->search_for_ms(s, cpe, s->lambda);
598
+                }
599
+            }
592 600
             adjust_frame_information(s, cpe, chans);
593 601
             if (chans == 2) {
594 602
                 put_bits(&s->pb, 1, cpe->common_window);
... ...
@@ -645,6 +654,22 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
645 645
     return 0;
646 646
 }
647 647
 
648
+#define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
649
+static const AVOption aacenc_options[] = {
650
+    {"stereo_mode", "Stereo coding method", offsetof(AACEncContext, options.stereo_mode), FF_OPT_TYPE_INT, {.dbl = 0}, -1, 1, AACENC_FLAGS, "stereo_mode"},
651
+        {"auto",     "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
652
+        {"ms_off",   "Disable Mid/Side coding", 0, FF_OPT_TYPE_CONST, {.dbl =  0 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
653
+        {"ms_force", "Force Mid/Side for the whole frame if possible", 0, FF_OPT_TYPE_CONST, {.dbl =  1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
654
+    {NULL}
655
+};
656
+
657
+static const AVClass aacenc_class = {
658
+    "AAC encoder",
659
+    av_default_item_name,
660
+    aacenc_options,
661
+    LIBAVUTIL_VERSION_INT,
662
+};
663
+
648 664
 AVCodec ff_aac_encoder = {
649 665
     "aac",
650 666
     AVMEDIA_TYPE_AUDIO,
... ...
@@ -656,4 +681,5 @@ AVCodec ff_aac_encoder = {
656 656
     .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
657 657
     .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
658 658
     .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
659
+    .priv_class = &aacenc_class,
659 660
 };
... ...
@@ -30,6 +30,10 @@
30 30
 
31 31
 #include "psymodel.h"
32 32
 
33
+typedef struct AACEncOptions {
34
+    int stereo_mode;
35
+} AACEncOptions;
36
+
33 37
 struct AACEncContext;
34 38
 
35 39
 typedef struct AACCoefficientsEncoder {
... ...
@@ -48,6 +52,8 @@ extern AACCoefficientsEncoder ff_aac_coders[];
48 48
  * AAC encoder context
49 49
  */
50 50
 typedef struct AACEncContext {
51
+    AVClass *av_class;
52
+    AACEncOptions options;                       ///< encoding options
51 53
     PutBitContext pb;
52 54
     FFTContext mdct1024;                         ///< long (1024 samples) frame transform context
53 55
     FFTContext mdct128;                          ///< short (128 samples) frame transform context
... ...
@@ -66,7 +66,6 @@
66 66
 
67 67
 #define SUBBAND_SIZE    20
68 68
 #define MAX_SUBPACKETS   5
69
-//#define COOKDEBUG
70 69
 
71 70
 typedef struct {
72 71
     int *now;
... ...
@@ -166,38 +165,6 @@ typedef struct cook {
166 166
 static float     pow2tab[127];
167 167
 static float rootpow2tab[127];
168 168
 
169
-/* debug functions */
170
-
171
-#ifdef COOKDEBUG
172
-static void dump_float_table(float* table, int size, int delimiter) {
173
-    int i=0;
174
-    av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
175
-    for (i=0 ; i<size ; i++) {
176
-        av_log(NULL, AV_LOG_ERROR, "%5.1f, ", table[i]);
177
-        if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
178
-    }
179
-}
180
-
181
-static void dump_int_table(int* table, int size, int delimiter) {
182
-    int i=0;
183
-    av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
184
-    for (i=0 ; i<size ; i++) {
185
-        av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
186
-        if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
187
-    }
188
-}
189
-
190
-static void dump_short_table(short* table, int size, int delimiter) {
191
-    int i=0;
192
-    av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
193
-    for (i=0 ; i<size ; i++) {
194
-        av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
195
-        if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
196
-    }
197
-}
198
-
199
-#endif
200
-
201 169
 /*************** init functions ***************/
202 170
 
203 171
 /* table generator */
... ...
@@ -1037,7 +1004,7 @@ static int cook_decode_frame(AVCodecContext *avctx,
1037 1037
     return avctx->block_align;
1038 1038
 }
1039 1039
 
1040
-#ifdef COOKDEBUG
1040
+#ifdef DEBUG
1041 1041
 static void dump_cook_context(COOKContext *q)
1042 1042
 {
1043 1043
     //int i=0;
... ...
@@ -1055,7 +1022,6 @@ static void dump_cook_context(COOKContext *q)
1055 1055
     PRINT("samples_per_channel",q->subpacket[0].samples_per_channel);
1056 1056
     PRINT("samples_per_frame",q->subpacket[0].samples_per_frame);
1057 1057
     PRINT("subbands",q->subpacket[0].subbands);
1058
-    PRINT("random_state",q->random_state);
1059 1058
     PRINT("js_subband_start",q->subpacket[0].js_subband_start);
1060 1059
     PRINT("log2_numvector_size",q->subpacket[0].log2_numvector_size);
1061 1060
     PRINT("numvector_size",q->subpacket[0].numvector_size);
... ...
@@ -1280,7 +1246,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
1280 1280
     else
1281 1281
         avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
1282 1282
 
1283
-#ifdef COOKDEBUG
1283
+#ifdef DEBUG
1284 1284
     dump_cook_context(q);
1285 1285
 #endif
1286 1286
     return 0;
... ...
@@ -1535,8 +1535,6 @@ static void dca_exss_parse_header(DCAContext *s)
1535 1535
 {
1536 1536
     int ss_index;
1537 1537
     int blownup;
1538
-    int header_size av_unused;
1539
-    int hd_size av_unused;
1540 1538
     int num_audiop = 1;
1541 1539
     int num_assets = 1;
1542 1540
     int active_ss_mask[8];
... ...
@@ -1549,8 +1547,8 @@ static void dca_exss_parse_header(DCAContext *s)
1549 1549
     ss_index = get_bits(&s->gb, 2);
1550 1550
 
1551 1551
     blownup = get_bits1(&s->gb);
1552
-    header_size = get_bits(&s->gb, 8 + 4 * blownup) + 1;
1553
-    hd_size = get_bits_long(&s->gb, 16 + 4 * blownup) + 1;
1552
+    skip_bits(&s->gb, 8 + 4 * blownup); // header_size
1553
+    skip_bits(&s->gb, 16 + 4 * blownup); // hd_size
1554 1554
 
1555 1555
     s->static_fields = get_bits1(&s->gb);
1556 1556
     if (s->static_fields) {
... ...
@@ -245,11 +245,11 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
245 245
 int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
246 246
                                    dirac_source_params *source)
247 247
 {
248
-    unsigned version_major, version_minor av_unused;
248
+    unsigned version_major;
249 249
     unsigned video_format, picture_coding_mode;
250 250
 
251 251
     version_major  = svq3_get_ue_golomb(gb);
252
-    version_minor  = svq3_get_ue_golomb(gb);
252
+    svq3_get_ue_golomb(gb); /* version_minor */
253 253
     avctx->profile = svq3_get_ue_golomb(gb);
254 254
     avctx->level   = svq3_get_ue_golomb(gb);
255 255
     video_format   = svq3_get_ue_golomb(gb);
... ...
@@ -32,6 +32,7 @@
32 32
 #include "mpegvideo.h"
33 33
 #include "h264.h"
34 34
 #include "rectangle.h"
35
+#include "thread.h"
35 36
 
36 37
 /*
37 38
  * H264 redefines mb_intra so it is not mistakely used (its uninitialized in h264)
... ...
@@ -436,8 +437,7 @@ int score_sum=0;
436 436
                     int best_score=256*256*256*64;
437 437
                     int best_pred=0;
438 438
                     const int mot_index= (mb_x + mb_y*mot_stride) * mot_step;
439
-                    int prev_x= s->current_picture.motion_val[0][mot_index][0];
440
-                    int prev_y= s->current_picture.motion_val[0][mot_index][1];
439
+                    int prev_x, prev_y, prev_ref;
441 440
 
442 441
                     if((mb_x^mb_y^pass)&1) continue;
443 442
 
... ...
@@ -535,10 +535,26 @@ skip_mean_and_median:
535 535
                     /* zero MV */
536 536
                     pred_count++;
537 537
 
538
+                    if (!fixed[mb_xy] && 0) {
539
+                        if (s->avctx->codec_id == CODEC_ID_H264) {
540
+                            // FIXME
541
+                        } else {
542
+                            ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
543
+                                                     mb_y, 0);
544
+                        }
545
+                        prev_x = s->last_picture.motion_val[0][mot_index][0];
546
+                        prev_y = s->last_picture.motion_val[0][mot_index][1];
547
+                        prev_ref = s->last_picture.ref_index[0][4*mb_xy];
548
+                    } else {
549
+                        prev_x = s->current_picture.motion_val[0][mot_index][0];
550
+                        prev_y = s->current_picture.motion_val[0][mot_index][1];
551
+                        prev_ref = s->current_picture.ref_index[0][4*mb_xy];
552
+                    }
553
+
538 554
                     /* last MV */
539
-                    mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index][0];
540
-                    mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index][1];
541
-                    ref         [pred_count]   = s->current_picture.ref_index[0][4*mb_xy];
555
+                    mv_predictor[pred_count][0]= prev_x;
556
+                    mv_predictor[pred_count][1]= prev_y;
557
+                    ref         [pred_count]   = prev_ref;
542 558
                     pred_count++;
543 559
 
544 560
                     s->mv_dir = MV_DIR_FORWARD;
... ...
@@ -670,6 +686,12 @@ static int is_intra_more_likely(MpegEncContext *s){
670 670
                 uint8_t *mb_ptr     = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
671 671
                 uint8_t *last_mb_ptr= s->last_picture.data   [0] + mb_x*16 + mb_y*16*s->linesize;
672 672
 
673
+                if (s->avctx->codec_id == CODEC_ID_H264) {
674
+                    // FIXME
675
+                } else {
676
+                    ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
677
+                                             mb_y, 0);
678
+                }
673 679
                 is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr                    , s->linesize, 16);
674 680
                 // FIXME need await_progress() here
675 681
                 is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize, 16);
... ...
@@ -690,6 +712,7 @@ void ff_er_frame_start(MpegEncContext *s){
690 690
 
691 691
     memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t));
692 692
     s->error_count= 3*s->mb_num;
693
+    s->error_occurred = 0;
693 694
 }
694 695
 
695 696
 /**
... ...
@@ -729,7 +752,10 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en
729 729
         s->error_count -= end_i - start_i + 1;
730 730
     }
731 731
 
732
-    if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) s->error_count= INT_MAX;
732
+    if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) {
733
+        s->error_occurred = 1;
734
+        s->error_count= INT_MAX;
735
+    }
733 736
 
734 737
     if(mask == ~0x7F){
735 738
         memset(&s->error_status_table[start_xy], 0, (end_xy - start_xy) * sizeof(uint8_t));
... ...
@@ -1009,7 +1035,12 @@ void ff_er_frame_end(MpegEncContext *s){
1009 1009
                     int time_pp= s->pp_time;
1010 1010
                     int time_pb= s->pb_time;
1011 1011
 
1012
-                    // FIXME await_progress here
1012
+                    if (s->avctx->codec_id == CODEC_ID_H264) {
1013
+                        //FIXME
1014
+                    } else {
1015
+                        ff_thread_await_progress((AVFrame *) s->next_picture_ptr,
1016
+                                                 mb_y, 0);
1017
+                    }
1013 1018
                     s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp;
1014 1019
                     s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp;
1015 1020
                     s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp;
... ...
@@ -656,8 +656,11 @@ retry:
656 656
             if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
657 657
                 break;
658 658
         }else{
659
+            int prev_x=s->mb_x, prev_y=s->mb_y;
659 660
             if(ff_h263_resync(s)<0)
660 661
                 break;
662
+            if (prev_y * s->mb_width + prev_x < s->mb_y * s->mb_width + s->mb_x)
663
+                s->error_occurred = 1;
661 664
         }
662 665
 
663 666
         if(s->msmpeg4_version<4 && s->h263_pred)
... ...
@@ -246,6 +246,141 @@ static int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
246 246
     return 0;
247 247
 }
248 248
 
249
+static inline int get_lowest_part_list_y(H264Context *h, Picture *pic, int n, int height,
250
+                                 int y_offset, int list){
251
+    int raw_my= h->mv_cache[list][ scan8[n] ][1];
252
+    int filter_height= (raw_my&3) ? 2 : 0;
253
+    int full_my= (raw_my>>2) + y_offset;
254
+    int top = full_my - filter_height, bottom = full_my + height + filter_height;
255
+
256
+    return FFMAX(abs(top), bottom);
257
+}
258
+
259
+static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n, int height,
260
+                               int y_offset, int list0, int list1, int *nrefs){
261
+    MpegEncContext * const s = &h->s;
262
+    int my;
263
+
264
+    y_offset += 16*(s->mb_y >> MB_FIELD);
265
+
266
+    if(list0){
267
+        int ref_n = h->ref_cache[0][ scan8[n] ];
268
+        Picture *ref= &h->ref_list[0][ref_n];
269
+
270
+        // Error resilience puts the current picture in the ref list.
271
+        // Don't try to wait on these as it will cause a deadlock.
272
+        // Fields can wait on each other, though.
273
+        if(ref->thread_opaque != s->current_picture.thread_opaque ||
274
+           (ref->reference&3) != s->picture_structure) {
275
+            my = get_lowest_part_list_y(h, ref, n, height, y_offset, 0);
276
+            if (refs[0][ref_n] < 0) nrefs[0] += 1;
277
+            refs[0][ref_n] = FFMAX(refs[0][ref_n], my);
278
+        }
279
+    }
280
+
281
+    if(list1){
282
+        int ref_n = h->ref_cache[1][ scan8[n] ];
283
+        Picture *ref= &h->ref_list[1][ref_n];
284
+
285
+        if(ref->thread_opaque != s->current_picture.thread_opaque ||
286
+           (ref->reference&3) != s->picture_structure) {
287
+            my = get_lowest_part_list_y(h, ref, n, height, y_offset, 1);
288
+            if (refs[1][ref_n] < 0) nrefs[1] += 1;
289
+            refs[1][ref_n] = FFMAX(refs[1][ref_n], my);
290
+        }
291
+    }
292
+}
293
+
294
+/**
295
+ * Wait until all reference frames are available for MC operations.
296
+ *
297
+ * @param h the H264 context
298
+ */
299
+static void await_references(H264Context *h){
300
+    MpegEncContext * const s = &h->s;
301
+    const int mb_xy= h->mb_xy;
302
+    const int mb_type= s->current_picture.mb_type[mb_xy];
303
+    int refs[2][48];
304
+    int nrefs[2] = {0};
305
+    int ref, list;
306
+
307
+    memset(refs, -1, sizeof(refs));
308
+
309
+    if(IS_16X16(mb_type)){
310
+        get_lowest_part_y(h, refs, 0, 16, 0,
311
+                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
312
+    }else if(IS_16X8(mb_type)){
313
+        get_lowest_part_y(h, refs, 0, 8, 0,
314
+                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
315
+        get_lowest_part_y(h, refs, 8, 8, 8,
316
+                  IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
317
+    }else if(IS_8X16(mb_type)){
318
+        get_lowest_part_y(h, refs, 0, 16, 0,
319
+                  IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
320
+        get_lowest_part_y(h, refs, 4, 16, 0,
321
+                  IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
322
+    }else{
323
+        int i;
324
+
325
+        assert(IS_8X8(mb_type));
326
+
327
+        for(i=0; i<4; i++){
328
+            const int sub_mb_type= h->sub_mb_type[i];
329
+            const int n= 4*i;
330
+            int y_offset= (i&2)<<2;
331
+
332
+            if(IS_SUB_8X8(sub_mb_type)){
333
+                get_lowest_part_y(h, refs, n  , 8, y_offset,
334
+                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
335
+            }else if(IS_SUB_8X4(sub_mb_type)){
336
+                get_lowest_part_y(h, refs, n  , 4, y_offset,
337
+                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
338
+                get_lowest_part_y(h, refs, n+2, 4, y_offset+4,
339
+                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
340
+            }else if(IS_SUB_4X8(sub_mb_type)){
341
+                get_lowest_part_y(h, refs, n  , 8, y_offset,
342
+                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
343
+                get_lowest_part_y(h, refs, n+1, 8, y_offset,
344
+                          IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
345
+            }else{
346
+                int j;
347
+                assert(IS_SUB_4X4(sub_mb_type));
348
+                for(j=0; j<4; j++){
349
+                    int sub_y_offset= y_offset + 2*(j&2);
350
+                    get_lowest_part_y(h, refs, n+j, 4, sub_y_offset,
351
+                              IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
352
+                }
353
+            }
354
+        }
355
+    }
356
+
357
+    for(list=h->list_count-1; list>=0; list--){
358
+        for(ref=0; ref<48 && nrefs[list]; ref++){
359
+            int row = refs[list][ref];
360
+            if(row >= 0){
361
+                Picture *ref_pic = &h->ref_list[list][ref];
362
+                int ref_field = ref_pic->reference - 1;
363
+                int ref_field_picture = ref_pic->field_picture;
364
+                int pic_height = 16*s->mb_height >> ref_field_picture;
365
+
366
+                row <<= MB_MBAFF;
367
+                nrefs[list]--;
368
+
369
+                if(!FIELD_PICTURE && ref_field_picture){ // frame referencing two fields
370
+                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);
371
+                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1)           , pic_height-1), 0);
372
+                }else if(FIELD_PICTURE && !ref_field_picture){ // field referencing one field of a frame
373
+                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field    , pic_height-1), 0);
374
+                }else if(FIELD_PICTURE){
375
+                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);
376
+                }else{
377
+                    ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);
378
+                }
379
+            }
380
+        }
381
+    }
382
+}
383
+
249 384
 #if 0
250 385
 /**
251 386
  * DCT transforms the 16 dc values.
... ...
@@ -315,6 +450,7 @@ static void chroma_dc_dct_c(DCTELEM *block){
315 315
 static void free_tables(H264Context *h, int free_rbsp){
316 316
     int i;
317 317
     H264Context *hx;
318
+
318 319
     av_freep(&h->intra4x4_pred_mode);
319 320
     av_freep(&h->chroma_pred_mode_table);
320 321
     av_freep(&h->cbp_table);
... ...
@@ -611,6 +747,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx){
611 611
     return 0;
612 612
 }
613 613
 
614
+
614 615
 #define IN_RANGE(a, b, size) (((a) >= (b)) && ((a) < ((b)+(size))))
615 616
 static void copy_picture_range(Picture **to, Picture **from, int count, MpegEncContext *new_base, MpegEncContext *old_base)
616 617
 {
... ...
@@ -711,7 +848,8 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex
711 711
     copy_fields(h, h1, poc_lsb, redundant_pic_count);
712 712
 
713 713
     //reference lists
714
-    copy_fields(h, h1, ref_count, intra_gb);
714
+    copy_fields(h, h1, ref_count, list_count);
715
+    copy_fields(h, h1, ref_list,  intra_gb);
715 716
     copy_fields(h, h1, short_ref, cabac_init_idc);
716 717
 
717 718
     copy_picture_range(h->short_ref,   h1->short_ref,   32, s, s1);
... ...
@@ -738,6 +876,7 @@ int ff_h264_frame_start(H264Context *h){
738 738
     MpegEncContext * const s = &h->s;
739 739
     int i;
740 740
     const int pixel_shift = h->pixel_shift;
741
+    int thread_count = (s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1;
741 742
 
742 743
     if(MPV_frame_start(s, s->avctx) < 0)
743 744
         return -1;
... ...
@@ -766,7 +905,7 @@ int ff_h264_frame_start(H264Context *h){
766 766
 
767 767
     /* can't be in alloc_tables because linesize isn't known there.
768 768
      * FIXME: redo bipred weight to not require extra buffer? */
769
-    for(i = 0; i < s->avctx->thread_count; i++)
769
+    for(i = 0; i < thread_count; i++)
770 770
         if(h->thread_context[i] && !h->thread_context[i]->s.obmc_scratchpad)
771 771
             h->thread_context[i]->s.obmc_scratchpad = av_malloc(16*2*s->linesize + 8*2*s->uvlinesize);
772 772
 
... ...
@@ -2910,12 +3049,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
2910 2910
     int nal_index;
2911 2911
 
2912 2912
     h->max_contexts = (HAVE_THREADS && (s->avctx->active_thread_type&FF_THREAD_SLICE)) ? avctx->thread_count : 1;
2913
-#if 0
2914
-    int i;
2915
-    for(i=0; i<50; i++){
2916
-        av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]);
2917
-    }
2918
-#endif
2919 2913
     if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){
2920 2914
         h->current_slice = 0;
2921 2915
         if (!s->first_field)
... ...
@@ -3491,8 +3624,7 @@ AVCodec ff_h264_decoder = {
3491 3491
     ff_h264_decode_end,
3492 3492
     decode_frame,
3493 3493
     /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY |
3494
-        CODEC_CAP_FRAME_THREADS |
3495
-        CODEC_CAP_SLICE_THREADS,
3494
+        CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS,
3496 3495
     .flush= flush_dpb,
3497 3496
     .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
3498 3497
     .init_thread_copy      = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
... ...
@@ -629,7 +629,7 @@ static int decode_band(IVI5DecContext *ctx, int plane_num,
629 629
         FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
630 630
     }
631 631
 
632
-#if IVI_DEBUG
632
+#ifdef DEBUG
633 633
     if (band->checksum_present) {
634 634
         uint16_t chksum = ivi_calc_band_checksum(band);
635 635
         if (chksum != band->checksum) {
... ...
@@ -46,14 +46,6 @@
46 46
 
47 47
 #define PALETTE_COUNT 256
48 48
 
49
-/* debugging support */
50
-#define DEBUG_INTERPLAY 0
51
-#if DEBUG_INTERPLAY
52
-#define debug_interplay(x,...) av_log(NULL, AV_LOG_DEBUG, x, __VA_ARGS__)
53
-#else
54
-static inline void debug_interplay(const char *format, ...) { }
55
-#endif
56
-
57 49
 typedef struct IpvideoContext {
58 50
 
59 51
     AVCodecContext *avctx;
... ...
@@ -141,7 +133,7 @@ static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)
141 141
         y =   8 + ((B - 56) / 29);
142 142
     }
143 143
 
144
-    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
144
+    av_dlog(NULL, "    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
145 145
     return copy_from(s, &s->second_last_frame, x, y);
146 146
 }
147 147
 
... ...
@@ -169,7 +161,7 @@ static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
169 169
         y = -(  8 + ((B - 56) / 29));
170 170
     }
171 171
 
172
-    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
172
+    av_dlog(NULL, "    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
173 173
     return copy_from(s, &s->current_frame, x, y);
174 174
 }
175 175
 
... ...
@@ -192,7 +184,7 @@ static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s)
192 192
     x = -8 + BL;
193 193
     y = -8 + BH;
194 194
 
195
-    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
195
+    av_dlog(NULL, "    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
196 196
     return copy_from(s, &s->last_frame, x, y);
197 197
 }
198 198
 
... ...
@@ -207,7 +199,7 @@ static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
207 207
     x = *s->stream_ptr++;
208 208
     y = *s->stream_ptr++;
209 209
 
210
-    debug_interplay ("    motion bytes = %d, %d\n", x, y);
210
+    av_dlog(NULL, "    motion bytes = %d, %d\n", x, y);
211 211
     return copy_from(s, &s->last_frame, x, y);
212 212
 }
213 213
 
... ...
@@ -588,7 +580,7 @@ static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
588 588
     x = *s->stream_ptr++;
589 589
     y = *s->stream_ptr++;
590 590
 
591
-    debug_interplay ("    motion bytes = %d, %d\n", x, y);
591
+    av_dlog(NULL, "    motion bytes = %d, %d\n", x, y);
592 592
     return copy_from(s, &s->second_last_frame, x, y);
593 593
 }
594 594
 
... ...
@@ -965,7 +957,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
965 965
     static int frame = 0;
966 966
     GetBitContext gb;
967 967
 
968
-    debug_interplay("------------------ frame %d\n", frame);
968
+    av_dlog(NULL, "------------------ frame %d\n", frame);
969 969
     frame++;
970 970
 
971 971
     if (!s->is_16bpp) {
... ...
@@ -991,8 +983,8 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
991 991
         for (x = 0; x < s->avctx->width; x += 8) {
992 992
             opcode = get_bits(&gb, 4);
993 993
 
994
-            debug_interplay("  block @ (%3d, %3d): encoding 0x%X, data ptr @ %p\n",
995
-                            x, y, opcode, s->stream_ptr);
994
+            av_dlog(NULL, "  block @ (%3d, %3d): encoding 0x%X, data ptr @ %p\n",
995
+                    x, y, opcode, s->stream_ptr);
996 996
 
997 997
             if (!s->is_16bpp) {
998 998
                 s->pixel_ptr = s->current_frame.data[0] + x
... ...
@@ -152,7 +152,7 @@ int ff_h263_decode_mba(MpegEncContext *s)
152 152
  */
153 153
 static int h263_decode_gob_header(MpegEncContext *s)
154 154
 {
155
-    unsigned int val, gfid, gob_number;
155
+    unsigned int val, gob_number;
156 156
     int left;
157 157
 
158 158
     /* Check for GOB Start Code */
... ...
@@ -183,12 +183,12 @@ static int h263_decode_gob_header(MpegEncContext *s)
183 183
         s->qscale = get_bits(&s->gb, 5); /* SQUANT */
184 184
         if(get_bits1(&s->gb)==0)
185 185
             return -1;
186
-        gfid = get_bits(&s->gb, 2); /* GFID */
186
+        skip_bits(&s->gb, 2); /* GFID */
187 187
     }else{
188 188
         gob_number = get_bits(&s->gb, 5); /* GN */
189 189
         s->mb_x= 0;
190 190
         s->mb_y= s->gob_index* gob_number;
191
-        gfid = get_bits(&s->gb, 2); /* GFID */
191
+        skip_bits(&s->gb, 2); /* GFID */
192 192
         s->qscale = get_bits(&s->gb, 5); /* GQUANT */
193 193
     }
194 194
 
... ...
@@ -418,8 +418,8 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
418 418
                         break;
419 419
                     pos = band->scan[scan_pos];
420 420
 
421
-                    if (IVI_DEBUG && !val)
422
-                        av_log(NULL, AV_LOG_ERROR, "Val = 0 encountered!\n");
421
+                    if (!val)
422
+                        av_dlog(NULL, "Val = 0 encountered!\n");
423 423
 
424 424
                     q = (base_tab[pos] * quant) >> 9;
425 425
                     if (q > 1)
... ...
@@ -563,7 +563,7 @@ void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
563 563
 }
564 564
 
565 565
 
566
-#if IVI_DEBUG
566
+#ifdef DEBUG
567 567
 uint16_t ivi_calc_band_checksum (IVIBandDesc *band)
568 568
 {
569 569
     int         x, y;
... ...
@@ -33,8 +33,6 @@
33 33
 #include "get_bits.h"
34 34
 #include <stdint.h>
35 35
 
36
-#define IVI_DEBUG 0
37
-
38 36
 #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes
39 37
 
40 38
 /**
... ...
@@ -340,7 +338,6 @@ void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
340 340
  */
341 341
 void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch);
342 342
 
343
-#if IVI_DEBUG
344 343
 /**
345 344
  *  Calculate band checksum from band data.
346 345
  */
... ...
@@ -350,6 +347,5 @@ uint16_t ivi_calc_band_checksum (IVIBandDesc *band);
350 350
  *  Verify that band data lies in range.
351 351
  */
352 352
 int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch);
353
-#endif
354 353
 
355 354
 #endif /* AVCODEC_IVI_COMMON_H */
... ...
@@ -1670,7 +1670,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
1670 1670
 
1671 1671
         *s->current_picture_ptr->pan_scan= s1->pan_scan;
1672 1672
 
1673
-        if (HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)
1673
+        if (HAVE_PTHREADS && (avctx->active_thread_type & FF_THREAD_FRAME))
1674 1674
             ff_thread_finish_setup(avctx);
1675 1675
     }else{ //second field
1676 1676
             int i;
... ...
@@ -2004,7 +2004,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
2004 2004
             *pict= *(AVFrame*)s->current_picture_ptr;
2005 2005
             ff_print_debug_info(s, pict);
2006 2006
         } else {
2007
-            if (avctx->active_thread_type&FF_THREAD_FRAME)
2007
+            if (avctx->active_thread_type & FF_THREAD_FRAME)
2008 2008
                 s->picture_number++;
2009 2009
             /* latency of 1 frame for I- and P-frames */
2010 2010
             /* XXX: use another variable than picture_number */
... ...
@@ -2179,14 +2179,13 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
2179 2179
     Mpeg1Context *s1 = avctx->priv_data;
2180 2180
     MpegEncContext *s = &s1->mpeg_enc_ctx;
2181 2181
 
2182
-    int drop_frame_flag;
2183 2182
     int time_code_hours, time_code_minutes;
2184 2183
     int time_code_seconds, time_code_pictures;
2185 2184
     int broken_link;
2186 2185
 
2187 2186
     init_get_bits(&s->gb, buf, buf_size*8);
2188 2187
 
2189
-    drop_frame_flag = get_bits1(&s->gb);
2188
+    skip_bits1(&s->gb); /* drop_frame_flag */
2190 2189
 
2191 2190
     time_code_hours=get_bits(&s->gb,5);
2192 2191
     time_code_minutes = get_bits(&s->gb,6);
... ...
@@ -2340,7 +2339,7 @@ static int decode_chunks(AVCodecContext *avctx,
2340 2340
         buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code);
2341 2341
         if (start_code > 0x1ff){
2342 2342
             if(s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT){
2343
-                if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_SLICE){
2343
+                if(HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)){
2344 2344
                     int i;
2345 2345
                     assert(avctx->thread_count > 1);
2346 2346
 
... ...
@@ -2509,7 +2508,7 @@ static int decode_chunks(AVCodecContext *avctx,
2509 2509
                     break;
2510 2510
                 }
2511 2511
 
2512
-                if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_SLICE){
2512
+                if(HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)){
2513 2513
                     int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count;
2514 2514
                     assert(avctx->thread_count > 1);
2515 2515
                     if(threshold <= mb_y){
... ...
@@ -761,10 +761,9 @@ void ff_mpeg1_encode_init(MpegEncContext *s)
761 761
 
762 762
                 if(mv==0) len= ff_mpeg12_mbMotionVectorTable[0][1];
763 763
                 else{
764
-                    int val, bit_size, range, code;
764
+                    int val, bit_size, code;
765 765
 
766 766
                     bit_size = f_code - 1;
767
-                    range = 1 << bit_size;
768 767
 
769 768
                     val=mv;
770 769
                     if (val < 0)
... ...
@@ -397,14 +397,13 @@ int mpeg4_decode_video_packet_header(MpegEncContext *s)
397 397
         header_extension= get_bits1(&s->gb);
398 398
     }
399 399
     if(header_extension){
400
-        int time_increment;
401 400
         int time_incr=0;
402 401
 
403 402
         while (get_bits1(&s->gb) != 0)
404 403
             time_incr++;
405 404
 
406 405
         check_marker(&s->gb, "before time_increment in video packed header");
407
-        time_increment= get_bits(&s->gb, s->time_increment_bits);
406
+        skip_bits(&s->gb, s->time_increment_bits); /* time_increment */
408 407
         check_marker(&s->gb, "before vop_coding_type in video packed header");
409 408
 
410 409
         skip_bits(&s->gb, 2); /* vop coding type */
... ...
@@ -1805,16 +1804,14 @@ no_cplx_est:
1805 1805
 
1806 1806
         if (s->scalability) {
1807 1807
             GetBitContext bak= *gb;
1808
-            int ref_layer_id;
1809
-            int ref_layer_sampling_dir;
1810 1808
             int h_sampling_factor_n;
1811 1809
             int h_sampling_factor_m;
1812 1810
             int v_sampling_factor_n;
1813 1811
             int v_sampling_factor_m;
1814 1812
 
1815 1813
             s->hierachy_type= get_bits1(gb);
1816
-            ref_layer_id= get_bits(gb, 4);
1817
-            ref_layer_sampling_dir= get_bits1(gb);
1814
+            skip_bits(gb, 4);  /* ref_layer_id */
1815
+            skip_bits1(gb);    /* ref_layer_sampling_dir */
1818 1816
             h_sampling_factor_n= get_bits(gb, 5);
1819 1817
             h_sampling_factor_m= get_bits(gb, 5);
1820 1818
             v_sampling_factor_n= get_bits(gb, 5);
... ...
@@ -1993,15 +1990,13 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
1993 1993
 
1994 1994
      if (s->shape != RECT_SHAPE) {
1995 1995
          if (s->vol_sprite_usage != 1 || s->pict_type != AV_PICTURE_TYPE_I) {
1996
-             int width, height, hor_spat_ref, ver_spat_ref;
1997
-
1998
-             width = get_bits(gb, 13);
1996
+             skip_bits(gb, 13); /* width */
1999 1997
              skip_bits1(gb);   /* marker */
2000
-             height = get_bits(gb, 13);
1998
+             skip_bits(gb, 13); /* height */
2001 1999
              skip_bits1(gb);   /* marker */
2002
-             hor_spat_ref = get_bits(gb, 13); /* hor_spat_ref */
2000
+             skip_bits(gb, 13); /* hor_spat_ref */
2003 2001
              skip_bits1(gb);   /* marker */
2004
-             ver_spat_ref = get_bits(gb, 13); /* ver_spat_ref */
2002
+             skip_bits(gb, 13); /* ver_spat_ref */
2005 2003
          }
2006 2004
          skip_bits1(gb); /* change_CR_disable */
2007 2005
 
... ...
@@ -527,7 +527,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src
527 527
         s->last_pict_type= s1->pict_type;
528 528
         if (s1->current_picture_ptr) s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->quality;
529 529
 
530
-        if(s1->pict_type!=AV_PICTURE_TYPE_B){
530
+        if(s1->pict_type!=FF_B_TYPE){
531 531
             s->last_non_b_pict_type= s1->pict_type;
532 532
         }
533 533
     }
... ...
@@ -586,7 +586,8 @@ av_cold int MPV_common_init(MpegEncContext *s)
586 586
         return -1;
587 587
     }
588 588
 
589
-    if(s->avctx->active_thread_type&FF_THREAD_SLICE &&
589
+
590
+    if((s->avctx->active_thread_type & FF_THREAD_SLICE) &&
590 591
        (s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))){
591 592
         av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
592 593
         return -1;
... ...
@@ -763,6 +764,7 @@ av_cold int MPV_common_init(MpegEncContext *s)
763 763
         if(init_duplicate_context(s, s) < 0) goto fail;
764 764
         s->start_mb_y = 0;
765 765
         s->end_mb_y   = s->mb_height;
766
+
766 767
     }
767 768
 
768 769
     return 0;
... ...
@@ -2634,6 +2636,6 @@ void ff_set_qscale(MpegEncContext * s, int qscale)
2634 2634
 
2635 2635
 void MPV_report_decode_progress(MpegEncContext *s)
2636 2636
 {
2637
-    if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame)
2637
+    if (s->pict_type != FF_B_TYPE && !s->partitioned_frame && !s->error_occurred)
2638 2638
         ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0);
2639 2639
 }
... ...
@@ -474,7 +474,7 @@ typedef struct MpegEncContext {
474 474
     int last_bits; ///< temp var used for calculating the above vars
475 475
 
476 476
     /* error concealment / resync */
477
-    int error_count;
477
+    int error_count, error_occurred;
478 478
     uint8_t *error_status_table;       ///< table of the error status of each MB
479 479
 #define VP_START            1          ///< current MB is the first after a resync marker
480 480
 #define AC_ERROR            2
... ...
@@ -2759,7 +2759,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
2759 2759
 {
2760 2760
     int i;
2761 2761
     int bits;
2762
-    int context_count = s->avctx->active_thread_type&FF_THREAD_SLICE ? s->avctx->thread_count : 1;
2762
+    int context_count = (s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1;
2763 2763
 
2764 2764
     s->picture_number = picture_number;
2765 2765
 
... ...
@@ -32,7 +32,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
32 32
     uint32_t start_code;
33 33
     int frame_rate_index, ext_type, bytes_left;
34 34
     int frame_rate_ext_n, frame_rate_ext_d;
35
-    int picture_structure, top_field_first, repeat_first_field, progressive_frame;
35
+    int top_field_first, repeat_first_field, progressive_frame;
36 36
     int horiz_size_ext, vert_size_ext, bit_rate_ext;
37 37
     int did_set_size=0;
38 38
 //FIXME replace the crap with get_bits()
... ...
@@ -91,7 +91,6 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
91 91
                     break;
92 92
                 case 0x8: /* picture coding extension */
93 93
                     if (bytes_left >= 5) {
94
-                        picture_structure = buf[2]&3;
95 94
                         top_field_first = buf[3] & (1 << 7);
96 95
                         repeat_first_field = buf[3] & (1 << 1);
97 96
                         progressive_frame = buf[4] & (1 << 7);
... ...
@@ -1528,9 +1528,7 @@ int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
1528 1528
     /* the alt_bitstream reader could read over the end so we need to check it */
1529 1529
     if(left>=length && left<length+8)
1530 1530
     {
1531
-        int fps;
1532
-
1533
-        fps= get_bits(&s->gb, 5);
1531
+        skip_bits(&s->gb, 5); /* fps */
1534 1532
         s->bit_rate= get_bits(&s->gb, 11)*1024;
1535 1533
         if(s->msmpeg4_version>=3)
1536 1534
             s->flipflop_rounding= get_bits1(&s->gb);
... ...
@@ -379,7 +379,7 @@ static int decode_frame(AVCodecContext *avctx,
379 379
     AVFrame *p;
380 380
     uint8_t *crow_buf_base = NULL;
381 381
     uint32_t tag, length;
382
-    int ret, crc;
382
+    int ret;
383 383
 
384 384
     FFSWAP(AVFrame *, s->current_picture, s->last_picture);
385 385
     avctx->coded_frame= s->current_picture;
... ...
@@ -433,7 +433,7 @@ static int decode_frame(AVCodecContext *avctx,
433 433
             s->compression_type = *s->bytestream++;
434 434
             s->filter_type = *s->bytestream++;
435 435
             s->interlace_type = *s->bytestream++;
436
-            crc = bytestream_get_be32(&s->bytestream);
436
+            s->bytestream += 4; /* crc */
437 437
             s->state |= PNG_IHDR;
438 438
             av_dlog(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n",
439 439
                     s->width, s->height, s->bit_depth, s->color_type,
... ...
@@ -528,8 +528,7 @@ static int decode_frame(AVCodecContext *avctx,
528 528
             s->state |= PNG_IDAT;
529 529
             if (png_decode_idat(s, length) < 0)
530 530
                 goto fail;
531
-            /* skip crc */
532
-            crc = bytestream_get_be32(&s->bytestream);
531
+            s->bytestream += 4; /* crc */
533 532
             break;
534 533
         case MKTAG('P', 'L', 'T', 'E'):
535 534
             {
... ...
@@ -549,7 +548,7 @@ static int decode_frame(AVCodecContext *avctx,
549 549
                     s->palette[i] = (0xff << 24);
550 550
                 }
551 551
                 s->state |= PNG_PLTE;
552
-                crc = bytestream_get_be32(&s->bytestream);
552
+                s->bytestream += 4; /* crc */
553 553
             }
554 554
             break;
555 555
         case MKTAG('t', 'R', 'N', 'S'):
... ...
@@ -565,13 +564,13 @@ static int decode_frame(AVCodecContext *avctx,
565 565
                     v = *s->bytestream++;
566 566
                     s->palette[i] = (s->palette[i] & 0x00ffffff) | (v << 24);
567 567
                 }
568
-                crc = bytestream_get_be32(&s->bytestream);
568
+                s->bytestream += 4; /* crc */
569 569
             }
570 570
             break;
571 571
         case MKTAG('I', 'E', 'N', 'D'):
572 572
             if (!(s->state & PNG_ALLIMAGE))
573 573
                 goto fail;
574
-            crc = bytestream_get_be32(&s->bytestream);
574
+            s->bytestream += 4; /* crc */
575 575
             goto exit_loop;
576 576
         default:
577 577
             /* skip tag */
... ...
@@ -55,7 +55,7 @@ typedef struct ThreadContext {
55 55
 } ThreadContext;
56 56
 
57 57
 /// Max number of frame buffers that can be allocated when using frame threads.
58
-#define MAX_BUFFERS 33
58
+#define MAX_BUFFERS (32+1)
59 59
 
60 60
 /**
61 61
  * Context used by codec threads and stored in their AVCodecContext thread_opaque.
... ...
@@ -235,7 +235,7 @@ int rv_decode_dc(MpegEncContext *s, int n)
235 235
 /* read RV 1.0 compatible frame header */
236 236
 static int rv10_decode_picture_header(MpegEncContext *s)
237 237
 {
238
-    int mb_count, pb_frame, marker, unk av_unused, mb_xy;
238
+    int mb_count, pb_frame, marker, mb_xy;
239 239
 
240 240
     marker = get_bits1(&s->gb);
241 241
 
... ...
@@ -282,7 +282,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
282 282
         s->mb_y = 0;
283 283
         mb_count = s->mb_width * s->mb_height;
284 284
     }
285
-    unk= get_bits(&s->gb, 3);   /* ignored */
285
+    skip_bits(&s->gb, 3);   /* ignored */
286 286
     s->f_code = 1;
287 287
     s->unrestricted_mv = 1;
288 288
 
... ...
@@ -29,7 +29,7 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
29 29
                                     int buf_size)
30 30
 {
31 31
     uint32_t h;
32
-    int frame_size, channels, id av_unused, bits;
32
+    int frame_size, channels, bits;
33 33
 
34 34
     if (buf_size <= AES3_HEADER_LEN) {
35 35
         av_log(avctx, AV_LOG_ERROR, "frame is too short\n");
... ...
@@ -48,7 +48,6 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
48 48
     h = AV_RB32(buf);
49 49
     frame_size =  (h >> 16) & 0xffff;
50 50
     channels   = ((h >> 14) & 0x0003) * 2 +  2;
51
-    id         =  (h >>  6) & 0x00ff;
52 51
     bits       = ((h >>  4) & 0x0003) * 4 + 16;
53 52
 
54 53
     if (AES3_HEADER_LEN + frame_size != buf_size || bits > 24) {
... ...
@@ -196,7 +196,6 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header
196 196
 {
197 197
     GetBitContext hb;
198 198
     int len;
199
-    int chunk_size av_unused;
200 199
     short wave_format;
201 200
 
202 201
     init_get_bits(&hb, header, header_size*8);
... ...
@@ -205,7 +204,7 @@ static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header
205 205
         return -1;
206 206
     }
207 207
 
208
-    chunk_size = get_le32(&hb);
208
+    skip_bits_long(&hb, 32);    /* chunk_size */
209 209
 
210 210
     if (get_le32(&hb) != MKTAG('W','A','V','E')) {
211 211
         av_log(avctx, AV_LOG_ERROR, "missing WAVE tag\n");
... ...
@@ -33,7 +33,6 @@
33 33
  */
34 34
 
35 35
 
36
-//#define DEBUG_SVQ1
37 36
 #include "avcodec.h"
38 37
 #include "dsputil.h"
39 38
 #include "mpegvideo.h"
... ...
@@ -238,9 +237,9 @@ static int svq1_decode_block_intra (GetBitContext *bitbuf, uint8_t *pixels, int
238 238
     }
239 239
 
240 240
     if ((stages > 0) && (level >= 4)) {
241
-#ifdef DEBUG_SVQ1
242
-    av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",stages,level);
243
-#endif
241
+      av_dlog(NULL,
242
+              "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
243
+              stages, level);
244 244
       return -1;        /* invalid vector */
245 245
     }
246 246
 
... ...
@@ -288,9 +287,9 @@ static int svq1_decode_block_non_intra (GetBitContext *bitbuf, uint8_t *pixels,
288 288
     if (stages == -1) continue; /* skip vector */
289 289
 
290 290
     if ((stages > 0) && (level >= 4)) {
291
-#ifdef DEBUG_SVQ1
292
-    av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",stages,level);
293
-#endif
291
+      av_dlog(NULL,
292
+              "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",
293
+              stages, level);
294 294
       return -1;        /* invalid vector */
295 295
     }
296 296
 
... ...
@@ -499,9 +498,7 @@ static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf,
499 499
 
500 500
     if (result != 0)
501 501
     {
502
-#ifdef DEBUG_SVQ1
503
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_block %i\n",result);
504
-#endif
502
+      av_dlog(s->avctx, "Error in svq1_motion_inter_block %i\n", result);
505 503
       break;
506 504
     }
507 505
     result = svq1_decode_block_non_intra (bitbuf, current, pitch);
... ...
@@ -512,9 +509,7 @@ static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf,
512 512
 
513 513
     if (result != 0)
514 514
     {
515
-#ifdef DEBUG_SVQ1
516
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_4v_block %i\n",result);
517
-#endif
515
+      av_dlog(s->avctx, "Error in svq1_motion_inter_4v_block %i\n", result);
518 516
       break;
519 517
     }
520 518
     result = svq1_decode_block_non_intra (bitbuf, current, pitch);
... ...
@@ -554,9 +549,8 @@ static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) {
554 554
 
555 555
 static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
556 556
   int frame_size_code;
557
-  int temporal_reference;
558 557
 
559
-  temporal_reference = get_bits (bitbuf, 8);
558
+  skip_bits(bitbuf, 8); /* temporal_reference */
560 559
 
561 560
   /* frame type */
562 561
   s->pict_type= get_bits (bitbuf, 2)+1;
... ...
@@ -661,9 +655,7 @@ static int svq1_decode_frame(AVCodecContext *avctx,
661 661
 
662 662
   if (result != 0)
663 663
   {
664
-#ifdef DEBUG_SVQ1
665
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_frame_header %i\n",result);
666
-#endif
664
+    av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n",result);
667 665
     return result;
668 666
   }
669 667
 
... ...
@@ -712,9 +704,7 @@ static int svq1_decode_frame(AVCodecContext *avctx,
712 712
           result = svq1_decode_block_intra (&s->gb, &current[x], linesize);
713 713
           if (result != 0)
714 714
           {
715
-//#ifdef DEBUG_SVQ1
716 715
             av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
717
-//#endif
718 716
             goto err;
719 717
           }
720 718
         }
... ...
@@ -730,9 +720,7 @@ static int svq1_decode_frame(AVCodecContext *avctx,
730 730
                                             linesize, pmv, x, y);
731 731
           if (result != 0)
732 732
           {
733
-#ifdef DEBUG_SVQ1
734
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n",result);
735
-#endif
733
+            av_dlog(s->avctx, "Error in svq1_decode_delta_block %i\n",result);
736 734
             goto err;
737 735
           }
738 736
         }
... ...
@@ -108,18 +108,18 @@ static int decode_frame(AVCodecContext *avctx,
108 108
     AVFrame * const p= (AVFrame*)&s->picture;
109 109
     uint8_t *dst;
110 110
     int stride;
111
-    int idlen, pal, compr, x, y, w, h, bpp, flags;
111
+    int idlen, compr, y, w, h, bpp, flags;
112 112
     int first_clr, colors, csize;
113 113
 
114 114
     /* parse image header */
115 115
     CHECK_BUFFER_SIZE(buf, buf_end, 18, "header");
116 116
     idlen = *buf++;
117
-    pal = *buf++;
117
+    buf++; /* pal */
118 118
     compr = *buf++;
119 119
     first_clr = AV_RL16(buf); buf += 2;
120 120
     colors = AV_RL16(buf); buf += 2;
121 121
     csize = *buf++;
122
-    x = AV_RL16(buf); buf += 2;
122
+    buf += 2; /* x */
123 123
     y = AV_RL16(buf); buf += 2;
124 124
     w = AV_RL16(buf); buf += 2;
125 125
     h = AV_RL16(buf); buf += 2;
... ...
@@ -210,6 +210,7 @@ static int decode_frame(AVCodecContext *avctx,
210 210
             CHECK_BUFFER_SIZE(buf, buf_end, img_size, "image data");
211 211
             for(y = 0; y < s->height; y++){
212 212
 #if HAVE_BIGENDIAN
213
+                int x;
213 214
                 if((s->bpp + 1) >> 3 == 2){
214 215
                     uint16_t *dst16 = (uint16_t*)dst;
215 216
                     for(x = 0; x < s->width; x++)
... ...
@@ -211,19 +211,6 @@ static inline int tm2_read_header(TM2Context *ctx, const uint8_t *buf)
211 211
 /*      av_log (ctx->avctx, AV_LOG_ERROR, "TM2 old header: not implemented (yet)\n"); */
212 212
         return 40;
213 213
     } else if(magic == 0x00000101) { /* new header */
214
-        av_unused int w, h, size, flags, xr, yr, length;
215
-
216
-        length = AV_RL32(buf);
217
-        buf += 4;
218
-
219
-        init_get_bits(&ctx->gb, buf, 32 * 8);
220
-        size = get_bits_long(&ctx->gb, 31);
221
-        h = get_bits(&ctx->gb, 15);
222
-        w = get_bits(&ctx->gb, 15);
223
-        flags = get_bits_long(&ctx->gb, 31);
224
-        yr = get_bits(&ctx->gb, 9);
225
-        xr = get_bits(&ctx->gb, 9);
226
-
227 214
         return 40;
228 215
     } else {
229 216
         av_log (ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic);
... ...
@@ -75,7 +75,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
75 75
     int buf_size = avpkt->size;
76 76
     CamtasiaContext * const c = avctx->priv_data;
77 77
     const unsigned char *encoded = buf;
78
-    unsigned char *outptr;
79 78
     int zret; // Zlib return code
80 79
     int len = buf_size;
81 80
 
... ...
@@ -89,8 +88,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
89 89
         return -1;
90 90
     }
91 91
 
92
-    outptr = c->pic.data[0]; // Output image pointer
93
-
94 92
     zret = inflateReset(&(c->zstream));
95 93
     if (zret != Z_OK) {
96 94
         av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
... ...
@@ -115,7 +115,7 @@ typedef struct InternalBuffer{
115 115
     enum PixelFormat pix_fmt;
116 116
 }InternalBuffer;
117 117
 
118
-#define INTERNAL_BUFFER_SIZE 33
118
+#define INTERNAL_BUFFER_SIZE (32+1)
119 119
 
120 120
 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[4]){
121 121
     int w_align= 1;
... ...
@@ -20,9 +20,6 @@
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22 22
 
23
-#undef V_DEBUG
24
-//#define V_DEBUG
25
-
26 23
 #define ALT_BITSTREAM_READER_LE
27 24
 #include "avcodec.h"
28 25
 #include "get_bits.h"
... ...
@@ -57,7 +54,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
57 57
 
58 58
     unsigned i, j, p, code;
59 59
 
60
-#ifdef V_DEBUG
60
+#ifdef DEBUG
61 61
     GetBitContext gb;
62 62
 #endif
63 63
 
... ...
@@ -74,7 +71,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
74 74
     for (i = 0; i < bits[p]; ++i)
75 75
         exit_at_level[i+1] = 1 << i;
76 76
 
77
-#ifdef V_DEBUG
77
+#ifdef DEBUG
78 78
     av_log(NULL, AV_LOG_INFO, " %u. of %u code len %d code %d - ", p, num, bits[p], codes[p]);
79 79
     init_get_bits(&gb, (uint8_t *)&codes[p], bits[p]);
80 80
     for (i = 0; i < bits[p]; ++i)
... ...
@@ -102,7 +99,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
102 102
             exit_at_level[j] = code + (1 << (j - 1));
103 103
         codes[p] = code;
104 104
 
105
-#ifdef V_DEBUG
105
+#ifdef DEBUG
106 106
         av_log(NULL, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]);
107 107
         init_get_bits(&gb, (uint8_t *)&codes[p], bits[p]);
108 108
         for (i = 0; i < bits[p]; ++i)
... ...
@@ -20,10 +20,6 @@
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22 22
 
23
-#undef V_DEBUG
24
-//#define V_DEBUG
25
-//#define AV_DEBUG(...) av_log(NULL, AV_LOG_INFO, __VA_ARGS__)
26
-
27 23
 #include <math.h>
28 24
 
29 25
 #define ALT_BITSTREAM_READER_LE
... ...
@@ -41,10 +37,6 @@
41 41
 #define V_MAX_VLCS (1 << 16)
42 42
 #define V_MAX_PARTITIONS (1 << 20)
43 43
 
44
-#ifndef V_DEBUG
45
-#define AV_DEBUG(...)
46
-#endif
47
-
48 44
 #undef NDEBUG
49 45
 #include <assert.h>
50 46
 
... ...
@@ -245,7 +237,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
245 245
 
246 246
     vc->codebook_count = get_bits(gb, 8) + 1;
247 247
 
248
-    AV_DEBUG(" Codebooks: %d \n", vc->codebook_count);
248
+    av_dlog(NULL, " Codebooks: %d \n", vc->codebook_count);
249 249
 
250 250
     vc->codebooks = av_mallocz(vc->codebook_count * sizeof(*vc->codebooks));
251 251
     tmp_vlc_bits  = av_mallocz(V_MAX_VLCS * sizeof(*tmp_vlc_bits));
... ...
@@ -256,7 +248,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
256 256
         vorbis_codebook *codebook_setup = &vc->codebooks[cb];
257 257
         unsigned ordered, t, entries, used_entries = 0;
258 258
 
259
-        AV_DEBUG(" %u. Codebook\n", cb);
259
+        av_dlog(NULL, " %u. Codebook\n", cb);
260 260
 
261 261
         if (get_bits(gb, 24) != 0x564342) {
262 262
             av_log(vc->avccontext, AV_LOG_ERROR,
... ...
@@ -281,17 +273,17 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
281 281
 
282 282
         ordered = get_bits1(gb);
283 283
 
284
-        AV_DEBUG(" codebook_dimensions %d, codebook_entries %u\n",
285
-                 codebook_setup->dimensions, entries);
284
+        av_dlog(NULL, " codebook_dimensions %d, codebook_entries %u\n",
285
+                codebook_setup->dimensions, entries);
286 286
 
287 287
         if (!ordered) {
288 288
             unsigned ce, flag;
289 289
             unsigned sparse = get_bits1(gb);
290 290
 
291
-            AV_DEBUG(" not ordered \n");
291
+            av_dlog(NULL, " not ordered \n");
292 292
 
293 293
             if (sparse) {
294
-                AV_DEBUG(" sparse \n");
294
+                av_dlog(NULL, " sparse \n");
295 295
 
296 296
                 used_entries = 0;
297 297
                 for (ce = 0; ce < entries; ++ce) {
... ...
@@ -303,7 +295,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
303 303
                         tmp_vlc_bits[ce] = 0;
304 304
                 }
305 305
             } else {
306
-                AV_DEBUG(" not sparse \n");
306
+                av_dlog(NULL, " not sparse \n");
307 307
 
308 308
                 used_entries = entries;
309 309
                 for (ce = 0; ce < entries; ++ce)
... ...
@@ -313,17 +305,17 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
313 313
             unsigned current_entry  = 0;
314 314
             unsigned current_length = get_bits(gb, 5) + 1;
315 315
 
316
-            AV_DEBUG(" ordered, current length: %u\n", current_length);  //FIXME
316
+            av_dlog(NULL, " ordered, current length: %u\n", current_length);  //FIXME
317 317
 
318 318
             used_entries = entries;
319 319
             for (; current_entry < used_entries && current_length <= 32; ++current_length) {
320 320
                 unsigned i, number;
321 321
 
322
-                AV_DEBUG(" number bits: %u ", ilog(entries - current_entry));
322
+                av_dlog(NULL, " number bits: %u ", ilog(entries - current_entry));
323 323
 
324 324
                 number = get_bits(gb, ilog(entries - current_entry));
325 325
 
326
-                AV_DEBUG(" number: %u\n", number);
326
+                av_dlog(NULL, " number: %u\n", number);
327 327
 
328 328
                 for (i = current_entry; i < number+current_entry; ++i)
329 329
                     if (i < used_entries)
... ...
@@ -339,7 +331,8 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
339 339
 
340 340
         codebook_setup->lookup_type = get_bits(gb, 4);
341 341
 
342
-        AV_DEBUG(" lookup type: %d : %s \n", codebook_setup->lookup_type, codebook_setup->lookup_type ? "vq" : "no lookup");
342
+        av_dlog(NULL, " lookup type: %d : %s \n", codebook_setup->lookup_type,
343
+                codebook_setup->lookup_type ? "vq" : "no lookup");
343 344
 
344 345
 // If the codebook is used for (inverse) VQ, calculate codevectors.
345 346
 
... ...
@@ -352,14 +345,17 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
352 352
             unsigned codebook_value_bits = get_bits(gb, 4) + 1;
353 353
             unsigned codebook_sequence_p = get_bits1(gb);
354 354
 
355
-            AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values);
356
-            AV_DEBUG("  delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value);
355
+            av_dlog(NULL, " We expect %d numbers for building the codevectors. \n",
356
+                    codebook_lookup_values);
357
+            av_dlog(NULL, "  delta %f minmum %f \n",
358
+                    codebook_delta_value, codebook_minimum_value);
357 359
 
358 360
             for (i = 0; i < codebook_lookup_values; ++i) {
359 361
                 codebook_multiplicands[i] = get_bits(gb, codebook_value_bits);
360 362
 
361
-                AV_DEBUG(" multiplicands*delta+minmum : %e \n", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);
362
-                AV_DEBUG(" multiplicand %u\n", codebook_multiplicands[i]);
363
+                av_dlog(NULL, " multiplicands*delta+minmum : %e \n",
364
+                        (float)codebook_multiplicands[i] * codebook_delta_value + codebook_minimum_value);
365
+                av_dlog(NULL, " multiplicand %u\n", codebook_multiplicands[i]);
363 366
             }
364 367
 
365 368
 // Weed out unused vlcs and build codevector vector
... ...
@@ -374,9 +370,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
374 374
                     float last = 0.0;
375 375
                     unsigned lookup_offset = i;
376 376
 
377
-#ifdef V_DEBUG
378
-                    av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %u ,", i);
379
-#endif
377
+                    av_dlog(vc->avccontext, "Lookup offset %u ,", i);
380 378
 
381 379
                     for (k = 0; k < dim; ++k) {
382 380
                         unsigned multiplicand_offset = lookup_offset % codebook_lookup_values;
... ...
@@ -387,12 +381,11 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
387 387
                     }
388 388
                     tmp_vlc_bits[j] = tmp_vlc_bits[i];
389 389
 
390
-#ifdef V_DEBUG
391
-                    av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %u, vector: ", j);
390
+                    av_dlog(vc->avccontext, "real lookup offset %u, vector: ", j);
392 391
                     for (k = 0; k < dim; ++k)
393
-                        av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j * dim + k]);
394
-                    av_log(vc->avccontext, AV_LOG_INFO, "\n");
395
-#endif
392
+                        av_dlog(vc->avccontext, " %f ",
393
+                                codebook_setup->codevectors[j * dim + k]);
394
+                    av_dlog(vc->avccontext, "\n");
396 395
 
397 396
                     ++j;
398 397
                 }
... ...
@@ -453,8 +446,8 @@ static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc)
453 453
     for (i = 0; i < vorbis_time_count; ++i) {
454 454
         unsigned vorbis_tdtransform = get_bits(gb, 16);
455 455
 
456
-        AV_DEBUG(" Vorbis time domain transform %u: %u\n",
457
-                 vorbis_time_count, vorbis_tdtransform);
456
+        av_dlog(NULL, " Vorbis time domain transform %u: %u\n",
457
+                vorbis_time_count, vorbis_tdtransform);
458 458
 
459 459
         if (vorbis_tdtransform) {
460 460
             av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis time domain transform data nonzero. \n");
... ...
@@ -485,7 +478,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
485 485
 
486 486
         floor_setup->floor_type = get_bits(gb, 16);
487 487
 
488
-        AV_DEBUG(" %d. floor type %d \n", i, floor_setup->floor_type);
488
+        av_dlog(NULL, " %d. floor type %d \n", i, floor_setup->floor_type);
489 489
 
490 490
         if (floor_setup->floor_type == 1) {
491 491
             int maximum_class = -1;
... ...
@@ -495,29 +488,33 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
495 495
 
496 496
             floor_setup->data.t1.partitions = get_bits(gb, 5);
497 497
 
498
-            AV_DEBUG(" %d.floor: %d partitions \n", i, floor_setup->data.t1.partitions);
498
+            av_dlog(NULL, " %d.floor: %d partitions \n",
499
+                    i, floor_setup->data.t1.partitions);
499 500
 
500 501
             for (j = 0; j < floor_setup->data.t1.partitions; ++j) {
501 502
                 floor_setup->data.t1.partition_class[j] = get_bits(gb, 4);
502 503
                 if (floor_setup->data.t1.partition_class[j] > maximum_class)
503 504
                     maximum_class = floor_setup->data.t1.partition_class[j];
504 505
 
505
-                AV_DEBUG(" %d. floor %d partition class %d \n", i, j, floor_setup->data.t1.partition_class[j]);
506
+                av_dlog(NULL, " %d. floor %d partition class %d \n",
507
+                        i, j, floor_setup->data.t1.partition_class[j]);
506 508
 
507 509
             }
508 510
 
509
-            AV_DEBUG(" maximum class %d \n", maximum_class);
511
+            av_dlog(NULL, " maximum class %d \n", maximum_class);
510 512
 
511 513
             for (j = 0; j <= maximum_class; ++j) {
512 514
                 floor_setup->data.t1.class_dimensions[j] = get_bits(gb, 3) + 1;
513 515
                 floor_setup->data.t1.class_subclasses[j] = get_bits(gb, 2);
514 516
 
515
-                AV_DEBUG(" %d floor %d class dim: %d subclasses %d \n", i, j, floor_setup->data.t1.class_dimensions[j], floor_setup->data.t1.class_subclasses[j]);
517
+                av_dlog(NULL, " %d floor %d class dim: %d subclasses %d \n", i, j,
518
+                        floor_setup->data.t1.class_dimensions[j],
519
+                        floor_setup->data.t1.class_subclasses[j]);
516 520
 
517 521
                 if (floor_setup->data.t1.class_subclasses[j]) {
518 522
                     GET_VALIDATED_INDEX(floor_setup->data.t1.class_masterbook[j], 8, vc->codebook_count)
519 523
 
520
-                    AV_DEBUG("   masterbook: %d \n", floor_setup->data.t1.class_masterbook[j]);
524
+                    av_dlog(NULL, "   masterbook: %d \n", floor_setup->data.t1.class_masterbook[j]);
521 525
                 }
522 526
 
523 527
                 for (k = 0; k < (1 << floor_setup->data.t1.class_subclasses[j]); ++k) {
... ...
@@ -526,7 +523,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
526 526
                         VALIDATE_INDEX(bits, vc->codebook_count)
527 527
                     floor_setup->data.t1.subclass_books[j][k] = bits;
528 528
 
529
-                    AV_DEBUG("    book %d. : %d \n", k, floor_setup->data.t1.subclass_books[j][k]);
529
+                    av_dlog(NULL, "    book %d. : %d \n", k, floor_setup->data.t1.subclass_books[j][k]);
530 530
                 }
531 531
             }
532 532
 
... ...
@@ -555,8 +552,8 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
555 555
                 for (k = 0; k < floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; ++k, ++floor1_values) {
556 556
                     floor_setup->data.t1.list[floor1_values].x = get_bits(gb, rangebits);
557 557
 
558
-                    AV_DEBUG(" %u. floor1 Y coord. %d\n", floor1_values,
559
-                             floor_setup->data.t1.list[floor1_values].x);
558
+                    av_dlog(NULL, " %u. floor1 Y coord. %d\n", floor1_values,
559
+                            floor_setup->data.t1.list[floor1_values].x);
560 560
                 }
561 561
             }
562 562
 
... ...
@@ -608,28 +605,26 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
608 608
             if (!floor_setup->data.t0.lsp)
609 609
                 return -1;
610 610
 
611
-#ifdef V_DEBUG /* debug output parsed headers */
612
-            AV_DEBUG("floor0 order: %u\n", floor_setup->data.t0.order);
613
-            AV_DEBUG("floor0 rate: %u\n", floor_setup->data.t0.rate);
614
-            AV_DEBUG("floor0 bark map size: %u\n",
615
-                     floor_setup->data.t0.bark_map_size);
616
-            AV_DEBUG("floor0 amplitude bits: %u\n",
617
-                     floor_setup->data.t0.amplitude_bits);
618
-            AV_DEBUG("floor0 amplitude offset: %u\n",
619
-                     floor_setup->data.t0.amplitude_offset);
620
-            AV_DEBUG("floor0 number of books: %u\n",
621
-                     floor_setup->data.t0.num_books);
622
-            AV_DEBUG("floor0 book list pointer: %p\n",
623
-                     floor_setup->data.t0.book_list);
611
+            /* debug output parsed headers */
612
+            av_dlog(NULL, "floor0 order: %u\n", floor_setup->data.t0.order);
613
+            av_dlog(NULL, "floor0 rate: %u\n", floor_setup->data.t0.rate);
614
+            av_dlog(NULL, "floor0 bark map size: %u\n",
615
+                    floor_setup->data.t0.bark_map_size);
616
+            av_dlog(NULL, "floor0 amplitude bits: %u\n",
617
+                    floor_setup->data.t0.amplitude_bits);
618
+            av_dlog(NULL, "floor0 amplitude offset: %u\n",
619
+                    floor_setup->data.t0.amplitude_offset);
620
+            av_dlog(NULL, "floor0 number of books: %u\n",
621
+                    floor_setup->data.t0.num_books);
622
+            av_dlog(NULL, "floor0 book list pointer: %p\n",
623
+                    floor_setup->data.t0.book_list);
624 624
             {
625 625
                 int idx;
626 626
                 for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) {
627
-                    AV_DEBUG("  Book %d: %u\n",
628
-                             idx+1,
629
-                             floor_setup->data.t0.book_list[idx]);
627
+                    av_dlog(NULL, "  Book %d: %u\n", idx + 1,
628
+                            floor_setup->data.t0.book_list[idx]);
630 629
                 }
631 630
             }
632
-#endif
633 631
         } else {
634 632
             av_log(vc->avccontext, AV_LOG_ERROR, "Invalid floor type!\n");
635 633
             return -1;
... ...
@@ -648,7 +643,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
648 648
     vc->residue_count = get_bits(gb, 6)+1;
649 649
     vc->residues      = av_mallocz(vc->residue_count * sizeof(*vc->residues));
650 650
 
651
-    AV_DEBUG(" There are %d residues. \n", vc->residue_count);
651
+    av_dlog(NULL, " There are %d residues. \n", vc->residue_count);
652 652
 
653 653
     for (i = 0; i < vc->residue_count; ++i) {
654 654
         vorbis_residue *res_setup = &vc->residues[i];
... ...
@@ -657,7 +652,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
657 657
 
658 658
         res_setup->type = get_bits(gb, 16);
659 659
 
660
-        AV_DEBUG(" %u. residue type %d\n", i, res_setup->type);
660
+        av_dlog(NULL, " %u. residue type %d\n", i, res_setup->type);
661 661
 
662 662
         res_setup->begin          = get_bits(gb, 24);
663 663
         res_setup->end            = get_bits(gb, 24);
... ...
@@ -684,8 +679,9 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
684 684
         if (!res_setup->classifs)
685 685
             return AVERROR(ENOMEM);
686 686
 
687
-        AV_DEBUG("    begin %d end %d part.size %d classif.s %d classbook %d \n", res_setup->begin, res_setup->end, res_setup->partition_size,
688
-          res_setup->classifications, res_setup->classbook);
687
+        av_dlog(NULL, "    begin %d end %d part.size %d classif.s %d classbook %d \n",
688
+                res_setup->begin, res_setup->end, res_setup->partition_size,
689
+                res_setup->classifications, res_setup->classbook);
689 690
 
690 691
         for (j = 0; j < res_setup->classifications; ++j) {
691 692
             high_bits = 0;
... ...
@@ -694,7 +690,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
694 694
                 high_bits = get_bits(gb, 5);
695 695
             cascade[j] = (high_bits << 3) + low_bits;
696 696
 
697
-            AV_DEBUG("     %u class cascade depth: %d\n", j, ilog(cascade[j]));
697
+            av_dlog(NULL, "     %u class cascade depth: %d\n", j, ilog(cascade[j]));
698 698
         }
699 699
 
700 700
         res_setup->maxpass = 0;
... ...
@@ -703,8 +699,8 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
703 703
                 if (cascade[j]&(1 << k)) {
704 704
                     GET_VALIDATED_INDEX(res_setup->books[j][k], 8, vc->codebook_count)
705 705
 
706
-                    AV_DEBUG("     %u class cascade depth %u book: %d\n",
707
-                             j, k, res_setup->books[j][k]);
706
+                    av_dlog(NULL, "     %u class cascade depth %u book: %d\n",
707
+                            j, k, res_setup->books[j][k]);
708 708
 
709 709
                     if (k>res_setup->maxpass)
710 710
                         res_setup->maxpass = k;
... ...
@@ -727,7 +723,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
727 727
     vc->mapping_count = get_bits(gb, 6)+1;
728 728
     vc->mappings      = av_mallocz(vc->mapping_count * sizeof(*vc->mappings));
729 729
 
730
-    AV_DEBUG(" There are %d mappings. \n", vc->mapping_count);
730
+    av_dlog(NULL, " There are %d mappings. \n", vc->mapping_count);
731 731
 
732 732
     for (i = 0; i < vc->mapping_count; ++i) {
733 733
         vorbis_mapping *mapping_setup = &vc->mappings[i];
... ...
@@ -756,8 +752,8 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
756 756
             mapping_setup->coupling_steps = 0;
757 757
         }
758 758
 
759
-        AV_DEBUG("   %u mapping coupling steps: %d\n",
760
-                 i, mapping_setup->coupling_steps);
759
+        av_dlog(NULL, "   %u mapping coupling steps: %d\n",
760
+                i, mapping_setup->coupling_steps);
761 761
 
762 762
         if (get_bits(gb, 2)) {
763 763
             av_log(vc->avccontext, AV_LOG_ERROR, "%u. mapping setup data invalid.\n", i);
... ...
@@ -776,10 +772,9 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
776 776
             GET_VALIDATED_INDEX(mapping_setup->submap_floor[j],   8, vc->floor_count)
777 777
             GET_VALIDATED_INDEX(mapping_setup->submap_residue[j], 8, vc->residue_count)
778 778
 
779
-            AV_DEBUG("   %u mapping %u submap : floor %d, residue %d\n",
780
-                     i, j,
781
-                     mapping_setup->submap_floor[j],
782
-                     mapping_setup->submap_residue[j]);
779
+            av_dlog(NULL, "   %u mapping %u submap : floor %d, residue %d\n", i, j,
780
+                    mapping_setup->submap_floor[j],
781
+                    mapping_setup->submap_residue[j]);
783 782
         }
784 783
     }
785 784
     return 0;
... ...
@@ -814,12 +809,9 @@ static void create_map(vorbis_context *vc, unsigned floor_number)
814 814
         vf->map_size[blockflag] = n;
815 815
     }
816 816
 
817
-#ifdef V_DEBUG
818 817
     for (idx = 0; idx <= n; ++idx) {
819
-        AV_DEBUG("floor0 map: map at pos %d is %d\n",
820
-                 idx, map[idx]);
818
+        av_dlog(NULL, "floor0 map: map at pos %d is %d\n", idx, map[idx]);
821 819
     }
822
-#endif
823 820
 }
824 821
 
825 822
 static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
... ...
@@ -830,7 +822,7 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
830 830
     vc->mode_count = get_bits(gb, 6) + 1;
831 831
     vc->modes      = av_mallocz(vc->mode_count * sizeof(*vc->modes));
832 832
 
833
-    AV_DEBUG(" There are %d modes.\n", vc->mode_count);
833
+    av_dlog(NULL, " There are %d modes.\n", vc->mode_count);
834 834
 
835 835
     for (i = 0; i < vc->mode_count; ++i) {
836 836
         vorbis_mode *mode_setup = &vc->modes[i];
... ...
@@ -840,9 +832,9 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
840 840
         mode_setup->transformtype = get_bits(gb, 16); //FIXME check
841 841
         GET_VALIDATED_INDEX(mode_setup->mapping, 8, vc->mapping_count);
842 842
 
843
-        AV_DEBUG(" %u mode: blockflag %d, windowtype %d, transformtype %d, mapping %d\n",
844
-                 i, mode_setup->blockflag, mode_setup->windowtype,
845
-                 mode_setup->transformtype, mode_setup->mapping);
843
+        av_dlog(NULL, " %u mode: blockflag %d, windowtype %d, transformtype %d, mapping %d\n",
844
+                i, mode_setup->blockflag, mode_setup->windowtype,
845
+                mode_setup->transformtype, mode_setup->mapping);
846 846
     }
847 847
     return 0;
848 848
 }
... ...
@@ -950,7 +942,7 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
950 950
     ff_mdct_init(&vc->mdct[0], bl0, 1, -vc->scale_bias);
951 951
     ff_mdct_init(&vc->mdct[1], bl1, 1, -vc->scale_bias);
952 952
 
953
-    AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ",
953
+    av_dlog(NULL, " vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ",
954 954
             vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]);
955 955
 
956 956
 /*
... ...
@@ -1058,7 +1050,7 @@ static int vorbis_floor0_decode(vorbis_context *vc,
1058 1058
                     "floor0 dec: booknumber too high!\n");
1059 1059
             book_idx =  0;
1060 1060
         }
1061
-        AV_DEBUG("floor0 dec: booknumber: %u\n", book_idx);
1061
+        av_dlog(NULL, "floor0 dec: booknumber: %u\n", book_idx);
1062 1062
         codebook = vc->codebooks[vf->book_list[book_idx]];
1063 1063
         /* Invalid codebook! */
1064 1064
         if (!codebook.codevectors)
... ...
@@ -1067,13 +1059,13 @@ static int vorbis_floor0_decode(vorbis_context *vc,
1067 1067
         while (lsp_len<vf->order) {
1068 1068
             int vec_off;
1069 1069
 
1070
-            AV_DEBUG("floor0 dec: book dimension: %d\n", codebook.dimensions);
1071
-            AV_DEBUG("floor0 dec: maximum depth: %d\n", codebook.maxdepth);
1070
+            av_dlog(NULL, "floor0 dec: book dimension: %d\n", codebook.dimensions);
1071
+            av_dlog(NULL, "floor0 dec: maximum depth: %d\n", codebook.maxdepth);
1072 1072
             /* read temp vector */
1073 1073
             vec_off = get_vlc2(&vc->gb, codebook.vlc.table,
1074 1074
                                codebook.nb_bits, codebook.maxdepth)
1075 1075
                       * codebook.dimensions;
1076
-            AV_DEBUG("floor0 dec: vector offset: %d\n", vec_off);
1076
+            av_dlog(NULL, "floor0 dec: vector offset: %d\n", vec_off);
1077 1077
             /* copy each vector component and add last to it */
1078 1078
             for (idx = 0; idx < codebook.dimensions; ++idx)
1079 1079
                 lsp[lsp_len+idx] = codebook.codevectors[vec_off+idx] + last;
... ...
@@ -1081,14 +1073,12 @@ static int vorbis_floor0_decode(vorbis_context *vc,
1081 1081
 
1082 1082
             lsp_len += codebook.dimensions;
1083 1083
         }
1084
-#ifdef V_DEBUG
1085 1084
         /* DEBUG: output lsp coeffs */
1086 1085
         {
1087 1086
             int idx;
1088 1087
             for (idx = 0; idx < lsp_len; ++idx)
1089
-                AV_DEBUG("floor0 dec: coeff at %d is %f\n", idx, lsp[idx]);
1088
+                av_dlog(NULL, "floor0 dec: coeff at %d is %f\n", idx, lsp[idx]);
1090 1089
         }
1091
-#endif
1092 1090
 
1093 1091
         /* synthesize floor output vector */
1094 1092
         {
... ...
@@ -1099,9 +1089,6 @@ static int vorbis_floor0_decode(vorbis_context *vc,
1099 1099
             for (i = 0; i < order; i++)
1100 1100
                 lsp[i] = 2.0f * cos(lsp[i]);
1101 1101
 
1102
-            AV_DEBUG("floor0 synth: map_size = %d; m = %d; wstep = %f\n",
1103
-                     vf->map_size, order, wstep);
1104
-
1105 1102
             i = 0;
1106 1103
             while (i < vf->map_size[blockflag]) {
1107 1104
                 int j, iter_cond = vf->map[blockflag][i];
... ...
@@ -1141,7 +1128,7 @@ static int vorbis_floor0_decode(vorbis_context *vc,
1141 1141
         return 1;
1142 1142
     }
1143 1143
 
1144
-    AV_DEBUG(" Floor0 decoded\n");
1144
+    av_dlog(NULL, " Floor0 decoded\n");
1145 1145
 
1146 1146
     return 0;
1147 1147
 }
... ...
@@ -1168,7 +1155,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
1168 1168
     floor1_Y[0] = get_bits(gb, ilog(range - 1));
1169 1169
     floor1_Y[1] = get_bits(gb, ilog(range - 1));
1170 1170
 
1171
-    AV_DEBUG("floor 0 Y %d floor 1 Y %d \n", floor1_Y[0], floor1_Y[1]);
1171
+    av_dlog(NULL, "floor 0 Y %d floor 1 Y %d \n", floor1_Y[0], floor1_Y[1]);
1172 1172
 
1173 1173
     offset = 2;
1174 1174
     for (i = 0; i < vf->partitions; ++i) {
... ...
@@ -1178,7 +1165,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
1178 1178
         csub = (1 << cbits) - 1;
1179 1179
         cval = 0;
1180 1180
 
1181
-        AV_DEBUG("Cbits %u\n", cbits);
1181
+        av_dlog(NULL, "Cbits %u\n", cbits);
1182 1182
 
1183 1183
         if (cbits) // this reads all subclasses for this partition's class
1184 1184
             cval = get_vlc2(gb, vc->codebooks[vf->class_masterbook[partition_class]].vlc.table,
... ...
@@ -1187,8 +1174,8 @@ static int vorbis_floor1_decode(vorbis_context *vc,
1187 1187
         for (j = 0; j < cdim; ++j) {
1188 1188
             book = vf->subclass_books[partition_class][cval & csub];
1189 1189
 
1190
-            AV_DEBUG("book %d Cbits %u cval %u  bits:%d\n",
1191
-                     book, cbits, cval, get_bits_count(gb));
1190
+            av_dlog(NULL, "book %d Cbits %u cval %u  bits:%d\n",
1191
+                    book, cbits, cval, get_bits_count(gb));
1192 1192
 
1193 1193
             cval = cval >> cbits;
1194 1194
             if (book > -1) {
... ...
@@ -1198,7 +1185,8 @@ static int vorbis_floor1_decode(vorbis_context *vc,
1198 1198
                 floor1_Y[offset+j] = 0;
1199 1199
             }
1200 1200
 
1201
-            AV_DEBUG(" floor(%d) = %d \n", vf->list[offset+j].x, floor1_Y[offset+j]);
1201
+            av_dlog(NULL, " floor(%d) = %d \n",
1202
+                    vf->list[offset+j].x, floor1_Y[offset+j]);
1202 1203
         }
1203 1204
         offset+=cdim;
1204 1205
     }
... ...
@@ -1256,15 +1244,15 @@ static int vorbis_floor1_decode(vorbis_context *vc,
1256 1256
             floor1_Y_final[i] = predicted;
1257 1257
         }
1258 1258
 
1259
-        AV_DEBUG(" Decoded floor(%d) = %u / val %u\n",
1260
-                 vf->list[i].x, floor1_Y_final[i], val);
1259
+        av_dlog(NULL, " Decoded floor(%d) = %u / val %u\n",
1260
+                vf->list[i].x, floor1_Y_final[i], val);
1261 1261
     }
1262 1262
 
1263 1263
 // Curve synth - connect the calculated dots and convert from dB scale FIXME optimize ?
1264 1264
 
1265 1265
     ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x);
1266 1266
 
1267
-    AV_DEBUG(" Floor decoded\n");
1267
+    av_dlog(NULL, " Floor decoded\n");
1268 1268
 
1269 1269
     return 0;
1270 1270
 }
... ...
@@ -1295,7 +1283,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1295 1295
         ch_used = ch;
1296 1296
     }
1297 1297
 
1298
-    AV_DEBUG(" residue type 0/1/2 decode begin, ch: %d  cpc %d  \n", ch, c_p_c);
1298
+    av_dlog(NULL, " residue type 0/1/2 decode begin, ch: %d  cpc %d  \n", ch, c_p_c);
1299 1299
 
1300 1300
     for (pass = 0; pass <= vr->maxpass; ++pass) { // FIXME OPTIMIZE?
1301 1301
         uint16_t voffset, partition_count, j_times_ptns_to_read;
... ...
@@ -1309,7 +1297,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1309 1309
                         unsigned temp = get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table,
1310 1310
                                                  vc->codebooks[vr->classbook].nb_bits, 3);
1311 1311
 
1312
-                        AV_DEBUG("Classword: %u\n", temp);
1312
+                        av_dlog(NULL, "Classword: %u\n", temp);
1313 1313
 
1314 1314
                         assert(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
1315 1315
                         for (i = 0; i < c_p_c; ++i) {
... ...
@@ -1354,7 +1342,8 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1354 1354
                                     for (l = 0; l < dim; ++l, ++voffs) {
1355 1355
                                         vec[voffs]+=codebook.codevectors[coffs+l];  // FPMATH
1356 1356
 
1357
-                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d  \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs);
1357
+                                        av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d  \n",
1358
+                                                pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs);
1358 1359
                                     }
1359 1360
                                 }
1360 1361
                             } else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) { // most frequent case optimized
... ...
@@ -1381,7 +1370,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1381 1381
                                         vec[voffs       ] += codebook.codevectors[coffs + l    ];  // FPMATH
1382 1382
                                         vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];  // FPMATH
1383 1383
 
1384
-                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l);
1384
+                                        av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n",
1385
+                                                pass, voffset / ch + (voffs % ch) * vlen,
1386
+                                                vec[voffset / ch + (voffs % ch) * vlen],
1387
+                                                codebook.codevectors[coffs + l], coffs, l);
1385 1388
                                     }
1386 1389
                                 }
1387 1390
 
... ...
@@ -1393,7 +1385,10 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
1393 1393
                                     for (l = 0; l < dim; ++l, ++voffs) {
1394 1394
                                         vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l];  // FPMATH FIXME use if and counter instead of / and %
1395 1395
 
1396
-                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l);
1396
+                                        av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n",
1397
+                                                pass, voffset / ch + (voffs % ch) * vlen,
1398
+                                                vec[voffset / ch + (voffs % ch) * vlen],
1399
+                                                codebook.codevectors[coffs + l], coffs, l);
1397 1400
                                     }
1398 1401
                                 }
1399 1402
                             }
... ...
@@ -1481,8 +1476,8 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
1481 1481
     vc->mode_number = mode_number;
1482 1482
     mapping = &vc->mappings[vc->modes[mode_number].mapping];
1483 1483
 
1484
-    AV_DEBUG(" Mode number: %u , mapping: %d , blocktype %d\n", mode_number,
1485
-             vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag);
1484
+    av_dlog(NULL, " Mode number: %u , mapping: %d , blocktype %d\n", mode_number,
1485
+            vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag);
1486 1486
 
1487 1487
     blockflag = vc->modes[mode_number].blockflag;
1488 1488
     blocksize = vc->blocksize[blockflag];
... ...
@@ -1611,7 +1606,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
1611 1611
     if (!buf_size)
1612 1612
         return 0;
1613 1613
 
1614
-    AV_DEBUG("packet length %d \n", buf_size);
1614
+    av_dlog(NULL, "packet length %d \n", buf_size);
1615 1615
 
1616 1616
     init_get_bits(gb, buf, buf_size*8);
1617 1617
 
... ...
@@ -1628,7 +1623,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext,
1628 1628
         return buf_size ;
1629 1629
     }
1630 1630
 
1631
-    AV_DEBUG("parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", get_bits_count(gb)/8, get_bits_count(gb)%8, len);
1631
+    av_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
1632
+            get_bits_count(gb) / 8, get_bits_count(gb) % 8, len);
1632 1633
 
1633 1634
     if (vc->audio_channels > 8) {
1634 1635
         for (i = 0; i < vc->audio_channels; i++)
... ...
@@ -90,14 +90,6 @@
90 90
 #define CPLZ_TAG MKBETAG('C', 'P', 'L', 'Z')
91 91
 #define VPTZ_TAG MKBETAG('V', 'P', 'T', 'Z')
92 92
 
93
-#define VQA_DEBUG 0
94
-
95
-#if VQA_DEBUG
96
-#define vqa_debug printf
97
-#else
98
-static inline void vqa_debug(const char *format, ...) { }
99
-#endif
100
-
101 93
 typedef struct VqaContext {
102 94
 
103 95
     AVCodecContext *avctx;
... ...
@@ -213,7 +205,7 @@ static void decode_format80(const unsigned char *src, int src_size,
213 213
 
214 214
     while (src_index < src_size) {
215 215
 
216
-        vqa_debug("      opcode %02X: ", src[src_index]);
216
+        av_dlog(NULL, "      opcode %02X: ", src[src_index]);
217 217
 
218 218
         /* 0x80 means that frame is finished */
219 219
         if (src[src_index] == 0x80)
... ...
@@ -232,7 +224,7 @@ static void decode_format80(const unsigned char *src, int src_size,
232 232
             src_index += 2;
233 233
             src_pos = AV_RL16(&src[src_index]);
234 234
             src_index += 2;
235
-            vqa_debug("(1) copy %X bytes from absolute pos %X\n", count, src_pos);
235
+            av_dlog(NULL, "(1) copy %X bytes from absolute pos %X\n", count, src_pos);
236 236
             CHECK_COUNT();
237 237
             for (i = 0; i < count; i++)
238 238
                 dest[dest_index + i] = dest[src_pos + i];
... ...
@@ -244,7 +236,7 @@ static void decode_format80(const unsigned char *src, int src_size,
244 244
             count = AV_RL16(&src[src_index]);
245 245
             src_index += 2;
246 246
             color = src[src_index++];
247
-            vqa_debug("(2) set %X bytes to %02X\n", count, color);
247
+            av_dlog(NULL, "(2) set %X bytes to %02X\n", count, color);
248 248
             CHECK_COUNT();
249 249
             memset(&dest[dest_index], color, count);
250 250
             dest_index += count;
... ...
@@ -254,7 +246,7 @@ static void decode_format80(const unsigned char *src, int src_size,
254 254
             count = (src[src_index++] & 0x3F) + 3;
255 255
             src_pos = AV_RL16(&src[src_index]);
256 256
             src_index += 2;
257
-            vqa_debug("(3) copy %X bytes from absolute pos %X\n", count, src_pos);
257
+            av_dlog(NULL, "(3) copy %X bytes from absolute pos %X\n", count, src_pos);
258 258
             CHECK_COUNT();
259 259
             for (i = 0; i < count; i++)
260 260
                 dest[dest_index + i] = dest[src_pos + i];
... ...
@@ -263,7 +255,7 @@ static void decode_format80(const unsigned char *src, int src_size,
263 263
         } else if (src[src_index] > 0x80) {
264 264
 
265 265
             count = src[src_index++] & 0x3F;
266
-            vqa_debug("(4) copy %X bytes from source to dest\n", count);
266
+            av_dlog(NULL, "(4) copy %X bytes from source to dest\n", count);
267 267
             CHECK_COUNT();
268 268
             memcpy(&dest[dest_index], &src[src_index], count);
269 269
             src_index += count;
... ...
@@ -274,7 +266,7 @@ static void decode_format80(const unsigned char *src, int src_size,
274 274
             count = ((src[src_index] & 0x70) >> 4) + 3;
275 275
             src_pos = AV_RB16(&src[src_index]) & 0x0FFF;
276 276
             src_index += 2;
277
-            vqa_debug("(5) copy %X bytes from relpos %X\n", count, src_pos);
277
+            av_dlog(NULL, "(5) copy %X bytes from relpos %X\n", count, src_pos);
278 278
             CHECK_COUNT();
279 279
             for (i = 0; i < count; i++)
280 280
                 dest[dest_index + i] = dest[dest_index - src_pos + i];
... ...
@@ -133,7 +133,7 @@ ADD4x4IDCT avx
133 133
 %macro ADD16_OP 3
134 134
     cmp          byte [r4+%3], 0
135 135
     jz .skipblock%2
136
-    mov         r5d, dword [r1+%2*4]
136
+    mov         r5d, [r1+%2*4]
137 137
     call add4x4_idct_%1
138 138
 .skipblock%2:
139 139
 %if %2<15
... ...
@@ -159,7 +159,7 @@ cglobal h264_idct_add16_10_%1, 5,6
159 159
     ADD16_OP %1, 13, 7+3*8
160 160
     ADD16_OP %1, 14, 6+4*8
161 161
     ADD16_OP %1, 15, 7+4*8
162
-    RET
162
+    REP_RET
163 163
 %endmacro
164 164
 
165 165
 INIT_XMM
... ...
@@ -201,7 +201,7 @@ IDCT_ADD16_10 avx
201 201
 
202 202
 INIT_MMX
203 203
 cglobal h264_idct_dc_add_10_mmx2,3,3
204
-    movd      m0, dword [r1]
204
+    movd      m0, [r1]
205 205
     paddd     m0, [pd_32]
206 206
     psrad     m0, 6
207 207
     lea       r1, [r2*3]
... ...
@@ -215,7 +215,7 @@ cglobal h264_idct_dc_add_10_mmx2,3,3
215 215
 ;-----------------------------------------------------------------------------
216 216
 %macro IDCT8_DC_ADD 1
217 217
 cglobal h264_idct8_dc_add_10_%1,3,3,7
218
-    mov      r1d, dword [r1]
218
+    mov      r1d, [r1]
219 219
     add       r1, 32
220 220
     sar       r1, 6
221 221
     movd      m0, r1d
... ...
@@ -240,26 +240,27 @@ IDCT8_DC_ADD avx
240 240
 ;-----------------------------------------------------------------------------
241 241
 %macro AC 2
242 242
 .ac%2
243
-    mov  r5d, dword [r1+(%2+0)*4]
243
+    mov  r5d, [r1+(%2+0)*4]
244 244
     call add4x4_idct_%1
245
-    mov  r5d, dword [r1+(%2+1)*4]
245
+    mov  r5d, [r1+(%2+1)*4]
246 246
     add  r2, 64
247 247
     call add4x4_idct_%1
248 248
     add  r2, 64
249 249
     jmp .skipadd%2
250 250
 %endmacro
251 251
 
252
+%assign last_block 16
252 253
 %macro ADD16_OP_INTRA 3
253
-    cmp         word [r4+%3], 0
254
+    cmp      word [r4+%3], 0
254 255
     jnz .ac%2
255
-    mov         r6d, dword [r2+ 0]
256
-    or          r6d, dword [r2+64]
256
+    mov      r5d, [r2+ 0]
257
+    or       r5d, [r2+64]
257 258
     jz .skipblock%2
258
-    mov  r5d, dword [r1+(%2+0)*4]
259
+    mov      r5d, [r1+(%2+0)*4]
259 260
     call idct_dc_add_%1
260 261
 .skipblock%2:
261
-%if %2<15
262
-    add          r2, 128
262
+%if %2<last_block-2
263
+    add       r2, 128
263 264
 %endif
264 265
 .skipadd%2:
265 266
 %endmacro
... ...
@@ -287,12 +288,15 @@ cglobal h264_idct_add16intra_10_%1,5,7,8
287 287
     ADD16_OP_INTRA %1, 10, 4+4*8
288 288
     ADD16_OP_INTRA %1, 12, 6+3*8
289 289
     ADD16_OP_INTRA %1, 14, 6+4*8
290
-    RET
291
-%assign i 14
292
-%rep 8
293
-    AC %1, i
294
-%assign i i-2
295
-%endrep
290
+    REP_RET
291
+    AC %1, 8
292
+    AC %1, 10
293
+    AC %1, 12
294
+    AC %1, 14
295
+    AC %1, 0
296
+    AC %1, 2
297
+    AC %1, 4
298
+    AC %1, 6
296 299
 %endmacro
297 300
 
298 301
 INIT_XMM
... ...
@@ -302,47 +306,33 @@ INIT_AVX
302 302
 IDCT_ADD16INTRA_10 avx
303 303
 %endif
304 304
 
305
+%assign last_block 24
305 306
 ;-----------------------------------------------------------------------------
306 307
 ; h264_idct_add8(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
307 308
 ;-----------------------------------------------------------------------------
308 309
 %macro IDCT_ADD8 1
309 310
 cglobal h264_idct_add8_10_%1,5,7
310
-    mov          r5, 16
311
-    add          r2, 1024
312
-%ifdef PIC
313
-    lea         r11, [scan8_mem]
314
-%endif
315
-%ifdef ARCH_X86_64
316
-    mov         r10, r0
317
-%endif
318
-.nextblock:
319
-    movzx        r6, byte [scan8+r5]
320
-    movzx        r6, byte [r4+r6]
321
-    or          r6d, dword [r2]
322
-    test         r6, r6
323
-    jz .skipblock
324 311
 %ifdef ARCH_X86_64
325
-    mov         r0d, dword [r1+r5*4]
326
-    add          r0, [r10]
327
-%else
328
-    mov          r0, r0m
329
-    mov          r0, [r0]
330
-    add          r0, dword [r1+r5*4]
312
+    mov r10, r0
331 313
 %endif
332
-    IDCT4_ADD_10 r0, r2, r3
333
-.skipblock:
334
-    inc          r5
335
-    add          r2, 64
336
-    test         r5, 3
337
-    jnz .nextblock
314
+    add      r2, 1024
315
+    mov      r0, [r0]
316
+    ADD16_OP_INTRA %1, 16, 1+1*8
317
+    ADD16_OP_INTRA %1, 18, 1+2*8
338 318
 %ifdef ARCH_X86_64
339
-    add         r10, gprsize
319
+    mov      r0, [r10+gprsize]
340 320
 %else
341
-    add        r0mp, gprsize
321
+    mov      r0, r0m
322
+    mov      r0, [r0+gprsize]
342 323
 %endif
343
-    test         r5, 4
344
-    jnz .nextblock
324
+    ADD16_OP_INTRA %1, 20, 1+4*8
325
+    ADD16_OP_INTRA %1, 22, 1+5*8
345 326
     REP_RET
327
+    AC %1, 16
328
+    AC %1, 18
329
+    AC %1, 20
330
+    AC %1, 22
331
+
346 332
 %endmacro ; IDCT_ADD8
347 333
 
348 334
 INIT_XMM
... ...
@@ -356,51 +346,51 @@ IDCT_ADD8 avx
356 356
 ; void h264_idct8_add(pixel *dst, dctcoef *block, int stride)
357 357
 ;-----------------------------------------------------------------------------
358 358
 %macro IDCT8_1D 2
359
-    SWAP         0, 1
360
-    psrad        m4, m5, 1
361
-    psrad        m1, m0, 1
362
-    paddd        m4, m5
363
-    paddd        m1, m0
364
-    paddd        m4, m7
365
-    paddd        m1, m5
366
-    psubd        m4, m0
367
-    paddd        m1, m3
368
-
369
-    psubd        m0, m3
370
-    psubd        m5, m3
371
-    paddd        m0, m7
372
-    psubd        m5, m7
373
-    psrad        m3, 1
374
-    psrad        m7, 1
375
-    psubd        m0, m3
376
-    psubd        m5, m7
377
-
378
-    SWAP         1, 7
379
-    psrad        m1, m7, 2
380
-    psrad        m3, m4, 2
381
-    paddd        m3, m0
382
-    psrad        m0, 2
383
-    paddd        m1, m5
384
-    psrad        m5, 2
385
-    psubd        m0, m4
386
-    psubd        m7, m5
387
-
388
-    SWAP         5, 6
389
-    psrad        m4, m2, 1
390
-    psrad        m6, m5, 1
391
-    psubd        m4, m5
392
-    paddd        m6, m2
393
-
394
-    mova         m2, %1
395
-    mova         m5, %2
396
-    SUMSUB_BA    d, 5, 2
397
-    SUMSUB_BA    d, 6, 5
398
-    SUMSUB_BA    d, 4, 2
399
-    SUMSUB_BA    d, 7, 6
400
-    SUMSUB_BA    d, 0, 4
401
-    SUMSUB_BA    d, 3, 2
402
-    SUMSUB_BA    d, 1, 5
403
-    SWAP         7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567
359
+    SWAP      0, 1
360
+    psrad     m4, m5, 1
361
+    psrad     m1, m0, 1
362
+    paddd     m4, m5
363
+    paddd     m1, m0
364
+    paddd     m4, m7
365
+    paddd     m1, m5
366
+    psubd     m4, m0
367
+    paddd     m1, m3
368
+
369
+    psubd     m0, m3
370
+    psubd     m5, m3
371
+    paddd     m0, m7
372
+    psubd     m5, m7
373
+    psrad     m3, 1
374
+    psrad     m7, 1
375
+    psubd     m0, m3
376
+    psubd     m5, m7
377
+
378
+    SWAP      1, 7
379
+    psrad     m1, m7, 2
380
+    psrad     m3, m4, 2
381
+    paddd     m3, m0
382
+    psrad     m0, 2
383
+    paddd     m1, m5
384
+    psrad     m5, 2
385
+    psubd     m0, m4
386
+    psubd     m7, m5
387
+
388
+    SWAP      5, 6
389
+    psrad     m4, m2, 1
390
+    psrad     m6, m5, 1
391
+    psubd     m4, m5
392
+    paddd     m6, m2
393
+
394
+    mova      m2, %1
395
+    mova      m5, %2
396
+    SUMSUB_BA d, 5, 2
397
+    SUMSUB_BA d, 6, 5
398
+    SUMSUB_BA d, 4, 2
399
+    SUMSUB_BA d, 7, 6
400
+    SUMSUB_BA d, 0, 4
401
+    SUMSUB_BA d, 3, 2
402
+    SUMSUB_BA d, 1, 5
403
+    SWAP      7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567
404 404
 %endmacro
405 405
 
406 406
 %macro IDCT8_1D_FULL 1
... ...
@@ -536,7 +526,7 @@ IDCT8_ADD avx
536 536
 %macro IDCT8_ADD4_OP 3
537 537
     cmp       byte [r4+%3], 0
538 538
     jz .skipblock%2
539
-    mov      r0d, dword [r6+%2*4]
539
+    mov      r0d, [r6+%2*4]
540 540
     add       r0, r5
541 541
     call h264_idct8_add1_10_%1
542 542
 .skipblock%2:
... ...
@@ -836,7 +836,6 @@ PRED8x8_H ssse3
836 836
 ;-----------------------------------------------------------------------------
837 837
 ; void pred8x8_top_dc_mmxext(uint8_t *src, int stride)
838 838
 ;-----------------------------------------------------------------------------
839
-%ifdef CONFIG_GPL
840 839
 cglobal pred8x8_top_dc_mmxext, 2,5
841 840
     sub         r0, r1
842 841
     movq       mm0, [r0]
... ...
@@ -927,7 +926,6 @@ cglobal pred8x8_dc_mmxext, 2,5
927 927
     movq [r4+r1*1], m1
928 928
     movq [r4+r1*2], m1
929 929
     RET
930
-%endif
931 930
 
932 931
 ;-----------------------------------------------------------------------------
933 932
 ; void pred8x8_dc_rv40(uint8_t *src, int stride)
... ...
@@ -1083,7 +1081,6 @@ cglobal pred8x8_tm_vp8_ssse3, 2,3,6
1083 1083
 ;-----------------------------------------------------------------------------
1084 1084
 ; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
1085 1085
 ;-----------------------------------------------------------------------------
1086
-%ifdef CONFIG_GPL
1087 1086
 %macro PRED8x8L_TOP_DC 1
1088 1087
 cglobal pred8x8l_top_dc_%1, 4,4
1089 1088
     sub          r0, r3
... ...
@@ -2476,7 +2473,6 @@ PRED8x8L_HORIZONTAL_DOWN sse2
2476 2476
 INIT_MMX
2477 2477
 %define PALIGNR PALIGNR_SSSE3
2478 2478
 PRED8x8L_HORIZONTAL_DOWN ssse3
2479
-%endif
2480 2479
 
2481 2480
 ;-----------------------------------------------------------------------------
2482 2481
 ; void pred4x4_dc_mmxext(uint8_t *src, const uint8_t *topright, int stride)
... ...
@@ -2608,7 +2604,6 @@ cglobal pred4x4_vertical_vp8_mmxext, 3,3
2608 2608
 ;-----------------------------------------------------------------------------
2609 2609
 ; void pred4x4_down_left_mmxext(uint8_t *src, const uint8_t *topright, int stride)
2610 2610
 ;-----------------------------------------------------------------------------
2611
-%ifdef CONFIG_GPL
2612 2611
 INIT_MMX
2613 2612
 cglobal pred4x4_down_left_mmxext, 3,3
2614 2613
     sub       r0, r2
... ...
@@ -2786,4 +2781,3 @@ cglobal pred4x4_down_right_mmxext, 3,3
2786 2786
     psrlq     m0, 8
2787 2787
     movh      [r0+r2*1], m0
2788 2788
     RET
2789
-%endif
... ...
@@ -129,7 +129,6 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
129 129
         h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
130 130
         h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_mmxext;
131 131
         h->pred8x8  [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
132
-#if CONFIG_GPL
133 132
         h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext;
134 133
         h->pred8x8l [DC_PRED     ] = ff_pred8x8l_dc_mmxext;
135 134
         h->pred8x8l [HOR_PRED    ] = ff_pred8x8l_horizontal_mmxext;
... ...
@@ -142,9 +141,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
142 142
         h->pred4x4  [DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_mmxext;
143 143
         h->pred4x4  [VERT_RIGHT_PRED     ] = ff_pred4x4_vertical_right_mmxext;
144 144
         h->pred4x4  [HOR_DOWN_PRED       ] = ff_pred4x4_horizontal_down_mmxext;
145
-#endif
146 145
         h->pred4x4  [DC_PRED     ] = ff_pred4x4_dc_mmxext;
147
-#if CONFIG_GPL
148 146
         if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
149 147
             h->pred4x4  [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
150 148
         if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264)
... ...
@@ -156,7 +153,6 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
156 156
             h->pred8x8  [TOP_DC_PRED8x8      ] = ff_pred8x8_top_dc_mmxext;
157 157
             h->pred8x8  [DC_PRED8x8          ] = ff_pred8x8_dc_mmxext;
158 158
         }
159
-#endif
160 159
         if (codec_id == CODEC_ID_VP8) {
161 160
             h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext;
162 161
             h->pred8x8  [DC_PRED8x8   ] = ff_pred8x8_dc_rv40_mmxext;
... ...
@@ -181,13 +177,11 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
181 181
 
182 182
     if (mm_flags & AV_CPU_FLAG_SSE2) {
183 183
         h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_sse2;
184
-#if CONFIG_GPL
185 184
         h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
186 185
         h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
187 186
         h->pred8x8l [VERT_RIGHT_PRED     ] = ff_pred8x8l_vertical_right_sse2;
188 187
         h->pred8x8l [VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_sse2;
189 188
         h->pred8x8l [HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_sse2;
190
-#endif
191 189
         if (codec_id == CODEC_ID_VP8) {
192 190
             h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
193 191
             h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
... ...
@@ -207,7 +201,6 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
207 207
         h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;
208 208
         h->pred16x16[DC_PRED8x8  ] = ff_pred16x16_dc_ssse3;
209 209
         h->pred8x8  [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3;
210
-#if CONFIG_GPL
211 210
         h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3;
212 211
         h->pred8x8l [DC_PRED     ] = ff_pred8x8l_dc_ssse3;
213 212
         h->pred8x8l [HOR_PRED    ] = ff_pred8x8l_horizontal_ssse3;
... ...
@@ -218,7 +211,6 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
218 218
         h->pred8x8l [VERT_LEFT_PRED      ] = ff_pred8x8l_vertical_left_ssse3;
219 219
         h->pred8x8l [HOR_UP_PRED         ] = ff_pred8x8l_horizontal_up_ssse3;
220 220
         h->pred8x8l [HOR_DOWN_PRED       ] = ff_pred8x8l_horizontal_down_ssse3;
221
-#endif
222 221
         if (codec_id == CODEC_ID_VP8) {
223 222
             h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3;
224 223
             h->pred4x4  [TM_VP8_PRED  ] = ff_pred4x4_tm_vp8_ssse3;
... ...
@@ -54,11 +54,10 @@ typedef struct {
54 54
     int video_fd;
55 55
     int tuner_fd;
56 56
     int width, height;
57
-    int frame_rate;
58
-    int frame_rate_base;
59 57
     uint64_t per_frame;
60 58
     int standard;
61 59
     char *video_size; /**< String describing video size, set by a private option. */
60
+    char *framerate;  /**< Set by a private option. */
62 61
 } VideoData;
63 62
 
64 63
 
... ...
@@ -249,8 +248,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
249 249
     VideoData *s = s1->priv_data;
250 250
     AVStream *st;
251 251
     int width, height;
252
-    int frame_rate;
253
-    int frame_rate_base;
252
+    AVRational fps;
254 253
     int ret = 0;
255 254
 
256 255
     if (ap->time_base.den <= 0) {
... ...
@@ -262,14 +260,18 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
262 262
         av_log(s1, AV_LOG_ERROR, "Couldn't parse video size.\n");
263 263
         goto out;
264 264
     }
265
+    if ((ret = av_parse_video_rate(&fps, s->framerate)) < 0) {
266
+        av_log(s1, AV_LOG_ERROR, "Couldn't parse framerate.\n");
267
+        goto out;
268
+    }
265 269
 #if FF_API_FORMAT_PARAMETERS
266 270
     if (ap->width > 0)
267 271
         width = ap->width;
268 272
     if (ap->height > 0)
269 273
         height = ap->height;
274
+    if (ap->time_base.num)
275
+        fps = (AVRational){ap->time_base.den, ap->time_base.num};
270 276
 #endif
271
-    frame_rate = ap->time_base.den;
272
-    frame_rate_base = ap->time_base.num;
273 277
 
274 278
     st = av_new_stream(s1, 0);
275 279
     if (!st) {
... ...
@@ -280,17 +282,15 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
280 280
 
281 281
     s->width = width;
282 282
     s->height = height;
283
-    s->frame_rate = frame_rate;
284
-    s->frame_rate_base = frame_rate_base;
285
-    s->per_frame = ((uint64_t)1000000 * s->frame_rate_base) / s->frame_rate;
283
+    s->per_frame = ((uint64_t)1000000 * fps.den) / fps.num;
286 284
 
287 285
     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
288 286
     st->codec->pix_fmt = PIX_FMT_YUV420P;
289 287
     st->codec->codec_id = CODEC_ID_RAWVIDEO;
290 288
     st->codec->width = width;
291 289
     st->codec->height = height;
292
-    st->codec->time_base.den = frame_rate;
293
-    st->codec->time_base.num = frame_rate_base;
290
+    st->codec->time_base.den = fps.num;
291
+    st->codec->time_base.num = fps.den;
294 292
 
295 293
 #if FF_API_FORMAT_PARAMETERS
296 294
     if (ap->standard) {
... ...
@@ -314,6 +314,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
314 314
 
315 315
 out:
316 316
     av_freep(&s->video_size);
317
+    av_freep(&s->framerate);
317 318
     return ret;
318 319
 }
319 320
 
... ...
@@ -346,6 +347,7 @@ static const AVOption options[] = {
346 346
     { "PALM",     "", 0, FF_OPT_TYPE_CONST, {.dbl = PALM},  0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
347 347
     { "NTSCJ",    "", 0, FF_OPT_TYPE_CONST, {.dbl = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
348 348
     { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC },
349
+    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
349 350
     { NULL },
350 351
 };
351 352
 
... ...
@@ -33,9 +33,6 @@
33 33
 #include "libavutil/log.h"
34 34
 #include "libavutil/opt.h"
35 35
 #include "avdevice.h"
36
-
37
-#undef DV1394_DEBUG
38
-
39 36
 #include "libavformat/dv.h"
40 37
 #include "dv1394.h"
41 38
 
... ...
@@ -177,15 +174,13 @@ restart_poll:
177 177
             av_log(context, AV_LOG_ERROR, "Failed to get status: %s\n", strerror(errno));
178 178
             return AVERROR(EIO);
179 179
         }
180
-#ifdef DV1394_DEBUG
181
-        av_log(context, AV_LOG_DEBUG, "DV1394: status\n"
180
+        av_dlog(context, "DV1394: status\n"
182 181
                 "\tactive_frame\t%d\n"
183 182
                 "\tfirst_clear_frame\t%d\n"
184 183
                 "\tn_clear_frames\t%d\n"
185 184
                 "\tdropped_frames\t%d\n",
186 185
                 s.active_frame, s.first_clear_frame,
187 186
                 s.n_clear_frames, s.dropped_frames);
188
-#endif
189 187
 
190 188
         dv->avail = s.n_clear_frames;
191 189
         dv->index = s.first_clear_frame;
... ...
@@ -200,10 +195,8 @@ restart_poll:
200 200
         }
201 201
     }
202 202
 
203
-#ifdef DV1394_DEBUG
204
-    av_log(context, AV_LOG_DEBUG, "index %d, avail %d, done %d\n", dv->index, dv->avail,
203
+    av_dlog(context, "index %d, avail %d, done %d\n", dv->index, dv->avail,
205 204
             dv->done);
206
-#endif
207 205
 
208 206
     size = dv_produce_packet(dv->dv_demux, pkt,
209 207
                              dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),
... ...
@@ -37,7 +37,10 @@
37 37
 #include <time.h>
38 38
 #include <linux/fb.h>
39 39
 
40
+#include "libavutil/log.h"
40 41
 #include "libavutil/mem.h"
42
+#include "libavutil/opt.h"
43
+#include "libavutil/parseutils.h"
41 44
 #include "libavutil/pixdesc.h"
42 45
 #include "avdevice.h"
43 46
 
... ...
@@ -74,8 +77,10 @@ static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *var
74 74
 }
75 75
 
76 76
 typedef struct {
77
+    AVClass *class;          ///< class for private options
77 78
     int frame_size;          ///< size in bytes of a grabbed frame
78
-    AVRational time_base;    ///< time base
79
+    AVRational fps;          ///< framerate
80
+    char *framerate;         ///< framerate string set by a private option
79 81
     int64_t time_frame;      ///< time for the next frame to output (in 1/1000000 units)
80 82
 
81 83
     int fd;                  ///< framebuffer device file descriptor
... ...
@@ -97,16 +102,21 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
97 97
     enum PixelFormat pix_fmt;
98 98
     int ret, flags = O_RDONLY;
99 99
 
100
+    ret = av_parse_video_rate(&fbdev->fps, fbdev->framerate);
101
+    av_freep(&fbdev->framerate);
102
+    if (ret < 0) {
103
+        av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n");
104
+        return ret;
105
+    }
106
+#if FF_API_FORMAT_PARAMETERS
107
+    if (ap->time_base.num)
108
+        fbdev->fps = (AVRational){ap->time_base.den, ap->time_base.num};
109
+#endif
110
+
100 111
     if (!(st = av_new_stream(avctx, 0)))
101 112
         return AVERROR(ENOMEM);
102 113
     av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
103 114
 
104
-    if (ap->time_base.den <= 0) {
105
-        av_log(avctx, AV_LOG_ERROR, "Invalid time base %d/%d\n",
106
-               ap->time_base.num, ap->time_base.den);
107
-        return AVERROR(EINVAL);
108
-    }
109
-
110 115
     /* NONBLOCK is ignored by the fbdev driver, only set for consistency */
111 116
     if (avctx->flags & AVFMT_FLAG_NONBLOCK)
112 117
         flags |= O_NONBLOCK;
... ...
@@ -146,7 +156,6 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
146 146
     fbdev->bytes_per_pixel = (fbdev->varinfo.bits_per_pixel + 7) >> 3;
147 147
     fbdev->frame_linesize  = fbdev->width * fbdev->bytes_per_pixel;
148 148
     fbdev->frame_size      = fbdev->frame_linesize * fbdev->heigth;
149
-    fbdev->time_base       = ap->time_base;
150 149
     fbdev->time_frame      = AV_NOPTS_VALUE;
151 150
     fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0);
152 151
     if (fbdev->data == MAP_FAILED) {
... ...
@@ -162,13 +171,13 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
162 162
     st->codec->pix_fmt    = pix_fmt;
163 163
     st->codec->time_base  = ap->time_base;
164 164
     st->codec->bit_rate   =
165
-        fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel / av_q2d(ap->time_base) * 8;
165
+        fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->fps) * 8;
166 166
 
167 167
     av_log(avctx, AV_LOG_INFO,
168
-           "w:%d h:%d bpp:%d pixfmt:%s tb:%d/%d bit_rate:%d\n",
168
+           "w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
169 169
            fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel,
170 170
            av_pix_fmt_descriptors[pix_fmt].name,
171
-           ap->time_base.num, ap->time_base.den,
171
+           fbdev->fps.num, fbdev->fps.den,
172 172
            st->codec->bit_rate);
173 173
     return 0;
174 174
 
... ...
@@ -196,7 +205,7 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
196 196
                 "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
197 197
                 fbdev->time_frame, curtime, delay);
198 198
         if (delay <= 0) {
199
-            fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
199
+            fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->fps);
200 200
             break;
201 201
         }
202 202
         if (avctx->flags & AVFMT_FLAG_NONBLOCK)
... ...
@@ -240,6 +249,20 @@ av_cold static int fbdev_read_close(AVFormatContext *avctx)
240 240
     return 0;
241 241
 }
242 242
 
243
+#define OFFSET(x) offsetof(FBDevContext, x)
244
+#define DEC AV_OPT_FLAG_DECODING_PARAM
245
+static const AVOption options[] = {
246
+    { "framerate","", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
247
+    { NULL },
248
+};
249
+
250
+static const AVClass fbdev_class = {
251
+    .class_name = "fbdev indev",
252
+    .item_name  = av_default_item_name,
253
+    .option     = options,
254
+    .version    = LIBAVUTIL_VERSION_INT,
255
+};
256
+
243 257
 AVInputFormat ff_fbdev_demuxer = {
244 258
     .name           = "fbdev",
245 259
     .long_name      = NULL_IF_CONFIG_SMALL("Linux framebuffer"),
... ...
@@ -248,4 +271,5 @@ AVInputFormat ff_fbdev_demuxer = {
248 248
     .read_packet    = fbdev_read_packet,
249 249
     .read_close     = fbdev_read_close,
250 250
     .flags          = AVFMT_NOFILE,
251
+    .priv_class     = &fbdev_class,
251 252
 };
... ...
@@ -2,7 +2,6 @@
2 2
  * IIDC1394 grab interface (uses libdc1394 and libraw1394)
3 3
  * Copyright (c) 2004 Roman Shaposhnik
4 4
  * Copyright (c) 2008 Alessandro Sappia
5
- * Copyright (c) 2011 Martin Lambers
6 5
  *
7 6
  * This file is part of FFmpeg.
8 7
  *
... ...
@@ -22,47 +21,63 @@
22 22
  */
23 23
 
24 24
 #include "config.h"
25
+#include "libavformat/avformat.h"
25 26
 #include "libavutil/log.h"
26 27
 #include "libavutil/opt.h"
27
-#include "avdevice.h"
28
-
29
-#include <stdlib.h>
30
-#include <string.h>
31 28
 #include "libavutil/parseutils.h"
32 29
 #include "libavutil/pixdesc.h"
33 30
 
31
+#if HAVE_LIBDC1394_2
34 32
 #include <dc1394/dc1394.h>
33
+#elif HAVE_LIBDC1394_1
34
+#include <libraw1394/raw1394.h>
35
+#include <libdc1394/dc1394_control.h>
36
+
37
+#define DC1394_VIDEO_MODE_320x240_YUV422 MODE_320x240_YUV422
38
+#define DC1394_VIDEO_MODE_640x480_YUV411 MODE_640x480_YUV411
39
+#define DC1394_VIDEO_MODE_640x480_YUV422 MODE_640x480_YUV422
40
+#define DC1394_FRAMERATE_1_875 FRAMERATE_1_875
41
+#define DC1394_FRAMERATE_3_75  FRAMERATE_3_75
42
+#define DC1394_FRAMERATE_7_5   FRAMERATE_7_5
43
+#define DC1394_FRAMERATE_15    FRAMERATE_15
44
+#define DC1394_FRAMERATE_30    FRAMERATE_30
45
+#define DC1394_FRAMERATE_60    FRAMERATE_60
46
+#define DC1394_FRAMERATE_120   FRAMERATE_120
47
+#define DC1394_FRAMERATE_240   FRAMERATE_240
48
+#endif
35 49
 
36 50
 #undef free
37 51
 
38 52
 typedef struct dc1394_data {
39 53
     AVClass *class;
54
+#if HAVE_LIBDC1394_1
55
+    raw1394handle_t handle;
56
+    dc1394_cameracapture camera;
57
+    int channel;
58
+#elif HAVE_LIBDC1394_2
40 59
     dc1394_t *d;
41 60
     dc1394camera_t *camera;
42 61
     dc1394video_frame_t *frame;
62
+#endif
43 63
     int current_frame;
44
-    int fps;
64
+    int  frame_rate;        /**< frames per 1000 seconds (fps * 1000) */
45 65
     char *video_size;       /**< String describing video size, set by a private option. */
46 66
     char *pixel_format;     /**< Set by a private option. */
67
+    char *framerate;        /**< Set by a private option. */
47 68
 
48 69
     AVPacket packet;
49 70
 } dc1394_data;
50 71
 
51
-/* The list of color codings that we support.
52
- * We assume big endian for the dc1394 16bit modes: libdc1394 never sets the
53
- * flag little_endian in dc1394video_frame_t. */
54
-struct dc1394_color_coding {
55
-    int pix_fmt;
56
-    int score;
57
-    uint32_t coding;
58
-} dc1394_color_codings[] = {
59
-    { PIX_FMT_GRAY16BE,  1000, DC1394_COLOR_CODING_MONO16 },
60
-    { PIX_FMT_RGB48BE,   1100, DC1394_COLOR_CODING_RGB16  },
61
-    { PIX_FMT_GRAY8,     1200, DC1394_COLOR_CODING_MONO8  },
62
-    { PIX_FMT_RGB24,     1300, DC1394_COLOR_CODING_RGB8   },
63
-    { PIX_FMT_UYYVYY411, 1400, DC1394_COLOR_CODING_YUV411 },
64
-    { PIX_FMT_UYVY422,   1500, DC1394_COLOR_CODING_YUV422 },
65
-    { PIX_FMT_NONE, 0, 0 } /* gotta be the last one */
72
+struct dc1394_frame_format {
73
+    int width;
74
+    int height;
75
+    enum PixelFormat pix_fmt;
76
+    int frame_size_id;
77
+} dc1394_frame_formats[] = {
78
+    { 320, 240, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 },
79
+    { 640, 480, PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
80
+    { 640, 480, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 },
81
+    { 0, 0, 0, 0 } /* gotta be the last one */
66 82
 };
67 83
 
68 84
 struct dc1394_frame_rate {
... ...
@@ -83,8 +98,12 @@ struct dc1394_frame_rate {
83 83
 #define OFFSET(x) offsetof(dc1394_data, x)
84 84
 #define DEC AV_OPT_FLAG_DECODING_PARAM
85 85
 static const AVOption options[] = {
86
+#if HAVE_LIBDC1394_1
87
+    { "channel", "", offsetof(dc1394_data, channel), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
88
+#endif
86 89
     { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC },
87 90
     { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "uyvy422"}, 0, 0, DEC },
91
+    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
88 92
     { NULL },
89 93
 };
90 94
 
... ...
@@ -95,183 +114,220 @@ static const AVClass libdc1394_class = {
95 95
     .version    = LIBAVUTIL_VERSION_INT,
96 96
 };
97 97
 
98
-static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
98
+
99
+static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
100
+                                     struct dc1394_frame_format **select_fmt, struct dc1394_frame_rate **select_fps)
99 101
 {
100 102
     dc1394_data* dc1394 = c->priv_data;
101
-    AVStream *vst;
102
-    const struct dc1394_color_coding *cc;
103
-    const struct dc1394_frame_rate *fr;
104
-    dc1394camera_list_t *list;
105
-    dc1394video_modes_t video_modes;
106
-    dc1394video_mode_t video_mode;
107
-    dc1394framerates_t frame_rates;
108
-    dc1394framerate_t frame_rate;
109
-    uint32_t dc1394_width, dc1394_height, dc1394_color_coding;
110
-    int rate, best_rate;
111
-    int score, max_score;
112
-    int final_width, final_height, final_pix_fmt, final_frame_rate;
113
-    int res, i, j;
114
-    int ret=-1;
115
-
116
-    /* Now let us prep the hardware. */
117
-    dc1394->d = dc1394_new();
118
-    dc1394_camera_enumerate (dc1394->d, &list);
119
-    if ( !list || list->num == 0) {
120
-        av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera\n\n");
103
+    AVStream* vst;
104
+    struct dc1394_frame_format *fmt;
105
+    struct dc1394_frame_rate *fps;
106
+    enum PixelFormat pix_fmt;
107
+    int width, height;
108
+    AVRational framerate;
109
+    int ret = 0;
110
+
111
+    if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == PIX_FMT_NONE) {
112
+        av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", dc1394->pixel_format);
113
+        ret = AVERROR(EINVAL);
121 114
         goto out;
122 115
     }
123 116
 
124
-    /* FIXME: To select a specific camera I need to search in list its guid */
125
-    dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid);
126
-    if (list->num > 1) {
127
-        av_log(c, AV_LOG_INFO, "Working with the first camera found\n");
128
-    }
129
-
130
-    /* Freeing list of cameras */
131
-    dc1394_camera_free_list (list);
132
-
133
-    /* Get the list of video modes supported by the camera. */
134
-    res = dc1394_video_get_supported_modes (dc1394->camera, &video_modes);
135
-    if (res != DC1394_SUCCESS) {
136
-        av_log(c, AV_LOG_ERROR, "Could not get video formats.\n");
137
-        goto out_camera;
138
-    }
139
-
140
-    if (dc1394->pixel_format) {
141
-        if ((ap->pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == PIX_FMT_NONE) {
142
-            av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", dc1394->pixel_format);
143
-            ret = AVERROR(EINVAL);
144
-            goto out;
145
-        }
146
-    }
147
-
148
-    if (dc1394->video_size) {
149
-        if ((ret = av_parse_video_size(&ap->width, &ap->height, dc1394->video_size)) < 0) {
150
-            av_log(c, AV_LOG_ERROR, "Couldn't parse video size.\n");
151
-            goto out;
152
-        }
153
-    }
154
-    
155
-    /* Choose the best mode. */
156
-    rate = (ap->time_base.num ? av_rescale(1000, ap->time_base.den, ap->time_base.num) : -1);
157
-    max_score = -1;
158
-    for (i = 0; i < video_modes.num; i++) {
159
-        if (video_modes.modes[i] == DC1394_VIDEO_MODE_EXIF
160
-                || (video_modes.modes[i] >= DC1394_VIDEO_MODE_FORMAT7_MIN
161
-                    && video_modes.modes[i] <= DC1394_VIDEO_MODE_FORMAT7_MAX)) {
162
-            /* These modes are currently not supported as they would require
163
-             * much more work. For the remaining modes, the functions
164
-             * dc1394_get_image_size_from_video_mode and
165
-             * dc1394_get_color_coding_from_video_mode do not need to query the
166
-             * camera, and thus cannot fail. */
167
-            continue;
168
-        }
169
-        dc1394_get_color_coding_from_video_mode (NULL, video_modes.modes[i],
170
-                &dc1394_color_coding);
171
-        for (cc = dc1394_color_codings; cc->pix_fmt != PIX_FMT_NONE; cc++)
172
-            if (cc->coding == dc1394_color_coding)
173
-                break;
174
-        if (cc->pix_fmt == PIX_FMT_NONE) {
175
-            /* We currently cannot handle this color coding. */
176
-            continue;
177
-        }
178
-        /* Here we know that the mode is supported. Get its frame size and the list
179
-         * of frame rates supported by the camera for this mode. This list is sorted
180
-         * in ascending order according to libdc1394 example programs. */
181
-        dc1394_get_image_size_from_video_mode (NULL, video_modes.modes[i],
182
-                &dc1394_width, &dc1394_height);
183
-        res = dc1394_video_get_supported_framerates (dc1394->camera, video_modes.modes[i],
184
-                &frame_rates);
185
-        if (res != DC1394_SUCCESS || frame_rates.num == 0) {
186
-            av_log(c, AV_LOG_ERROR, "Cannot get frame rates for video mode.\n");
187
-            goto out_camera;
188
-        }
189
-        /* Choose the best frame rate. */
190
-        best_rate = -1;
191
-        for (j = 0; j < frame_rates.num; j++) {
192
-            for (fr = dc1394_frame_rates; fr->frame_rate; fr++) {
193
-                if (fr->frame_rate_id == frame_rates.framerates[j]) {
194
-                    break;
195
-                }
196
-            }
197
-            if (!fr->frame_rate) {
198
-                /* This frame rate is not supported. */
199
-                continue;
200
-            }
201
-            best_rate = fr->frame_rate;
202
-            frame_rate = fr->frame_rate_id;
203
-            if (ap->time_base.num && rate == fr->frame_rate) {
204
-                /* This is the requested frame rate. */
205
-                break;
206
-            }
207
-        }
208
-        if (best_rate == -1) {
209
-            /* No supported rate found. */
210
-            continue;
211
-        }
212
-        /* Here we know that both the mode and the rate are supported. Compute score. */
213
-        if (ap->width && ap->height
214
-                && (dc1394_width == ap->width && dc1394_height == ap->height)) {
215
-            score = 110000;
216
-        } else {
217
-            score = dc1394_width * 10;  // 1600 - 16000
218
-        }
219
-        if (ap->pix_fmt == cc->pix_fmt) {
220
-            score += 90000;
221
-        } else {
222
-            score += cc->score;         // 1000 - 1500
223
-        }
224
-        if (ap->time_base.num && rate == best_rate) {
225
-            score += 70000;
226
-        } else {
227
-            score += best_rate / 1000;  // 1 - 240
228
-        }
229
-        if (score > max_score) {
230
-            video_mode = video_modes.modes[i];
231
-            final_width = dc1394_width;
232
-            final_height = dc1394_height;
233
-            final_pix_fmt = cc->pix_fmt;
234
-            final_frame_rate = best_rate;
235
-            max_score = score;
236
-        }
237
-    }
238
-    if (max_score == -1) {
239
-        av_log(c, AV_LOG_ERROR, "No suitable video mode / frame rate available.\n");
240
-        goto out_camera;
241
-    }
242
-    if (ap->width && ap->height && !(ap->width == final_width && ap->height == final_height)) {
243
-        av_log(c, AV_LOG_WARNING, "Requested frame size is not available, using fallback.\n");
117
+    if ((ret = av_parse_video_size(&width, &height, dc1394->video_size)) < 0) {
118
+        av_log(c, AV_LOG_ERROR, "Couldn't parse video size.\n");
119
+        goto out;
244 120
     }
245
-    if (ap->pix_fmt != PIX_FMT_NONE && ap->pix_fmt != final_pix_fmt) {
246
-        av_log(c, AV_LOG_WARNING, "Requested pixel format is not supported, using fallback.\n");
121
+    if ((ret = av_parse_video_rate(&framerate, dc1394->framerate)) < 0) {
122
+        av_log(c, AV_LOG_ERROR, "Couldn't parse framerate.\n");
123
+        goto out;
247 124
     }
248
-    if (ap->time_base.num && rate != final_frame_rate) {
249
-        av_log(c, AV_LOG_WARNING, "Requested frame rate is not available, using fallback.\n");
125
+#if FF_API_FORMAT_PARAMETERS
126
+    if (ap->width > 0)
127
+        width = ap->width;
128
+    if (ap->height > 0)
129
+        height = ap->height;
130
+    if (ap->pix_fmt)
131
+        pix_fmt = ap->pix_fmt;
132
+    if (ap->time_base.num)
133
+        framerate = (AVRational){ap->time_base.den, ap->time_base.num};
134
+#endif
135
+    dc1394->frame_rate = av_rescale(1000, framerate.num, framerate.den);
136
+
137
+    for (fmt = dc1394_frame_formats; fmt->width; fmt++)
138
+         if (fmt->pix_fmt == pix_fmt && fmt->width == width && fmt->height == height)
139
+             break;
140
+
141
+    for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
142
+         if (fps->frame_rate == dc1394->frame_rate)
143
+             break;
144
+
145
+    if (!fps->frame_rate || !fmt->width) {
146
+        av_log(c, AV_LOG_ERROR, "Can't find matching camera format for %s, %dx%d@%d:1000fps\n", avcodec_get_pix_fmt_name(pix_fmt),
147
+                                                                                                width, height, dc1394->frame_rate);
148
+        ret = AVERROR(EINVAL);
149
+        goto out;
250 150
     }
251 151
 
252 152
     /* create a video stream */
253 153
     vst = av_new_stream(c, 0);
254
-    if (!vst)
255
-        goto out_camera;
154
+    if (!vst) {
155
+        ret = AVERROR(ENOMEM);
156
+        goto out;
157
+    }
256 158
     av_set_pts_info(vst, 64, 1, 1000);
257 159
     vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
258 160
     vst->codec->codec_id = CODEC_ID_RAWVIDEO;
259
-    vst->codec->time_base.den = final_frame_rate;
260
-    vst->codec->time_base.num = 1000;
261
-    vst->codec->width = final_width;
262
-    vst->codec->height = final_height;
263
-    vst->codec->pix_fmt = final_pix_fmt;
161
+    vst->codec->time_base.den = framerate.num;
162
+    vst->codec->time_base.num = framerate.den;
163
+    vst->codec->width = fmt->width;
164
+    vst->codec->height = fmt->height;
165
+    vst->codec->pix_fmt = fmt->pix_fmt;
264 166
 
265 167
     /* packet init */
266 168
     av_init_packet(&dc1394->packet);
267
-    dc1394->packet.size = avpicture_get_size(final_pix_fmt, final_width, final_height);
169
+    dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
268 170
     dc1394->packet.stream_index = vst->index;
269 171
     dc1394->packet.flags |= AV_PKT_FLAG_KEY;
270 172
 
271 173
     dc1394->current_frame = 0;
272
-    dc1394->fps = final_frame_rate;
273 174
 
274
-    vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, final_frame_rate, 1000);
175
+    vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
176
+    *select_fps = fps;
177
+    *select_fmt = fmt;
178
+out:
179
+    av_freep(&dc1394->video_size);
180
+    av_freep(&dc1394->pixel_format);
181
+    av_freep(&dc1394->framerate);
182
+    return ret;
183
+}
184
+
185
+#if HAVE_LIBDC1394_1
186
+static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
187
+{
188
+    dc1394_data* dc1394 = c->priv_data;
189
+    AVStream* vst;
190
+    nodeid_t* camera_nodes;
191
+    int res;
192
+    struct dc1394_frame_format *fmt = NULL;
193
+    struct dc1394_frame_rate *fps = NULL;
194
+
195
+    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
196
+        return -1;
197
+
198
+#if FF_API_FORMAT_PARAMETERS
199
+    if (ap->channel)
200
+        dc1394->channel = ap->channel;
201
+#endif
202
+
203
+    /* Now let us prep the hardware. */
204
+    dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
205
+    if (!dc1394->handle) {
206
+        av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
207
+        goto out;
208
+    }
209
+    camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
210
+    if (!camera_nodes || camera_nodes[dc1394->channel] == DC1394_NO_CAMERA) {
211
+        av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", dc1394->channel);
212
+        goto out_handle;
213
+    }
214
+    res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[dc1394->channel],
215
+                                   0,
216
+                                   FORMAT_VGA_NONCOMPRESSED,
217
+                                   fmt->frame_size_id,
218
+                                   SPEED_400,
219
+                                   fps->frame_rate_id, 8, 1,
220
+                                   c->filename,
221
+                                   &dc1394->camera);
222
+    dc1394_free_camera_nodes(camera_nodes);
223
+    if (res != DC1394_SUCCESS) {
224
+        av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
225
+        goto out_handle;
226
+    }
227
+
228
+    res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
229
+    if (res != DC1394_SUCCESS) {
230
+        av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
231
+        goto out_handle_dma;
232
+    }
233
+
234
+    return 0;
235
+
236
+out_handle_dma:
237
+    dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
238
+    dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
239
+out_handle:
240
+    dc1394_destroy_handle(dc1394->handle);
241
+out:
242
+    return -1;
243
+}
244
+
245
+static int dc1394_v1_read_packet(AVFormatContext *c, AVPacket *pkt)
246
+{
247
+    struct dc1394_data *dc1394 = c->priv_data;
248
+    int res;
249
+
250
+    /* discard stale frame */
251
+    if (dc1394->current_frame++) {
252
+        if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
253
+            av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
254
+    }
255
+
256
+    res = dc1394_dma_single_capture(&dc1394->camera);
257
+
258
+    if (res == DC1394_SUCCESS) {
259
+        dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
260
+        dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->frame_rate;
261
+        res = dc1394->packet.size;
262
+    } else {
263
+        av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
264
+        dc1394->packet.data = NULL;
265
+        res = -1;
266
+    }
267
+
268
+    *pkt = dc1394->packet;
269
+    return res;
270
+}
271
+
272
+static int dc1394_v1_close(AVFormatContext * context)
273
+{
274
+    struct dc1394_data *dc1394 = context->priv_data;
275
+
276
+    dc1394_stop_iso_transmission(dc1394->handle, dc1394->camera.node);
277
+    dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
278
+    dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
279
+    dc1394_destroy_handle(dc1394->handle);
280
+
281
+    return 0;
282
+}
283
+
284
+#elif HAVE_LIBDC1394_2
285
+static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
286
+{
287
+    dc1394_data* dc1394 = c->priv_data;
288
+    dc1394camera_list_t *list;
289
+    int res, i;
290
+    struct dc1394_frame_format *fmt = NULL;
291
+    struct dc1394_frame_rate *fps = NULL;
292
+
293
+    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
294
+       return -1;
295
+
296
+    /* Now let us prep the hardware. */
297
+    dc1394->d = dc1394_new();
298
+    dc1394_camera_enumerate (dc1394->d, &list);
299
+    if ( !list || list->num == 0) {
300
+        av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera\n\n");
301
+        goto out;
302
+    }
303
+
304
+    /* FIXME: To select a specific camera I need to search in list its guid */
305
+    dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid);
306
+    if (list->num > 1) {
307
+        av_log(c, AV_LOG_INFO, "Working with the first camera found\n");
308
+    }
309
+
310
+    /* Freeing list of cameras */
311
+    dc1394_camera_free_list (list);
275 312
 
276 313
     /* Select MAX Speed possible from the cam */
277 314
     if (dc1394->camera->bmode_capable>0) {
... ...
@@ -289,13 +345,13 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
289 289
         goto out_camera;
290 290
     }
291 291
 
292
-    if (dc1394_video_set_mode(dc1394->camera, video_mode) != DC1394_SUCCESS) {
292
+    if (dc1394_video_set_mode(dc1394->camera, fmt->frame_size_id) != DC1394_SUCCESS) {
293 293
         av_log(c, AV_LOG_ERROR, "Couldn't set video format\n");
294 294
         goto out_camera;
295 295
     }
296 296
 
297
-    if (dc1394_video_set_framerate(dc1394->camera, frame_rate) != DC1394_SUCCESS) {
298
-        av_log(c, AV_LOG_ERROR, "Could not set framerate %d.\n", final_frame_rate);
297
+    if (dc1394_video_set_framerate(dc1394->camera,fps->frame_rate_id) != DC1394_SUCCESS) {
298
+        av_log(c, AV_LOG_ERROR, "Couldn't set framerate %d \n",fps->frame_rate);
299 299
         goto out_camera;
300 300
     }
301 301
     if (dc1394_capture_setup(dc1394->camera, 10, DC1394_CAPTURE_FLAGS_DEFAULT)!=DC1394_SUCCESS) {
... ...
@@ -314,13 +370,11 @@ out_camera:
314 314
     dc1394_video_set_transmission(dc1394->camera, DC1394_OFF);
315 315
     dc1394_camera_free (dc1394->camera);
316 316
 out:
317
-    av_freep(&dc1394->video_size);
318
-    av_freep(&dc1394->pixel_format);
319 317
     dc1394_free(dc1394->d);
320
-    return ret;
318
+    return -1;
321 319
 }
322 320
 
323
-static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
321
+static int dc1394_v2_read_packet(AVFormatContext *c, AVPacket *pkt)
324 322
 {
325 323
     struct dc1394_data *dc1394 = c->priv_data;
326 324
     int res;
... ...
@@ -334,7 +388,7 @@ static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
334 334
     res = dc1394_capture_dequeue(dc1394->camera, DC1394_CAPTURE_POLICY_WAIT, &dc1394->frame);
335 335
     if (res == DC1394_SUCCESS) {
336 336
         dc1394->packet.data = (uint8_t *)(dc1394->frame->image);
337
-        dc1394->packet.pts = (dc1394->current_frame  * 1000000) / (dc1394->fps);
337
+        dc1394->packet.pts = (dc1394->current_frame  * 1000000) / (dc1394->frame_rate);
338 338
         res = dc1394->frame->image_bytes;
339 339
     } else {
340 340
         av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
... ...
@@ -346,7 +400,7 @@ static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
346 346
     return res;
347 347
 }
348 348
 
349
-static int dc1394_close(AVFormatContext * context)
349
+static int dc1394_v2_close(AVFormatContext * context)
350 350
 {
351 351
     struct dc1394_data *dc1394 = context->priv_data;
352 352
 
... ...
@@ -360,11 +414,25 @@ static int dc1394_close(AVFormatContext * context)
360 360
 
361 361
 AVInputFormat ff_libdc1394_demuxer = {
362 362
     .name           = "libdc1394",
363
-    .long_name      = NULL_IF_CONFIG_SMALL("dc1394 A/V grab"),
363
+    .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"),
364
+    .priv_data_size = sizeof(struct dc1394_data),
365
+    .read_header    = dc1394_v2_read_header,
366
+    .read_packet    = dc1394_v2_read_packet,
367
+    .read_close     = dc1394_v2_close,
368
+    .flags          = AVFMT_NOFILE,
369
+    .priv_class     = &libdc1394_class,
370
+};
371
+
372
+#endif
373
+#if HAVE_LIBDC1394_1
374
+AVInputFormat ff_libdc1394_demuxer = {
375
+    .name           = "libdc1394",
376
+    .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.1 A/V grab"),
364 377
     .priv_data_size = sizeof(struct dc1394_data),
365
-    .read_header    = dc1394_read_header,
366
-    .read_packet    = dc1394_read_packet,
367
-    .read_close     = dc1394_close,
378
+    .read_header    = dc1394_v1_read_header,
379
+    .read_packet    = dc1394_v1_read_packet,
380
+    .read_close     = dc1394_v1_close,
368 381
     .flags          = AVFMT_NOFILE,
369 382
     .priv_class     = &libdc1394_class,
370 383
 };
384
+#endif
... ...
@@ -76,6 +76,7 @@ struct video_data {
76 76
     int channel;
77 77
     char *video_size; /**< String describing video size, set by a private option. */
78 78
     char *pixel_format; /**< Set by a private option. */
79
+    char *framerate;    /**< Set by a private option. */
79 80
 };
80 81
 
81 82
 struct buff_data {
... ...
@@ -438,12 +439,19 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
438 438
     struct v4l2_streamparm streamparm = {0};
439 439
     struct v4l2_fract *tpf = &streamparm.parm.capture.timeperframe;
440 440
     int i, ret;
441
+    AVRational fps;
441 442
 
442 443
     streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
443 444
 
445
+    if (s->framerate && (ret = av_parse_video_rate(&fps, s->framerate)) < 0) {
446
+        av_log(s1, AV_LOG_ERROR, "Couldn't parse framerate.\n");
447
+        return ret;
448
+    }
444 449
 #if FF_API_FORMAT_PARAMETERS
445 450
     if (ap->channel > 0)
446 451
         s->channel = ap->channel;
452
+    if (ap->time_base.num)
453
+        fps = (AVRational){ap->time_base.den, ap->time_base.num};
447 454
 #endif
448 455
 
449 456
     /* set tv video input */
... ...
@@ -492,34 +500,32 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
492 492
         }
493 493
     }
494 494
 
495
-    if (ap->time_base.num && ap->time_base.den) {
495
+    if (fps.num && fps.den) {
496 496
         av_log(s1, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n",
497
-               ap->time_base.num, ap->time_base.den);
498
-        tpf->numerator = ap->time_base.num;
499
-        tpf->denominator = ap->time_base.den;
497
+               fps.den, fps.num);
498
+        tpf->numerator   = fps.den;
499
+        tpf->denominator = fps.num;
500 500
         if (ioctl(s->fd, VIDIOC_S_PARM, &streamparm) != 0) {
501 501
             av_log(s1, AV_LOG_ERROR,
502 502
                    "ioctl set time per frame(%d/%d) failed\n",
503
-                   ap->time_base.num, ap->time_base.den);
503
+                   fps.den, fps.num);
504 504
             return AVERROR(EIO);
505 505
         }
506 506
 
507
-        if (ap->time_base.den != tpf->denominator ||
508
-            ap->time_base.num != tpf->numerator) {
507
+        if (fps.num != tpf->denominator ||
508
+            fps.den != tpf->numerator) {
509 509
             av_log(s1, AV_LOG_INFO,
510 510
                    "The driver changed the time per frame from %d/%d to %d/%d\n",
511
-                   ap->time_base.num, ap->time_base.den,
511
+                   fps.den, fps.num,
512 512
                    tpf->numerator, tpf->denominator);
513 513
         }
514 514
     } else {
515
-        /* if timebase value is not set in ap, read the timebase value from the driver */
515
+        /* if timebase value is not set, read the timebase value from the driver */
516 516
         if (ioctl(s->fd, VIDIOC_G_PARM, &streamparm) != 0) {
517 517
             av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", strerror(errno));
518 518
             return AVERROR(errno);
519 519
         }
520 520
     }
521
-    ap->time_base.num = tpf->numerator;
522
-    ap->time_base.den = tpf->denominator;
523 521
 
524 522
     return 0;
525 523
 }
... ...
@@ -616,7 +622,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
616 616
     desired_format = device_try_init(s1, pix_fmt, &s->width, &s->height, &codec_id);
617 617
     if (desired_format == 0) {
618 618
         av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for "
619
-               "codec_id %d, pix_fmt %d.\n", s1->video_codec_id, ap->pix_fmt);
619
+               "codec_id %d, pix_fmt %d.\n", s1->video_codec_id, pix_fmt);
620 620
         close(s->fd);
621 621
 
622 622
         res = AVERROR(EIO);
... ...
@@ -660,6 +666,7 @@ out:
660 660
     av_freep(&s->video_size);
661 661
     av_freep(&s->pixel_format);
662 662
     av_freep(&s->standard);
663
+    av_freep(&s->framerate);
663 664
     return res;
664 665
 }
665 666
 
... ...
@@ -711,6 +718,7 @@ static const AVOption options[] = {
711 711
     { "channel",  "", OFFSET(channel),  FF_OPT_TYPE_INT,    {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
712 712
     { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
713 713
     { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
714
+    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
714 715
     { NULL },
715 716
 };
716 717
 
... ...
@@ -26,8 +26,6 @@
26 26
 #include <vfw.h>
27 27
 #include "avdevice.h"
28 28
 
29
-//#define DEBUG_VFW
30
-
31 29
 /* Defines for VFW missing from MinGW.
32 30
  * Remove this when MinGW incorporates them. */
33 31
 #define HWND_MESSAGE                ((HWND)-3)
... ...
@@ -43,6 +41,7 @@ struct vfw_ctx {
43 43
     unsigned int curbufsize;
44 44
     unsigned int frame_num;
45 45
     char *video_size;       /**< A string describing video size, set by a private option. */
46
+    char *framerate;        /**< Set by a private option. */
46 47
 };
47 48
 
48 49
 static enum PixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
... ...
@@ -119,7 +118,7 @@ static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
119 119
 
120 120
 static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
121 121
 {
122
-#ifdef DEBUG_VFW
122
+#ifdef DEBUG
123 123
     av_log(s, AV_LOG_DEBUG, "VIDEOHDR\n");
124 124
     dstruct(s, vhdr, lpData, "p");
125 125
     dstruct(s, vhdr, dwBufferLength, "lu");
... ...
@@ -234,6 +233,7 @@ static int vfw_read_close(AVFormatContext *s)
234 234
     }
235 235
 
236 236
     av_freep(&ctx->video_size);
237
+    av_freep(&ctx->framerate);
237 238
 
238 239
     return 0;
239 240
 }
... ...
@@ -250,6 +250,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
250 250
     DWORD biCompression;
251 251
     WORD biBitCount;
252 252
     int ret;
253
+    AVRational fps;
253 254
 
254 255
     if (!strcmp(s->filename, "list")) {
255 256
         for (devnum = 0; devnum <= 9; devnum++) {
... ...
@@ -267,10 +268,10 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
267 267
         return AVERROR(EIO);
268 268
     }
269 269
 
270
-    if(!ap->time_base.den) {
271
-        av_log(s, AV_LOG_ERROR, "A time base must be specified.\n");
272
-        return AVERROR(EIO);
273
-    }
270
+#if FF_API_FORMAT_PARAMETERS
271
+    if (ap->time_base.num)
272
+        fps = (AVRational){ap->time_base.den, ap->time_base.num};
273
+#endif
274 274
 
275 275
     ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
276 276
     if(!ctx->hwnd) {
... ...
@@ -369,7 +370,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
369 369
 
370 370
     cparms.fYield = 1; // Spawn a background thread
371 371
     cparms.dwRequestMicroSecPerFrame =
372
-                               (ap->time_base.num*1000000) / ap->time_base.den;
372
+                               (fps.den*1000000) / fps.num;
373 373
     cparms.fAbortLeftMouse = 0;
374 374
     cparms.fAbortRightMouse = 0;
375 375
     cparms.fCaptureAudio = 0;
... ...
@@ -381,7 +382,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
381 381
         goto fail_io;
382 382
 
383 383
     codec = st->codec;
384
-    codec->time_base = ap->time_base;
384
+    codec->time_base = (AVRational){fps.den, fps.num};
385 385
     codec->codec_type = AVMEDIA_TYPE_VIDEO;
386 386
     codec->width  = bi->bmiHeader.biWidth;
387 387
     codec->height = bi->bmiHeader.biHeight;
... ...
@@ -469,6 +470,7 @@ static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
469 469
 #define DEC AV_OPT_FLAG_DECODING_PARAM
470 470
 static const AVOption options[] = {
471 471
     { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
472
+    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
472 473
     { NULL },
473 474
 };
474 475
 
... ...
@@ -246,7 +246,7 @@ static int fourxm_read_packet(AVFormatContext *s,
246 246
     FourxmDemuxContext *fourxm = s->priv_data;
247 247
     AVIOContext *pb = s->pb;
248 248
     unsigned int fourcc_tag;
249
-    unsigned int size, out_size av_unused;
249
+    unsigned int size;
250 250
     int ret = 0;
251 251
     unsigned int track_number;
252 252
     int packet_read = 0;
... ...
@@ -295,7 +295,7 @@ static int fourxm_read_packet(AVFormatContext *s,
295 295
 
296 296
         case snd__TAG:
297 297
             track_number = avio_rl32(pb);
298
-            out_size= avio_rl32(pb);
298
+            avio_skip(pb, 4);
299 299
             size-=8;
300 300
 
301 301
             if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
... ...
@@ -26,8 +26,6 @@
26 26
 #include "avformat.h"
27 27
 #include "apetag.h"
28 28
 
29
-#define ENABLE_DEBUG 0
30
-
31 29
 /* The earliest and latest file formats supported by this library */
32 30
 #define APE_MIN_VERSION 3950
33 31
 #define APE_MAX_VERSION 3990
... ...
@@ -96,7 +94,7 @@ static int ape_probe(AVProbeData * p)
96 96
 
97 97
 static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
98 98
 {
99
-#if ENABLE_DEBUG
99
+#ifdef DEBUG
100 100
     int i;
101 101
 
102 102
     av_log(s, AV_LOG_DEBUG, "Descriptor Block:\n\n");
... ...
@@ -24,8 +24,6 @@
24 24
 #include "avformat.h"
25 25
 #include "apetag.h"
26 26
 
27
-#define ENABLE_DEBUG 0
28
-
29 27
 #define APE_TAG_VERSION               2000
30 28
 #define APE_TAG_FOOTER_BYTES          32
31 29
 #define APE_TAG_FLAG_CONTAINS_HEADER  (1 << 31)
... ...
@@ -35,11 +33,11 @@ static int ape_tag_read_field(AVFormatContext *s)
35 35
 {
36 36
     AVIOContext *pb = s->pb;
37 37
     uint8_t key[1024], *value;
38
-    uint32_t size, flags av_unused;
38
+    uint32_t size;
39 39
     int i, c;
40 40
 
41 41
     size = avio_rl32(pb);  /* field size */
42
-    flags = avio_rl32(pb); /* field flags */
42
+    avio_skip(pb, 4);      /* field flags */
43 43
     for (i = 0; i < sizeof(key) - 1; i++) {
44 44
         c = avio_r8(pb);
45 45
         if (c < 0x20 || c > 0x7E)
... ...
@@ -209,7 +209,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
209 209
     ff_asf_guid g;
210 210
     enum AVMediaType type;
211 211
     int type_specific_size, sizeX;
212
-    uint64_t total_size av_unused;
213 212
     unsigned int tag1;
214 213
     int64_t pos1, pos2, start_time;
215 214
     int test_for_ext_stream_audio, is_dvr_ms_audio=0;
... ...
@@ -256,7 +255,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
256 256
         return -1;
257 257
     }
258 258
     ff_get_guid(pb, &g);
259
-    total_size = avio_rl64(pb);
259
+    avio_skip(pb, 8); /* total_size */
260 260
     type_specific_size = avio_rl32(pb);
261 261
     avio_rl32(pb);
262 262
     st->id = avio_rl16(pb) & 0x7f; /* stream id */
... ...
@@ -393,7 +392,7 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
393 393
     AVIOContext *pb = s->pb;
394 394
     ff_asf_guid g;
395 395
     int ext_len, payload_ext_ct, stream_ct, i;
396
-    uint32_t ext_d av_unused, leak_rate, stream_num;
396
+    uint32_t leak_rate, stream_num;
397 397
     unsigned int stream_languageid_index;
398 398
 
399 399
     avio_rl64(pb); // starttime
... ...
@@ -427,7 +426,7 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
427 427
 
428 428
     for (i=0; i<payload_ext_ct; i++){
429 429
         ff_get_guid(pb, &g);
430
-        ext_d=avio_rl16(pb);
430
+        avio_skip(pb, 2);
431 431
         ext_len=avio_rl32(pb);
432 432
         avio_skip(pb, ext_len);
433 433
     }
... ...
@@ -511,7 +510,7 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
511 511
 {
512 512
     AVIOContext *pb = s->pb;
513 513
     ASFContext *asf = s->priv_data;
514
-    int n, stream_num, name_len, value_len, value_type av_unused, value_num;
514
+    int n, stream_num, name_len, value_len, value_num;
515 515
     int ret, i;
516 516
     n = avio_rl16(pb);
517 517
 
... ...
@@ -521,7 +520,7 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
521 521
         avio_rl16(pb); //lang_list_index
522 522
         stream_num= avio_rl16(pb);
523 523
         name_len=   avio_rl16(pb);
524
-        value_type= avio_rl16(pb);
524
+        avio_skip(pb, 2); /* value_type */
525 525
         value_len=  avio_rl32(pb);
526 526
 
527 527
         if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
... ...
@@ -626,10 +625,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
626 626
             // if so the next iteration will pick it up
627 627
             continue;
628 628
         } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) {
629
-            av_unused int v1, v2;
630 629
             ff_get_guid(pb, &g);
631
-            v1 = avio_rl32(pb);
632
-            v2 = avio_rl16(pb);
630
+            avio_skip(pb, 6);
633 631
             continue;
634 632
         } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
635 633
             asf_read_marker(s, gsize);
... ...
@@ -799,7 +796,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
799 799
     ASFContext *asf = s->priv_data;
800 800
     int rsize = 1;
801 801
     int num = avio_r8(pb);
802
-    int64_t ts0, ts1 av_unused;
802
+    int64_t ts0;
803 803
 
804 804
     asf->packet_segments--;
805 805
     asf->packet_key_frame = num >> 7;
... ...
@@ -822,7 +819,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
822 822
 //            av_log(s, AV_LOG_DEBUG, "\n");
823 823
             avio_skip(pb, 10);
824 824
             ts0= avio_rl64(pb);
825
-            ts1= avio_rl64(pb);
825
+            avio_skip(pb, 8);;
826 826
             avio_skip(pb, 12);
827 827
             avio_rl32(pb);
828 828
             avio_skip(pb, asf->packet_replic_size - 8 - 38 - 4);
... ...
@@ -295,9 +295,7 @@ static int gif_write_video(AVFormatContext *s,
295 295
                            AVCodecContext *enc, const uint8_t *buf, int size)
296 296
 {
297 297
     AVIOContext *pb = s->pb;
298
-    GIFContext *gif = s->priv_data;
299 298
     int jiffies;
300
-    int64_t delay;
301 299
 
302 300
     /* graphic control extension block */
303 301
     avio_w8(pb, 0x21);
... ...
@@ -307,8 +305,6 @@ static int gif_write_video(AVFormatContext *s,
307 307
 
308 308
     /* 1 jiffy is 1/70 s */
309 309
     /* the delay_time field indicates the number of jiffies - 1 */
310
-    delay = gif->file_time - gif->time;
311
-
312 310
     /* XXX: should use delay, in order to be more accurate */
313 311
     /* instead of using the same rounded value each time */
314 312
     /* XXX: don't even remember if I really use it for now */
... ...
@@ -35,17 +35,6 @@
35 35
 #include "libavutil/intreadwrite.h"
36 36
 #include "avformat.h"
37 37
 
38
-/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
39
- * verbose information about the demux process */
40
-#define DEBUG_IPMOVIE 0
41
-
42
-#if DEBUG_IPMOVIE
43
-#undef printf
44
-#define debug_ipmovie printf
45
-#else
46
-static inline void debug_ipmovie(const char *format, ...) { }
47
-#endif
48
-
49 38
 #define CHUNK_PREAMBLE_SIZE 4
50 39
 #define OPCODE_PREAMBLE_SIZE 4
51 40
 
... ...
@@ -150,8 +139,8 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
150 150
             s->audio_frame_count +=
151 151
                 (s->audio_chunk_size - 6) / s->audio_channels;
152 152
 
153
-        debug_ipmovie("sending audio frame with pts %"PRId64" (%d audio frames)\n",
154
-            pkt->pts, s->audio_frame_count);
153
+        av_dlog(NULL, "sending audio frame with pts %"PRId64" (%d audio frames)\n",
154
+                pkt->pts, s->audio_frame_count);
155 155
 
156 156
         chunk_type = CHUNK_VIDEO;
157 157
 
... ...
@@ -195,8 +184,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
195 195
         pkt->stream_index = s->video_stream_index;
196 196
         pkt->pts = s->video_pts;
197 197
 
198
-        debug_ipmovie("sending video frame with pts %"PRId64"\n",
199
-            pkt->pts);
198
+        av_dlog(NULL, "sending video frame with pts %"PRId64"\n", pkt->pts);
200 199
 
201 200
         s->video_pts += s->frame_pts_inc;
202 201
 
... ...
@@ -244,36 +232,36 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
244 244
     chunk_size = AV_RL16(&chunk_preamble[0]);
245 245
     chunk_type = AV_RL16(&chunk_preamble[2]);
246 246
 
247
-    debug_ipmovie("chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size);
247
+    av_dlog(NULL, "chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size);
248 248
 
249 249
     switch (chunk_type) {
250 250
 
251 251
     case CHUNK_INIT_AUDIO:
252
-        debug_ipmovie("initialize audio\n");
252
+        av_dlog(NULL, "initialize audio\n");
253 253
         break;
254 254
 
255 255
     case CHUNK_AUDIO_ONLY:
256
-        debug_ipmovie("audio only\n");
256
+        av_dlog(NULL, "audio only\n");
257 257
         break;
258 258
 
259 259
     case CHUNK_INIT_VIDEO:
260
-        debug_ipmovie("initialize video\n");
260
+        av_dlog(NULL, "initialize video\n");
261 261
         break;
262 262
 
263 263
     case CHUNK_VIDEO:
264
-        debug_ipmovie("video (and audio)\n");
264
+        av_dlog(NULL, "video (and audio)\n");
265 265
         break;
266 266
 
267 267
     case CHUNK_SHUTDOWN:
268
-        debug_ipmovie("shutdown\n");
268
+        av_dlog(NULL, "shutdown\n");
269 269
         break;
270 270
 
271 271
     case CHUNK_END:
272
-        debug_ipmovie("end\n");
272
+        av_dlog(NULL, "end\n");
273 273
         break;
274 274
 
275 275
     default:
276
-        debug_ipmovie("invalid chunk\n");
276
+        av_dlog(NULL, "invalid chunk\n");
277 277
         chunk_type = CHUNK_BAD;
278 278
         break;
279 279
 
... ...
@@ -299,29 +287,29 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
299 299
         chunk_size -= OPCODE_PREAMBLE_SIZE;
300 300
         chunk_size -= opcode_size;
301 301
         if (chunk_size < 0) {
302
-            debug_ipmovie("chunk_size countdown just went negative\n");
302
+            av_dlog(NULL, "chunk_size countdown just went negative\n");
303 303
             chunk_type = CHUNK_BAD;
304 304
             break;
305 305
         }
306 306
 
307
-        debug_ipmovie("  opcode type %02X, version %d, 0x%04X bytes: ",
308
-            opcode_type, opcode_version, opcode_size);
307
+        av_dlog(NULL, "  opcode type %02X, version %d, 0x%04X bytes: ",
308
+                opcode_type, opcode_version, opcode_size);
309 309
         switch (opcode_type) {
310 310
 
311 311
         case OPCODE_END_OF_STREAM:
312
-            debug_ipmovie("end of stream\n");
312
+            av_dlog(NULL, "end of stream\n");
313 313
             avio_skip(pb, opcode_size);
314 314
             break;
315 315
 
316 316
         case OPCODE_END_OF_CHUNK:
317
-            debug_ipmovie("end of chunk\n");
317
+            av_dlog(NULL, "end of chunk\n");
318 318
             avio_skip(pb, opcode_size);
319 319
             break;
320 320
 
321 321
         case OPCODE_CREATE_TIMER:
322
-            debug_ipmovie("create timer\n");
322
+            av_dlog(NULL, "create timer\n");
323 323
             if ((opcode_version > 0) || (opcode_size > 6)) {
324
-                debug_ipmovie("bad create_timer opcode\n");
324
+                av_dlog(NULL, "bad create_timer opcode\n");
325 325
                 chunk_type = CHUNK_BAD;
326 326
                 break;
327 327
             }
... ...
@@ -331,14 +319,15 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
331 331
                 break;
332 332
             }
333 333
             s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]);
334
-            debug_ipmovie("  %.2f frames/second (timer div = %d, subdiv = %d)\n",
335
-                1000000.0/s->frame_pts_inc, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
334
+            av_dlog(NULL, "  %.2f frames/second (timer div = %d, subdiv = %d)\n",
335
+                    1000000.0 / s->frame_pts_inc, AV_RL32(&scratch[0]),
336
+                    AV_RL16(&scratch[4]));
336 337
             break;
337 338
 
338 339
         case OPCODE_INIT_AUDIO_BUFFERS:
339
-            debug_ipmovie("initialize audio buffers\n");
340
+            av_dlog(NULL, "initialize audio buffers\n");
340 341
             if ((opcode_version > 1) || (opcode_size > 10)) {
341
-                debug_ipmovie("bad init_audio_buffers opcode\n");
342
+                av_dlog(NULL, "bad init_audio_buffers opcode\n");
342 343
                 chunk_type = CHUNK_BAD;
343 344
                 break;
344 345
             }
... ...
@@ -360,23 +349,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
360 360
                 s->audio_type = CODEC_ID_PCM_S16LE;
361 361
             else
362 362
                 s->audio_type = CODEC_ID_PCM_U8;
363
-            debug_ipmovie("audio: %d bits, %d Hz, %s, %s format\n",
364
-                s->audio_bits,
365
-                s->audio_sample_rate,
366
-                (s->audio_channels == 2) ? "stereo" : "mono",
367
-                (s->audio_type == CODEC_ID_INTERPLAY_DPCM) ?
368
-                "Interplay audio" : "PCM");
363
+            av_dlog(NULL, "audio: %d bits, %d Hz, %s, %s format\n",
364
+                    s->audio_bits, s->audio_sample_rate,
365
+                    (s->audio_channels == 2) ? "stereo" : "mono",
366
+                    (s->audio_type == CODEC_ID_INTERPLAY_DPCM) ?
367
+                    "Interplay audio" : "PCM");
369 368
             break;
370 369
 
371 370
         case OPCODE_START_STOP_AUDIO:
372
-            debug_ipmovie("start/stop audio\n");
371
+            av_dlog(NULL, "start/stop audio\n");
373 372
             avio_skip(pb, opcode_size);
374 373
             break;
375 374
 
376 375
         case OPCODE_INIT_VIDEO_BUFFERS:
377
-            debug_ipmovie("initialize video buffers\n");
376
+            av_dlog(NULL, "initialize video buffers\n");
378 377
             if ((opcode_version > 2) || (opcode_size > 8)) {
379
-                debug_ipmovie("bad init_video_buffers opcode\n");
378
+                av_dlog(NULL, "bad init_video_buffers opcode\n");
380 379
                 chunk_type = CHUNK_BAD;
381 380
                 break;
382 381
             }
... ...
@@ -392,8 +380,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
392 392
             } else {
393 393
                 s->video_bpp = 16;
394 394
             }
395
-            debug_ipmovie("video resolution: %d x %d\n",
396
-                s->video_width, s->video_height);
395
+            av_dlog(NULL, "video resolution: %d x %d\n",
396
+                    s->video_width, s->video_height);
397 397
             break;
398 398
 
399 399
         case OPCODE_UNKNOWN_06:
... ...
@@ -403,17 +391,17 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
403 403
         case OPCODE_UNKNOWN_13:
404 404
         case OPCODE_UNKNOWN_14:
405 405
         case OPCODE_UNKNOWN_15:
406
-            debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type);
406
+            av_dlog(NULL, "unknown (but documented) opcode %02X\n", opcode_type);
407 407
             avio_skip(pb, opcode_size);
408 408
             break;
409 409
 
410 410
         case OPCODE_SEND_BUFFER:
411
-            debug_ipmovie("send buffer\n");
411
+            av_dlog(NULL, "send buffer\n");
412 412
             avio_skip(pb, opcode_size);
413 413
             break;
414 414
 
415 415
         case OPCODE_AUDIO_FRAME:
416
-            debug_ipmovie("audio frame\n");
416
+            av_dlog(NULL, "audio frame\n");
417 417
 
418 418
             /* log position and move on for now */
419 419
             s->audio_chunk_offset = avio_tell(pb);
... ...
@@ -422,26 +410,26 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
422 422
             break;
423 423
 
424 424
         case OPCODE_SILENCE_FRAME:
425
-            debug_ipmovie("silence frame\n");
425
+            av_dlog(NULL, "silence frame\n");
426 426
             avio_skip(pb, opcode_size);
427 427
             break;
428 428
 
429 429
         case OPCODE_INIT_VIDEO_MODE:
430
-            debug_ipmovie("initialize video mode\n");
430
+            av_dlog(NULL, "initialize video mode\n");
431 431
             avio_skip(pb, opcode_size);
432 432
             break;
433 433
 
434 434
         case OPCODE_CREATE_GRADIENT:
435
-            debug_ipmovie("create gradient\n");
435
+            av_dlog(NULL, "create gradient\n");
436 436
             avio_skip(pb, opcode_size);
437 437
             break;
438 438
 
439 439
         case OPCODE_SET_PALETTE:
440
-            debug_ipmovie("set palette\n");
440
+            av_dlog(NULL, "set palette\n");
441 441
             /* check for the logical maximum palette size
442 442
              * (3 * 256 + 4 bytes) */
443 443
             if (opcode_size > 0x304) {
444
-                debug_ipmovie("demux_ipmovie: set_palette opcode too large\n");
444
+                av_dlog(NULL, "demux_ipmovie: set_palette opcode too large\n");
445 445
                 chunk_type = CHUNK_BAD;
446 446
                 break;
447 447
             }
... ...
@@ -455,7 +443,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
455 455
             last_color = first_color + AV_RL16(&scratch[2]) - 1;
456 456
             /* sanity check (since they are 16 bit values) */
457 457
             if ((first_color > 0xFF) || (last_color > 0xFF)) {
458
-                debug_ipmovie("demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
458
+                av_dlog(NULL, "demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
459 459
                     first_color, last_color);
460 460
                 chunk_type = CHUNK_BAD;
461 461
                 break;
... ...
@@ -473,12 +461,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
473 473
             break;
474 474
 
475 475
         case OPCODE_SET_PALETTE_COMPRESSED:
476
-            debug_ipmovie("set palette compressed\n");
476
+            av_dlog(NULL, "set palette compressed\n");
477 477
             avio_skip(pb, opcode_size);
478 478
             break;
479 479
 
480 480
         case OPCODE_SET_DECODING_MAP:
481
-            debug_ipmovie("set decoding map\n");
481
+            av_dlog(NULL, "set decoding map\n");
482 482
 
483 483
             /* log position and move on for now */
484 484
             s->decode_map_chunk_offset = avio_tell(pb);
... ...
@@ -487,7 +475,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
487 487
             break;
488 488
 
489 489
         case OPCODE_VIDEO_DATA:
490
-            debug_ipmovie("set video data\n");
490
+            av_dlog(NULL, "set video data\n");
491 491
 
492 492
             /* log position and move on for now */
493 493
             s->video_chunk_offset = avio_tell(pb);
... ...
@@ -496,7 +484,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
496 496
             break;
497 497
 
498 498
         default:
499
-            debug_ipmovie("*** unknown opcode type\n");
499
+            av_dlog(NULL, "*** unknown opcode type\n");
500 500
             chunk_type = CHUNK_BAD;
501 501
             break;
502 502
 
... ...
@@ -186,13 +186,13 @@ static int mmf_read_header(AVFormatContext *s,
186 186
     unsigned int tag;
187 187
     AVIOContext *pb = s->pb;
188 188
     AVStream *st;
189
-    int64_t file_size av_unused, size;
189
+    int64_t size;
190 190
     int rate, params;
191 191
 
192 192
     tag = avio_rl32(pb);
193 193
     if (tag != MKTAG('M', 'M', 'M', 'D'))
194 194
         return -1;
195
-    file_size = avio_rb32(pb);
195
+    avio_skip(pb, 4); /* file_size */
196 196
 
197 197
     /* Skip some unused chunks that may or may not be present */
198 198
     for(;; avio_skip(pb, size)) {
... ...
@@ -572,10 +572,9 @@ static int mpegps_read_packet(AVFormatContext *s,
572 572
     pkt->dts = dts;
573 573
     pkt->pos = dummy_pos;
574 574
     pkt->stream_index = st->index;
575
-#if 0
576
-    av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n",
577
-           pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, pkt->size);
578
-#endif
575
+    av_dlog(s, "%d: pts=%0.3f dts=%0.3f size=%d\n",
576
+            pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0,
577
+            pkt->size);
579 578
 
580 579
     return 0;
581 580
 }
... ...
@@ -1078,10 +1078,8 @@ retry:
1078 1078
                 best_dts= pkt_desc->dts;
1079 1079
         }
1080 1080
 
1081
-#if 0
1082
-        av_log(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n",
1083
-               scr/90000.0, best_dts/90000.0);
1084
-#endif
1081
+        av_dlog(ctx, "bumping scr, scr:%f, dts:%f\n",
1082
+                scr / 90000.0, best_dts / 90000.0);
1085 1083
         if(best_dts == INT64_MAX)
1086 1084
             return 0;
1087 1085
 
... ...
@@ -1578,10 +1578,8 @@ static int mpegts_read_header(AVFormatContext *s,
1578 1578
         s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
1579 1579
         st->codec->bit_rate = s->bit_rate;
1580 1580
         st->start_time = ts->cur_pcr;
1581
-#if 0
1582
-        av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n",
1583
-               st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);
1584
-#endif
1581
+        av_dlog(ts->stream, "start=%0.3f pcr=%0.3f incr=%d\n",
1582
+                st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);
1585 1583
     }
1586 1584
 
1587 1585
     avio_seek(pb, pos, SEEK_SET);
... ...
@@ -190,7 +190,6 @@ static int decode_main_header(NUTContext *nut){
190 190
     uint64_t tmp, end;
191 191
     unsigned int stream_count;
192 192
     int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx;
193
-    int64_t tmp_match;
194 193
 
195 194
     end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
196 195
     end += avio_tell(bc);
... ...
@@ -218,7 +217,6 @@ static int decode_main_header(NUTContext *nut){
218 218
     tmp_pts=0;
219 219
     tmp_mul=1;
220 220
     tmp_stream=0;
221
-    tmp_match= 1-(1LL<<62);
222 221
     tmp_head_idx= 0;
223 222
     for(i=0; i<256;){
224 223
         int tmp_flags = ffio_read_varlen(bc);
... ...
@@ -232,7 +230,7 @@ static int decode_main_header(NUTContext *nut){
232 232
         else             tmp_res   = 0;
233 233
         if(tmp_fields>5) count     = ffio_read_varlen(bc);
234 234
         else             count     = tmp_mul - tmp_size;
235
-        if(tmp_fields>6) tmp_match = get_s(bc);
235
+        if(tmp_fields>6) get_s(bc);
236 236
         if(tmp_fields>7) tmp_head_idx= ffio_read_varlen(bc);
237 237
 
238 238
         while(tmp_fields-- > 8)
... ...
@@ -197,8 +197,6 @@ static int ogg_read_page(AVFormatContext *s, int *str)
197 197
     int flags, nsegs;
198 198
     uint64_t gp;
199 199
     uint32_t serial;
200
-    uint32_t seq av_unused;
201
-    uint32_t crc av_unused;
202 200
     int size, idx;
203 201
     uint8_t sync[4];
204 202
     int sp = 0;
... ...
@@ -232,8 +230,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
232 232
     flags = avio_r8(bc);
233 233
     gp = avio_rl64 (bc);
234 234
     serial = avio_rl32 (bc);
235
-    seq = avio_rl32 (bc);
236
-    crc = avio_rl32 (bc);
235
+    avio_skip(bc, 8); /* seq, crc */
237 236
     nsegs = avio_r8(bc);
238 237
 
239 238
     idx = ogg_find_stream (ogg, serial);
... ...
@@ -364,8 +361,6 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
364 364
         }
365 365
     }while (!complete);
366 366
 
367
-    av_dlog(s, "ogg_packet: idx %i, frame size %i, start %i\n",
368
-           idx, os->psize, os->pstart);
369 367
 
370 368
     if (os->granule == -1)
371 369
         av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos);
... ...
@@ -39,7 +39,6 @@ ogm_header(AVFormatContext *s, int idx)
39 39
     const uint8_t *p = os->buf + os->pstart;
40 40
     uint64_t time_unit;
41 41
     uint64_t spu;
42
-    uint32_t default_len av_unused;
43 42
 
44 43
     if(!(*p & 1))
45 44
         return 0;
... ...
@@ -74,8 +73,7 @@ ogm_header(AVFormatContext *s, int idx)
74 74
 
75 75
         time_unit   = bytestream_get_le64(&p);
76 76
         spu         = bytestream_get_le64(&p);
77
-        default_len = bytestream_get_le32(&p);
78
-
77
+        p += 4;                     /* default_len */
79 78
         p += 8;                     /* buffersize + bits_per_sample */
80 79
 
81 80
         if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
... ...
@@ -80,6 +80,8 @@ static int oma_read_header(AVFormatContext *s,
80 80
 
81 81
     ff_id3v2_read(s, ID3v2_EA3_MAGIC);
82 82
     ret = avio_read(s->pb, buf, EA3_HEADER_SIZE);
83
+    if (ret < EA3_HEADER_SIZE)
84
+        return -1;
83 85
 
84 86
     if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
85 87
         av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
... ...
@@ -80,8 +80,6 @@ static av_cold int rl2_read_header(AVFormatContext *s,
80 80
     unsigned int audio_frame_counter = 0;
81 81
     unsigned int video_frame_counter = 0;
82 82
     unsigned int back_size;
83
-    int data_size av_unused;
84
-    unsigned short encoding_method av_unused;
85 83
     unsigned short sound_rate;
86 84
     unsigned short rate;
87 85
     unsigned short channels;
... ...
@@ -98,14 +96,14 @@ static av_cold int rl2_read_header(AVFormatContext *s,
98 98
     avio_skip(pb,4);          /* skip FORM tag */
99 99
     back_size = avio_rl32(pb); /**< get size of the background frame */
100 100
     signature = avio_rb32(pb);
101
-    data_size = avio_rb32(pb);
101
+    avio_skip(pb, 4);         /* data size */
102 102
     frame_count = avio_rl32(pb);
103 103
 
104 104
     /* disallow back_sizes and frame_counts that may lead to overflows later */
105 105
     if(back_size > INT_MAX/2  || frame_count > INT_MAX / sizeof(uint32_t))
106 106
         return AVERROR_INVALIDDATA;
107 107
 
108
-    encoding_method = avio_rl16(pb);
108
+    avio_skip(pb, 2);         /* encoding mentod */
109 109
     sound_rate = avio_rl16(pb);
110 110
     rate = avio_rl16(pb);
111 111
     channels = avio_rl16(pb);
... ...
@@ -280,7 +280,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
280 280
         if (rm_read_audio_stream_info(s, pb, st, rst, 0))
281 281
             return -1;
282 282
     } else {
283
-        int fps, fps2 av_unused;
283
+        int fps;
284 284
         if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) {
285 285
         fail1:
286 286
             av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
... ...
@@ -298,7 +298,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
298 298
         fps= avio_rb16(pb);
299 299
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
300 300
         avio_rb32(pb);
301
-        fps2= avio_rb16(pb);
301
+        avio_skip(pb, 2);
302 302
         avio_rb16(pb);
303 303
 
304 304
         if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
... ...
@@ -299,9 +299,9 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
299 299
         stream->codec->codec_tag == 124) {
300 300
         // We have to split Escape 124 frames because there are
301 301
         // multiple frames per chunk in Escape 124 samples.
302
-        uint32_t frame_size, frame_flags av_unused;
302
+        uint32_t frame_size;
303 303
 
304
-        frame_flags = avio_rl32(pb);
304
+        avio_skip(pb, 4); /* flags */
305 305
         frame_size = avio_rl32(pb);
306 306
         if (avio_seek(pb, -8, SEEK_CUR) < 0)
307 307
             return AVERROR(EIO);
... ...
@@ -108,8 +108,7 @@ static int parse_fmtp_config(AVStream *st, char *value)
108 108
     int len = ff_hex_to_data(NULL, value), i, ret = 0;
109 109
     GetBitContext gb;
110 110
     uint8_t *config;
111
-    int audio_mux_version, same_time_framing, num_sub_frames av_unused,
112
-        num_programs, num_layers;
111
+    int audio_mux_version, same_time_framing, num_programs, num_layers;
113 112
 
114 113
     /* Pad this buffer, too, to avoid out of bounds reads with get_bits below */
115 114
     config = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
... ...
@@ -119,7 +118,7 @@ static int parse_fmtp_config(AVStream *st, char *value)
119 119
     init_get_bits(&gb, config, len*8);
120 120
     audio_mux_version = get_bits(&gb, 1);
121 121
     same_time_framing = get_bits(&gb, 1);
122
-    num_sub_frames    = get_bits(&gb, 6);
122
+    skip_bits(&gb, 6); /* num_sub_frames */
123 123
     num_programs      = get_bits(&gb, 4);
124 124
     num_layers        = get_bits(&gb, 3);
125 125
     if (audio_mux_version != 0 || same_time_framing != 1 || num_programs != 0 ||
... ...
@@ -45,7 +45,6 @@
45 45
 #include "url.h"
46 46
 
47 47
 //#define DEBUG
48
-//#define DEBUG_RTP_TCP
49 48
 
50 49
 /* Timeout values for socket poll, in ms,
51 50
  * and read_packet(), in seconds  */
... ...
@@ -860,9 +859,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
860 860
         q = buf;
861 861
         for (;;) {
862 862
             ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1);
863
-#ifdef DEBUG_RTP_TCP
864 863
             av_dlog(s, "ret=%d c=%02x [%c]\n", ret, ch, ch);
865
-#endif
866 864
             if (ret != 1)
867 865
                 return AVERROR_EOF;
868 866
             if (ch == '\n')
... ...
@@ -32,7 +32,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
32 32
 {
33 33
     AVIOContext *pb = avctx->pb;
34 34
     char buf[36];
35
-    int datatype, filetype, t1, t2, nb_comments, flags av_unused;
35
+    int datatype, filetype, t1, t2, nb_comments;
36 36
     uint64_t start_pos = avio_size(pb) - 128;
37 37
 
38 38
     avio_seek(pb, start_pos, SEEK_SET);
... ...
@@ -57,7 +57,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
57 57
     t1          = avio_rl16(pb);
58 58
     t2          = avio_rl16(pb);
59 59
     nb_comments = avio_r8(pb);
60
-    flags       = avio_r8(pb);
60
+    avio_skip(pb, 1); /* flags */
61 61
     avio_skip(pb, 4);
62 62
     GET_SAUCE_META("encoder",   22);
63 63
 
... ...
@@ -85,7 +85,6 @@ static int sol_channels(int magic, int type)
85 85
 static int sol_read_header(AVFormatContext *s,
86 86
                           AVFormatParameters *ap)
87 87
 {
88
-    int size av_unused;
89 88
     unsigned int magic,tag;
90 89
     AVIOContext *pb = s->pb;
91 90
     unsigned int id, channels, rate, type;
... ...
@@ -99,7 +98,7 @@ static int sol_read_header(AVFormatContext *s,
99 99
         return -1;
100 100
     rate = avio_rl16(pb);
101 101
     type = avio_r8(pb);
102
-    size = avio_rl32(pb);
102
+    avio_skip(pb, 4); /* size */
103 103
     if (magic != 0x0B8D)
104 104
         avio_r8(pb); /* newer SOLs contain padding byte */
105 105
 
... ...
@@ -179,23 +179,23 @@ FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)                    \
179 179
 FATE_TESTS += $(FATE_H264)
180 180
 fate-h264: $(FATE_H264)
181 181
 
182
-fate-h264-conformance-aud_mw_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/AUD_MW_E.264
183
-fate-h264-conformance-ba1_ft_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BA1_FT_C.264
184
-fate-h264-conformance-ba1_sony_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BA1_Sony_D.jsv
185
-fate-h264-conformance-ba2_sony_f: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BA2_Sony_F.jsv
182
+fate-h264-conformance-aud_mw_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/AUD_MW_E.264
183
+fate-h264-conformance-ba1_ft_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA1_FT_C.264
184
+fate-h264-conformance-ba1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA1_Sony_D.jsv
185
+fate-h264-conformance-ba2_sony_f: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA2_Sony_F.jsv
186 186
 fate-h264-conformance-ba3_sva_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/BA3_SVA_C.264
187
-fate-h264-conformance-ba_mw_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BA_MW_D.264
188
-fate-h264-conformance-bamq1_jvc_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BAMQ1_JVC_C.264
189
-fate-h264-conformance-bamq2_jvc_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BAMQ2_JVC_C.264
190
-fate-h264-conformance-banm_mw_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BANM_MW_D.264
191
-fate-h264-conformance-basqp1_sony_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/BASQP1_Sony_C.jsv
192
-fate-h264-conformance-caba1_sony_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CABA1_Sony_D.jsv
193
-fate-h264-conformance-caba1_sva_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CABA1_SVA_B.264
194
-fate-h264-conformance-caba2_sony_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CABA2_Sony_E.jsv
195
-fate-h264-conformance-caba2_sva_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CABA2_SVA_B.264
187
+fate-h264-conformance-ba_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA_MW_D.264
188
+fate-h264-conformance-bamq1_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BAMQ1_JVC_C.264
189
+fate-h264-conformance-bamq2_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BAMQ2_JVC_C.264
190
+fate-h264-conformance-banm_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BANM_MW_D.264
191
+fate-h264-conformance-basqp1_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BASQP1_Sony_C.jsv
192
+fate-h264-conformance-caba1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA1_Sony_D.jsv
193
+fate-h264-conformance-caba1_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA1_SVA_B.264
194
+fate-h264-conformance-caba2_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA2_Sony_E.jsv
195
+fate-h264-conformance-caba2_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA2_SVA_B.264
196 196
 fate-h264-conformance-caba3_sony_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CABA3_Sony_C.jsv
197 197
 fate-h264-conformance-caba3_sva_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CABA3_SVA_B.264
198
-fate-h264-conformance-caba3_toshiba_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CABA3_TOSHIBA_E.264
198
+fate-h264-conformance-caba3_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA3_TOSHIBA_E.264
199 199
 fate-h264-conformance-cabac_mot_fld0_full: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/camp_mot_fld0_full.26l
200 200
 fate-h264-conformance-cabac_mot_frm0_full: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/camp_mot_frm0_full.26l
201 201
 fate-h264-conformance-cabac_mot_mbaff0_full: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/camp_mot_mbaff0_full.26l
... ...
@@ -206,7 +206,7 @@ fate-h264-conformance-cabastbr3_sony_b: CMD = framecrc  -vsync 0 -strict 1 -i $(
206 206
 fate-h264-conformance-cabref3_sand_d: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CABREF3_Sand_D.264
207 207
 fate-h264-conformance-cacqp3_sony_d: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CACQP3_Sony_D.jsv
208 208
 fate-h264-conformance-cafi1_sva_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAFI1_SVA_C.264
209
-fate-h264-conformance-cama1_sony_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CAMA1_Sony_C.jsv
209
+fate-h264-conformance-cama1_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMA1_Sony_C.jsv
210 210
 fate-h264-conformance-cama1_toshiba_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAMA1_TOSHIBA_B.264
211 211
 fate-h264-conformance-cama1_vtc_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/cama1_vtc_c.avc
212 212
 fate-h264-conformance-cama2_vtc_b: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/cama2_vtc_b.avc
... ...
@@ -219,37 +219,37 @@ fate-h264-conformance-camanl3_sand_e: CMD = framecrc  -vsync 0 -strict 1 -i $(SA
219 219
 fate-h264-conformance-camasl3_sony_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAMASL3_Sony_B.jsv
220 220
 fate-h264-conformance-camp_mot_mbaff_l30: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAMP_MOT_MBAFF_L30.26l
221 221
 fate-h264-conformance-camp_mot_mbaff_l31: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAMP_MOT_MBAFF_L31.26l
222
-fate-h264-conformance-canl1_sony_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL1_Sony_E.jsv
223
-fate-h264-conformance-canl1_sva_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL1_SVA_B.264
224
-fate-h264-conformance-canl1_toshiba_g: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL1_TOSHIBA_G.264
225
-fate-h264-conformance-canl2_sony_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL2_Sony_E.jsv
226
-fate-h264-conformance-canl2_sva_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL2_SVA_B.264
222
+fate-h264-conformance-canl1_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL1_Sony_E.jsv
223
+fate-h264-conformance-canl1_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL1_SVA_B.264
224
+fate-h264-conformance-canl1_toshiba_g: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL1_TOSHIBA_G.264
225
+fate-h264-conformance-canl2_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL2_Sony_E.jsv
226
+fate-h264-conformance-canl2_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL2_SVA_B.264
227 227
 fate-h264-conformance-canl3_sony_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CANL3_Sony_C.jsv
228
-fate-h264-conformance-canl3_sva_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL3_SVA_B.264
229
-fate-h264-conformance-canl4_sva_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANL4_SVA_B.264
230
-fate-h264-conformance-canlma2_sony_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANLMA2_Sony_C.jsv
231
-fate-h264-conformance-canlma3_sony_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CANLMA3_Sony_C.jsv
228
+fate-h264-conformance-canl3_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL3_SVA_B.264
229
+fate-h264-conformance-canl4_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL4_SVA_B.264
230
+fate-h264-conformance-canlma2_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANLMA2_Sony_C.jsv
231
+fate-h264-conformance-canlma3_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANLMA3_Sony_C.jsv
232 232
 fate-h264-conformance-capa1_toshiba_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAPA1_TOSHIBA_B.264
233 233
 fate-h264-conformance-capama3_sand_f: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAPAMA3_Sand_F.264
234
-fate-h264-conformance-capcm1_sand_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CAPCM1_Sand_E.264
235
-fate-h264-conformance-capcmnl1_sand_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CAPCMNL1_Sand_E.264
234
+fate-h264-conformance-capcm1_sand_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPCM1_Sand_E.264
235
+fate-h264-conformance-capcmnl1_sand_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPCMNL1_Sand_E.264
236 236
 fate-h264-conformance-capm3_sony_d: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAPM3_Sony_D.jsv
237
-fate-h264-conformance-caqp1_sony_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CAQP1_Sony_B.jsv
237
+fate-h264-conformance-caqp1_sony_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAQP1_Sony_B.jsv
238 238
 fate-h264-conformance-cavlc_mot_fld0_full_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/cvmp_mot_fld0_full_B.26l
239 239
 fate-h264-conformance-cavlc_mot_frm0_full_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/cvmp_mot_frm0_full_B.26l
240 240
 fate-h264-conformance-cavlc_mot_mbaff0_full_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/cvmp_mot_mbaff0_full_B.26l
241 241
 fate-h264-conformance-cavlc_mot_picaff0_full_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/cvmp_mot_picaff0_full_B.26l
242
-fate-h264-conformance-cawp1_toshiba_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CAWP1_TOSHIBA_E.264
242
+fate-h264-conformance-cawp1_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAWP1_TOSHIBA_E.264
243 243
 fate-h264-conformance-cawp5_toshiba_e: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CAWP5_TOSHIBA_E.264
244
-fate-h264-conformance-ci1_ft_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CI1_FT_B.264
245
-fate-h264-conformance-ci_mw_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CI_MW_D.264
244
+fate-h264-conformance-ci1_ft_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CI1_FT_B.264
245
+fate-h264-conformance-ci_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CI_MW_D.264
246 246
 fate-h264-conformance-cvbs3_sony_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVBS3_Sony_C.jsv
247
-fate-h264-conformance-cvcanlma2_sony_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CVCANLMA2_Sony_C.jsv
247
+fate-h264-conformance-cvcanlma2_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVCANLMA2_Sony_C.jsv
248 248
 fate-h264-conformance-cvfi1_sony_d: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVFI1_Sony_D.jsv
249 249
 fate-h264-conformance-cvfi1_sva_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVFI1_SVA_C.264
250 250
 fate-h264-conformance-cvfi2_sony_h: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVFI2_Sony_H.jsv
251 251
 fate-h264-conformance-cvfi2_sva_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVFI2_SVA_C.264
252
-fate-h264-conformance-cvma1_sony_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CVMA1_Sony_D.jsv
252
+fate-h264-conformance-cvma1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMA1_Sony_D.jsv
253 253
 fate-h264-conformance-cvma1_toshiba_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVMA1_TOSHIBA_B.264
254 254
 fate-h264-conformance-cvmanl1_toshiba_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVMANL1_TOSHIBA_B.264
255 255
 fate-h264-conformance-cvmanl2_toshiba_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVMANL2_TOSHIBA_B.264
... ...
@@ -261,68 +261,68 @@ fate-h264-conformance-cvmp_mot_frm_l31_b: CMD = framecrc  -vsync 0 -strict 1 -i
261 261
 fate-h264-conformance-cvnlfi1_sony_c: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/CVNLFI1_Sony_C.jsv
262 262
 fate-h264-conformance-cvnlfi2_sony_h: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVNLFI2_Sony_H.jsv
263 263
 fate-h264-conformance-cvpa1_toshiba_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVPA1_TOSHIBA_B.264
264
-fate-h264-conformance-cvpcmnl1_sva_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CVPCMNL1_SVA_C.264
265
-fate-h264-conformance-cvpcmnl2_sva_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CVPCMNL2_SVA_C.264
266
-fate-h264-conformance-cvwp1_toshiba_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/CVWP1_TOSHIBA_E.264
264
+fate-h264-conformance-cvpcmnl1_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVPCMNL1_SVA_C.264
265
+fate-h264-conformance-cvpcmnl2_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVPCMNL2_SVA_C.264
266
+fate-h264-conformance-cvwp1_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVWP1_TOSHIBA_E.264
267 267
 fate-h264-conformance-cvwp2_toshiba_e: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVWP2_TOSHIBA_E.264
268 268
 fate-h264-conformance-cvwp3_toshiba_e: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVWP3_TOSHIBA_E.264
269 269
 fate-h264-conformance-cvwp5_toshiba_e: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/CVWP5_TOSHIBA_E.264
270 270
 fate-h264-conformance-fi1_sony_e: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/FI1_Sony_E.jsv
271
-fate-h264-conformance-frext-alphaconformanceg: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/test8b43.264
272
-fate-h264-conformance-frext-bcrm_freh10: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh10.264 -vsync 0
273
-fate-h264-conformance-frext-brcm_freh11: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh11.264 -vsync 0
274
-fate-h264-conformance-frext-brcm_freh3: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh3.264
275
-fate-h264-conformance-frext-brcm_freh4: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh4.264 -vsync 0
276
-fate-h264-conformance-frext-brcm_freh5: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh5.264
277
-fate-h264-conformance-frext-brcm_freh8: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh8.264
278
-fate-h264-conformance-frext-brcm_freh9: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh9.264
279
-fate-h264-conformance-frext-freh12_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/Freh12_B.264
280
-fate-h264-conformance-frext-freh1_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/Freh1_B.264
281
-fate-h264-conformance-frext-freh2_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/Freh2_B.264
282
-fate-h264-conformance-frext-freh6: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/freh6.264 -vsync 0
283
-fate-h264-conformance-frext-freh7_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/Freh7_B.264 -vsync 0
284
-fate-h264-conformance-frext-frext01_jvc_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/FREXT01_JVC_D.264
285
-fate-h264-conformance-frext-frext02_jvc_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/FREXT02_JVC_C.264
286
-fate-h264-conformance-frext-frext1_panasonic_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/FRExt1_Panasonic.avc
287
-fate-h264-conformance-frext-frext2_panasonic_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync 0
288
-fate-h264-conformance-frext-frext3_panasonic_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/FRExt3_Panasonic.avc
289
-fate-h264-conformance-frext-frext4_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/FRExt4_Panasonic.avc
271
+fate-h264-conformance-frext-alphaconformanceg: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/test8b43.264
272
+fate-h264-conformance-frext-bcrm_freh10: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh10.264 -vsync 0
273
+fate-h264-conformance-frext-brcm_freh11: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh11.264 -vsync 0
274
+fate-h264-conformance-frext-brcm_freh3: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh3.264
275
+fate-h264-conformance-frext-brcm_freh4: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh4.264 -vsync 0
276
+fate-h264-conformance-frext-brcm_freh5: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh5.264
277
+fate-h264-conformance-frext-brcm_freh8: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh8.264
278
+fate-h264-conformance-frext-brcm_freh9: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh9.264
279
+fate-h264-conformance-frext-freh12_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh12_B.264
280
+fate-h264-conformance-frext-freh1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh1_B.264
281
+fate-h264-conformance-frext-freh2_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh2_B.264
282
+fate-h264-conformance-frext-freh6: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh6.264 -vsync 0
283
+fate-h264-conformance-frext-freh7_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh7_B.264 -vsync 0
284
+fate-h264-conformance-frext-frext01_jvc_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FREXT01_JVC_D.264
285
+fate-h264-conformance-frext-frext02_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FREXT02_JVC_C.264
286
+fate-h264-conformance-frext-frext1_panasonic_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt1_Panasonic.avc
287
+fate-h264-conformance-frext-frext2_panasonic_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync 0
288
+fate-h264-conformance-frext-frext3_panasonic_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt3_Panasonic.avc
289
+fate-h264-conformance-frext-frext4_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt4_Panasonic.avc
290 290
 fate-h264-conformance-frext-frext_mmco4_sony_b: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt_MMCO4_Sony_B.264
291
-fate-h264-conformance-frext-hcaff1_hhi_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HCAFF1_HHI.264
292
-fate-h264-conformance-frext-hcafr1_hhi_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HCAFR1_HHI.264
293
-fate-h264-conformance-frext-hcafr2_hhi_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HCAFR2_HHI.264
294
-fate-h264-conformance-frext-hcafr3_hhi_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HCAFR3_HHI.264
295
-fate-h264-conformance-frext-hcafr4_hhi_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HCAFR4_HHI.264
296
-fate-h264-conformance-frext-hcamff1_hhi_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HCAMFF1_HHI.264
297
-fate-h264-conformance-frext-hpca_brcm_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCA_BRCM_C.264
298
-fate-h264-conformance-frext-hpcadq_brcm_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCADQ_BRCM_B.264
299
-fate-h264-conformance-frext-hpcafl_bcrm_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCAFL_BRCM_C.264 -vsync 0
300
-fate-h264-conformance-frext-hpcaflnl_bcrm_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCAFLNL_BRCM_C.264 -vsync 0
301
-fate-h264-conformance-frext-hpcalq_brcm_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCALQ_BRCM_B.264
302
-fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync 0
303
-fate-h264-conformance-frext-hpcamolq_brcm_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCAMOLQ_BRCM_B.264
304
-fate-h264-conformance-frext-hpcanl_brcm_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCANL_BRCM_C.264
305
-fate-h264-conformance-frext-hpcaq2lq_brcm_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCAQ2LQ_BRCM_B.264
306
-fate-h264-conformance-frext-hpcv_brcm_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCV_BRCM_A.264
307
-fate-h264-conformance-frext-hpcvfl_bcrm_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCVFL_BRCM_A.264 -vsync 0
308
-fate-h264-conformance-frext-hpcvflnl_bcrm_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCVFLNL_BRCM_A.264 -vsync 0
309
-fate-h264-conformance-frext-hpcvmolq_brcm_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCVMOLQ_BRCM_B.264
310
-fate-h264-conformance-frext-hpcvnl_brcm_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/HPCVNL_BRCM_A.264
311
-fate-h264-conformance-frext-pph10i1_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I1_Panasonic_A.264 -pix_fmt yuv420p10le
312
-fate-h264-conformance-frext-pph10i2_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I2_Panasonic_A.264 -pix_fmt yuv420p10le
313
-fate-h264-conformance-frext-pph10i3_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I3_Panasonic_A.264 -pix_fmt yuv420p10le
314
-fate-h264-conformance-frext-pph10i4_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I4_Panasonic_A.264 -pix_fmt yuv420p10le
315
-fate-h264-conformance-frext-pph10i5_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I5_Panasonic_A.264 -pix_fmt yuv420p10le
316
-fate-h264-conformance-frext-pph10i6_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I6_Panasonic_A.264 -pix_fmt yuv420p10le
317
-fate-h264-conformance-frext-pph10i7_panasonic_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/FRext/PPH10I7_Panasonic_A.264 -pix_fmt yuv420p10le
291
+fate-h264-conformance-frext-hcaff1_hhi_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFF1_HHI.264
292
+fate-h264-conformance-frext-hcafr1_hhi_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR1_HHI.264
293
+fate-h264-conformance-frext-hcafr2_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR2_HHI.264
294
+fate-h264-conformance-frext-hcafr3_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR3_HHI.264
295
+fate-h264-conformance-frext-hcafr4_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR4_HHI.264
296
+fate-h264-conformance-frext-hcamff1_hhi_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAMFF1_HHI.264
297
+fate-h264-conformance-frext-hpca_brcm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCA_BRCM_C.264
298
+fate-h264-conformance-frext-hpcadq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCADQ_BRCM_B.264
299
+fate-h264-conformance-frext-hpcafl_bcrm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAFL_BRCM_C.264 -vsync 0
300
+fate-h264-conformance-frext-hpcaflnl_bcrm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAFLNL_BRCM_C.264 -vsync 0
301
+fate-h264-conformance-frext-hpcalq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCALQ_BRCM_B.264
302
+fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync 0
303
+fate-h264-conformance-frext-hpcamolq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAMOLQ_BRCM_B.264
304
+fate-h264-conformance-frext-hpcanl_brcm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCANL_BRCM_C.264
305
+fate-h264-conformance-frext-hpcaq2lq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAQ2LQ_BRCM_B.264
306
+fate-h264-conformance-frext-hpcv_brcm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCV_BRCM_A.264
307
+fate-h264-conformance-frext-hpcvfl_bcrm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVFL_BRCM_A.264 -vsync 0
308
+fate-h264-conformance-frext-hpcvflnl_bcrm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVFLNL_BRCM_A.264 -vsync 0
309
+fate-h264-conformance-frext-hpcvmolq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVMOLQ_BRCM_B.264
310
+fate-h264-conformance-frext-hpcvnl_brcm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVNL_BRCM_A.264
311
+fate-h264-conformance-frext-pph10i1_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I1_Panasonic_A.264 -pix_fmt yuv420p10le
312
+fate-h264-conformance-frext-pph10i2_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I2_Panasonic_A.264 -pix_fmt yuv420p10le
313
+fate-h264-conformance-frext-pph10i3_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I3_Panasonic_A.264 -pix_fmt yuv420p10le
314
+fate-h264-conformance-frext-pph10i4_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I4_Panasonic_A.264 -pix_fmt yuv420p10le
315
+fate-h264-conformance-frext-pph10i5_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I5_Panasonic_A.264 -pix_fmt yuv420p10le
316
+fate-h264-conformance-frext-pph10i6_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I6_Panasonic_A.264 -pix_fmt yuv420p10le
317
+fate-h264-conformance-frext-pph10i7_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I7_Panasonic_A.264 -pix_fmt yuv420p10le
318 318
 fate-h264-conformance-hcbp2_hhi_a: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/HCBP2_HHI_A.264
319 319
 fate-h264-conformance-hcmp1_hhi_a: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/HCMP1_HHI_A.264
320
-fate-h264-conformance-ls_sva_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/LS_SVA_D.264
321
-fate-h264-conformance-midr_mw_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/MIDR_MW_D.264
322
-fate-h264-conformance-mps_mw_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/MPS_MW_A.264
323
-fate-h264-conformance-mr1_bt_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/MR1_BT_A.h264
324
-fate-h264-conformance-mr1_mw_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/MR1_MW_A.264
325
-fate-h264-conformance-mr2_mw_a: CMD = framecrc  -i $(SAMPLES)/h264-conformance/MR2_MW_A.264
320
+fate-h264-conformance-ls_sva_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/LS_SVA_D.264
321
+fate-h264-conformance-midr_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MIDR_MW_D.264
322
+fate-h264-conformance-mps_mw_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MPS_MW_A.264
323
+fate-h264-conformance-mr1_bt_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR1_BT_A.h264
324
+fate-h264-conformance-mr1_mw_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR1_MW_A.264
325
+fate-h264-conformance-mr2_mw_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR2_MW_A.264
326 326
 fate-h264-conformance-mr2_tandberg_e: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR2_TANDBERG_E.264
327 327
 fate-h264-conformance-mr3_tandberg_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR3_TANDBERG_B.264
328 328
 fate-h264-conformance-mr4_tandberg_c: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR4_TANDBERG_C.264
... ...
@@ -332,26 +332,26 @@ fate-h264-conformance-mr7_bt_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)
332 332
 fate-h264-conformance-mr8_bt_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR8_BT_B.h264
333 333
 fate-h264-conformance-mr9_bt_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR9_BT_B.h264
334 334
 fate-h264-conformance-mv1_brcm_d: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/src19td.IBP.264
335
-fate-h264-conformance-nl1_sony_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/NL1_Sony_D.jsv
336
-fate-h264-conformance-nl2_sony_h: CMD = framecrc  -i $(SAMPLES)/h264-conformance/NL2_Sony_H.jsv
337
-fate-h264-conformance-nl3_sva_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/NL3_SVA_E.264
338
-fate-h264-conformance-nlmq1_jvc_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/NLMQ1_JVC_C.264
339
-fate-h264-conformance-nlmq2_jvc_c: CMD = framecrc  -i $(SAMPLES)/h264-conformance/NLMQ2_JVC_C.264
340
-fate-h264-conformance-nrf_mw_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/NRF_MW_E.264
335
+fate-h264-conformance-nl1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NL1_Sony_D.jsv
336
+fate-h264-conformance-nl2_sony_h: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NL2_Sony_H.jsv
337
+fate-h264-conformance-nl3_sva_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NL3_SVA_E.264
338
+fate-h264-conformance-nlmq1_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NLMQ1_JVC_C.264
339
+fate-h264-conformance-nlmq2_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NLMQ2_JVC_C.264
340
+fate-h264-conformance-nrf_mw_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NRF_MW_E.264
341 341
 fate-h264-conformance-sharp_mp_field_1_b: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_1_B.jvt
342 342
 fate-h264-conformance-sharp_mp_field_2_b: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_2_B.jvt
343 343
 fate-h264-conformance-sharp_mp_field_3_b: CMD = framecrc  -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_3_B.jvt
344 344
 fate-h264-conformance-sharp_mp_paff_1r2: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/Sharp_MP_PAFF_1r2.jvt
345 345
 fate-h264-conformance-sharp_mp_paff_2r: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/Sharp_MP_PAFF_2.jvt
346 346
 fate-h264-conformance-sl1_sva_b: CMD = framecrc  -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/SL1_SVA_B.264
347
-fate-h264-conformance-sva_ba1_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_BA1_B.264
348
-fate-h264-conformance-sva_ba2_d: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_BA2_D.264
349
-fate-h264-conformance-sva_base_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_Base_B.264
350
-fate-h264-conformance-sva_cl1_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_CL1_E.264
351
-fate-h264-conformance-sva_fm1_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_FM1_E.264
352
-fate-h264-conformance-sva_nl1_b: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_NL1_B.264
353
-fate-h264-conformance-sva_nl2_e: CMD = framecrc  -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264
347
+fate-h264-conformance-sva_ba1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_BA1_B.264
348
+fate-h264-conformance-sva_ba2_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_BA2_D.264
349
+fate-h264-conformance-sva_base_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_Base_B.264
350
+fate-h264-conformance-sva_cl1_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_CL1_E.264
351
+fate-h264-conformance-sva_fm1_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_FM1_E.264
352
+fate-h264-conformance-sva_nl1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_NL1_B.264
353
+fate-h264-conformance-sva_nl2_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264
354 354
 
355
-fate-h264-interlace-crop: CMD = framecrc  -vframes 3 -i $(SAMPLES)/h264/interlaced_crop.mp4
356
-fate-h264-lossless: CMD = framecrc -i $(SAMPLES)/h264/lossless.h264
355
+fate-h264-interlace-crop: CMD = framecrc -vsync 0 -vframes 3 -i $(SAMPLES)/h264/interlaced_crop.mp4
356
+fate-h264-lossless: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264/lossless.h264
357 357
 fate-h264-extreme-plane-pred: CMD = framemd5 -strict 1 -vsync 0 -i $(SAMPLES)/h264/extreme-plane-pred.h264
... ...
@@ -102,7 +102,7 @@ do_ffmpeg_crc()
102 102
 
103 103
 do_video_decoding()
104 104
 {
105
-    do_ffmpeg $raw_dst $DEC_OPTS $1 -i $target_path/$file -f rawvideo $ENC_OPTS $2
105
+    do_ffmpeg $raw_dst $DEC_OPTS $1 -i $target_path/$file -f rawvideo $ENC_OPTS -vsync 0 $2
106 106
 }
107 107
 
108 108
 do_video_encoding()