Merge commit 'e9e5a1bdc769a7225ab0d4f8b33bcacc6496bd68'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 24 May 2013 10:04:18 +0000 (12:04 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 24 May 2013 10:15:56 +0000 (12:15 +0200)
* commit 'e9e5a1bdc769a7225ab0d4f8b33bcacc6496bd68':
  Monkey's Audio old versions FATE tests
  h264_parser: Set field_order and picture_structure.

Conflicts:
libavcodec/h264_parser.c
tests/fate/lossless-audio.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_parser.c
tests/Makefile
tests/fate/lossless-audio.mak

Simple merge
Simple merge
@@@ -149,7 -116,7 +149,8 @@@ static inline int parse_nal_units(AVCod
      unsigned int slice_type;
      int state = -1;
      const uint8_t *ptr;
 +    int q264 = buf_size >=4 && !memcmp("Q264", buf, 4);
+     int field_poc[2];
  
      /* set some sane default values */
      s->pict_type = AV_PICTURE_TYPE_I;
              break;
          case NAL_IDR_SLICE:
              s->key_frame = 1;
+             h->prev_frame_num        = 0;
+             h->prev_frame_num_offset = 0;
+             h->prev_poc_msb          =
+             h->prev_poc_lsb          = 0;
              /* fall through */
          case NAL_SLICE:
 -            get_ue_golomb(&h->gb);  // skip first_mb_in_slice
 +            get_ue_golomb_long(&h->gb);  // skip first_mb_in_slice
              slice_type = get_ue_golomb_31(&h->gb);
              s->pict_type = golomb_to_pict_type[slice_type % 5];
              if (h->sei_recovery_frame_cnt >= 0) {
                  s->repeat_pict = h->picture_structure == PICT_FRAME ? 1 : 0;
              }
  
+             if (h->picture_structure == PICT_FRAME) {
+                 s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
+                 if (h->sps.pic_struct_present_flag) {
+                     switch (h->sei_pic_struct) {
+                         case SEI_PIC_STRUCT_TOP_BOTTOM:
+                         case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
+                             s->field_order = AV_FIELD_TT;
+                             break;
+                         case SEI_PIC_STRUCT_BOTTOM_TOP:
+                         case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
+                             s->field_order = AV_FIELD_BB;
+                             break;
+                         default:
+                             s->field_order = AV_FIELD_PROGRESSIVE;
+                             break;
+                     }
+                 } else {
+                     if (field_poc[0] < field_poc[1])
+                         s->field_order = AV_FIELD_TT;
+                     else if (field_poc[0] > field_poc[1])
+                         s->field_order = AV_FIELD_BB;
+                     else
+                         s->field_order = AV_FIELD_PROGRESSIVE;
+                 }
+             } else {
+                 if (h->picture_structure == PICT_TOP_FIELD)
+                     s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD;
+                 else
+                     s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
+                 s->field_order = AV_FIELD_UNKNOWN;
+             }
              return 0; /* no need to evaluate the rest */
          }
 -        buf += consumed;
 +        buf += h->is_avc ? nalsize : consumed;
      }
 +    if (q264)
 +        return 0;
      /* didn't find a picture! */
 -    av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n");
 +    av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit with size %d\n", buf_size);
      return -1;
  }
  
diff --cc tests/Makefile
Simple merge
@@@ -1,32 -1,17 +1,29 @@@
 -FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ALAC) += fate-lossless-alac
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, MOV, ALAC) += fate-lossless-alac
  fate-lossless-alac: CMD = md5 -i $(SAMPLES)/lossless-audio/inside.m4a -f s16le
  
 -FATE_SAMPLES_AVCONV-$(call DEMDEC, MLP, MLP) += fate-lossless-meridianaudio
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, MLP, MLP) += fate-lossless-meridianaudio
  fate-lossless-meridianaudio: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.mlp -f s16le
  
- FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, APE, APE) += fate-lossless-monkeysaudio
- fate-lossless-monkeysaudio: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.ape -f s16le
 -FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, RALF) += fate-ralf
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, RM, RALF) += fate-ralf
  fate-ralf: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.rmvb -vn -f s16le
  
 -FATE_SAMPLES_AVCONV-$(call DEMDEC, SHORTEN, SHORTEN) += fate-lossless-shorten
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, SHORTEN, SHORTEN) += fate-lossless-shorten
  fate-lossless-shorten: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.shn -f s16le
  
 -FATE_SAMPLES_AVCONV-$(call DEMDEC, TTA, TTA) += fate-lossless-tta
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TAK, TAK) += fate-lossless-tak
 +fate-lossless-tak: CMD = crc -i $(SAMPLES)/lossless-audio/luckynight-partial.tak
 +
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TTA, TTA) += fate-lossless-tta
  fate-lossless-tta: CMD = crc -i $(SAMPLES)/lossless-audio/inside.tta
  
 -FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMALOSSLESS) += fate-lossless-wma
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, TTA, TTA) += fate-lossless-tta-encrypted
 +fate-lossless-tta-encrypted: CMD = crc -password ffmpeg -i $(SAMPLES)/lossless-audio/encrypted.tta
 +
 +FATE_SAMPLES_LOSSLESS_AUDIO-$(call DEMDEC, ASF, WMALOSSLESS) += fate-lossless-wma
  fate-lossless-wma: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.wma -f s16le
 +
 +FATE_SAMPLES_LOSSLESS_AUDIO += $(FATE_SAMPLES_LOSSLESS_AUDIO-yes)
 +
 +FATE_SAMPLES_FFMPEG += $(FATE_SAMPLES_LOSSLESS_AUDIO)
 +fate-lossless-audio: $(FATE_SAMPLES_LOSSLESS_AUDIO)
 +