Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 19 Apr 2012 18:46:37 +0000 (20:46 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 19 Apr 2012 19:23:52 +0000 (21:23 +0200)
* qatar/master:
  dv: Initialize encoder tables during encoder init.
  dv: Replace some magic numbers by the appropriate #define.
  FATE: pass the decoded output format and audio source file to enc_dec_pcm
  FATE: specify the input format when decoding in enc_dec_pcm()
  x86inc: support AVX abstraction for 2-operand instructions
  configure: detect PGI compiler and set suitable flags
  avconv: check for an incompatible changing channel layout
  avio: make AVIOContext.av_class pointer to const
  nutdec: add malloc check and fix const to non-const conversion warnings

Conflicts:
ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
configure
ffmpeg.c
libavcodec/dv.c
libavcodec/dv_vlc_data.h
libavformat/avio.h
libavformat/nutdec.c
libavutil/x86/x86inc.asm
tests/fate-run.sh
tests/fate/aac.mak
tests/fate/audio.mak

diff --cc configure
Simple merge
diff --cc ffmpeg.c
+++ b/ffmpeg.c
@@@ -1381,6 -1178,71 +1381,58 @@@ static void write_frame(AVFormatContex
      }
  }
  
 -static int check_recording_time(OutputStream *ost)
 -{
 -    OutputFile *of = output_files[ost->file_index];
 -
 -    if (of->recording_time != INT64_MAX &&
 -        av_compare_ts(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, of->recording_time,
 -                      AV_TIME_BASE_Q) >= 0) {
 -        ost->is_past_recording_time = 1;
 -        return 0;
 -    }
 -    return 1;
 -}
 -
+ static void get_default_channel_layouts(OutputStream *ost, InputStream *ist)
+ {
+     char layout_name[256];
+     AVCodecContext *enc = ost->st->codec;
+     AVCodecContext *dec = ist->st->codec;
+     if (dec->channel_layout &&
+         av_get_channel_layout_nb_channels(dec->channel_layout) != dec->channels) {
+         av_get_channel_layout_string(layout_name, sizeof(layout_name),
+                                      dec->channels, dec->channel_layout);
+         av_log(NULL, AV_LOG_ERROR, "New channel layout (%s) is invalid\n",
+                layout_name);
+         dec->channel_layout = 0;
+     }
+     if (!dec->channel_layout) {
+         if (enc->channel_layout && dec->channels == enc->channels) {
+             dec->channel_layout = enc->channel_layout;
+         } else {
+             dec->channel_layout = av_get_default_channel_layout(dec->channels);
+             if (!dec->channel_layout) {
+                 av_log(NULL, AV_LOG_FATAL, "Unable to find default channel "
+                        "layout for Input Stream #%d.%d\n", ist->file_index,
+                        ist->st->index);
+                 exit_program(1);
+             }
+         }
+         av_get_channel_layout_string(layout_name, sizeof(layout_name),
+                                      dec->channels, dec->channel_layout);
+         av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for  Input Stream "
+                "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name);
+     }
+     if (!enc->channel_layout) {
+         if (dec->channels == enc->channels) {
+             enc->channel_layout = dec->channel_layout;
+             return;
+         } else {
+             enc->channel_layout = av_get_default_channel_layout(enc->channels);
+         }
+         if (!enc->channel_layout) {
+             av_log(NULL, AV_LOG_FATAL, "Unable to find default channel layout "
+                    "for Output Stream #%d.%d\n", ost->file_index,
+                    ost->st->index);
+             exit_program(1);
+         }
+         av_get_channel_layout_string(layout_name, sizeof(layout_name),
+                                      enc->channels, enc->channel_layout);
+         av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Output Stream "
+                "#%d.%d : %s\n", ost->file_index, ost->st->index, layout_name);
+     }
+ }
  static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
  {
      int fill_char = 0x00;
@@@ -1505,16 -1350,11 +1557,18 @@@ static void do_audio_out(AVFormatContex
      AVCodecContext *dec = ist->st->codec;
      int osize = av_get_bytes_per_sample(enc->sample_fmt);
      int isize = av_get_bytes_per_sample(dec->sample_fmt);
 -    uint8_t *buf = decoded_frame->data[0];
 +    uint8_t *buf[AV_NUM_DATA_POINTERS];
      int size     = decoded_frame->nb_samples * dec->channels * isize;
 +    int planes   = av_sample_fmt_is_planar(dec->sample_fmt) ? dec->channels : 1;
 +    int i;
 +
 +    av_assert0(planes <= AV_NUM_DATA_POINTERS);
 +
 +    for(i=0; i<planes; i++)
 +        buf[i]= decoded_frame->data[i];
  
+     get_default_channel_layouts(ost, ist);
      if (alloc_audio_output_buf(dec, enc, decoded_frame->nb_samples) < 0) {
          av_log(NULL, AV_LOG_FATAL, "Error allocating audio buffer\n");
          exit_program(1);
diff --cc libavcodec/dv.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -86,12 -91,15 +91,15 @@@ pcm()
  
  enc_dec_pcm(){
      out_fmt=$1
-     pcm_fmt=$2
-     shift 2
+     dec_fmt=$2
+     pcm_fmt=$3
+     src_file=$(target_path $4)
+     shift 4
      encfile="${outdir}/${test}.${out_fmt}"
      cleanfiles=$encfile
-     avconv -i $ref "$@" -f $out_fmt -y ${target_path}/${encfile} || return
-     avconv -i ${target_path}/${encfile} -c:a pcm_${pcm_fmt} -f wav -
+     encfile=$(target_path ${encfile})
+     avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
 -    avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
++    avconv -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
  }
  
  regtest(){
@@@ -71,24 -71,7 +71,24 @@@ FATE_AAC_CT = sbr_bc-ps_i.3gp  
  
  FATE_AAC += $(FATE_AAC_CT:%=fate-aac-ct-%)
  
 -FATE_TESTS += $(FATE_AAC)
 -fate-aac: $(FATE_AAC)
 +FATE_AAC_ENCODE += fate-aac-aref-encode
 +fate-aac-aref-encode: $(AREF)
- fate-aac-aref-encode: CMD = enc_dec_pcm adts s16le -strict -2 -c:a aac -b:a 512k
++fate-aac-aref-encode: CMD = enc_dec_pcm adts wav s16le $(REF) -strict -2 -c:a aac -b:a 512k
 +fate-aac-aref-encode: CMP = stddev
 +fate-aac-aref-encode: REF = ./tests/data/acodec.ref.wav
 +fate-aac-aref-encode: CMP_SHIFT = -4096
 +fate-aac-aref-encode: CMP_TARGET = 1862
 +fate-aac-aref-encode: SIZE_TOLERANCE = 2464
 +
 +FATE_AAC_ENCODE += fate-aac-ln-encode
- fate-aac-ln-encode: CMD = enc_dec_pcm adts s16le -strict -2 -c:a aac -b:a 512k
++fate-aac-ln-encode: CMD = enc_dec_pcm adts wav s16le $(REF) -strict -2 -c:a aac -b:a 512k
 +fate-aac-ln-encode: CMP = stddev
 +fate-aac-ln-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 +fate-aac-ln-encode: CMP_SHIFT = -4096
 +fate-aac-ln-encode: CMP_TARGET = 65
 +fate-aac-ln-encode: SIZE_TOLERANCE = 3560
 +
 +FATE_TESTS += $(FATE_AAC) $(FATE_AAC_ENCODE)
 +fate-aac: $(FATE_AAC) $(FATE_AAC_ENCODE)
  $(FATE_AAC): CMP = oneoff
  $(FATE_AAC): FUZZ = 2
@@@ -28,17 -28,5 +28,17 @@@ fate-nellymoser: CMD = pcm -i $(SAMPLES
  fate-nellymoser: CMP = oneoff
  fate-nellymoser: REF = $(SAMPLES)/nellymoser/nellymoser.pcm
  
 -FATE_TESTS += fate-ws_snd
 +FATE_AUDIO += fate-nellymoser-aref-encode
 +fate-nellymoser-aref-encode: $(AREF)
- fate-nellymoser-aref-encode: CMD = enc_dec_pcm flv s16le -c:a nellymoser
++fate-nellymoser-aref-encode: CMD = enc_dec_pcm flv wav s16le $(REF) -c:a nellymoser
 +fate-nellymoser-aref-encode: CMP = stddev
 +fate-nellymoser-aref-encode: REF = ./tests/data/acodec-16000-1.ref.wav
 +fate-nellymoser-aref-encode: CMP_SHIFT = -1172
 +fate-nellymoser-aref-encode: CMP_TARGET = 9617
 +fate-nellymoser-aref-encode: SIZE_TOLERANCE = 268
 +
 +FATE_AUDIO += fate-ws_snd
  fate-ws_snd: CMD = md5 -i $(SAMPLES)/vqa/ws_snd.vqa -f s16le
 +
 +FATE_TESTS += $(FATE_AUDIO)
 +fate-audio: $(FATE_AUDIO)