Skip to content

Commit

Permalink
Merge remote-tracking branch 'qatar/master'
Browse files Browse the repository at this point in the history
* qatar/master:
  bitstream: Properly promote av_reverse values before shifting.
  libavutil/swscale: YUV444P10/YUV444P9 support.
  H.264: Fix high bit depth explicit biweight
  h264: Fix 10-bit H.264 x86 chroma v loopfilter asm.
  Replace DEBUG_SEEK/DEBUG_SI + av_log combinations by av_dlog.
  Update copyright year for ac3enc_opts_template.c.
  adts: Adjust frame size mask to follow the specification.
  movenc: Add RTP muxer/hinter options
  movenc: Pass the RTP AVFormatContext to the SDP generation
  rtspenc: Add RTP muxer options
  rtspenc: Add an AVClass for setting muxer specific options
  rtpenc_chain: Pass the rtpflags options through to the chained muxer
  rtpenc: Declare the rtp flags private AVOptions in rtpenc.h
  sdp: Reindent after the previous commit
  rtpenc: MP4A-LATM payload support
  avoptions: Add an av_opt_flag_is_set function for inspecting flag fields
  sdp: Allow passing an AVFormatContext to the SDP generation
  mov: Fix wrong timestamp generation for fragmented movies that have time offset caused by the first edit list entry.
  mpeg12: more advanced ffmpeg mpeg2 aspect guessing code.
  swscale: split YUYV output out of yuv2packed[12X]_c().

Conflicts:
	doc/APIchanges
	libavcodec/Makefile
	libavcodec/h264dsp_template.c
	libavcodec/mpeg12.c
	libavformat/aacdec.c
	libavformat/avidec.c
	libavformat/internal.h
	libavformat/movenc.c
	libavformat/rtpenc.c
	libavformat/rtpenc_latm.c
	libavformat/sdp.c
	libavformat/version.h
	libavutil/avutil.h
	libavutil/pixfmt.h
	libswscale/swscale.c

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Jun 11, 2011
2 parents 39dbe9b + 19d824e commit 45fb647
Show file tree
Hide file tree
Showing 34 changed files with 375 additions and 165 deletions.
3 changes: 3 additions & 0 deletions doc/APIchanges
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ libavutil: 2011-04-18

API changes, most recent first:

2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
Add av_opt_flag_is_set().

2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.

Expand Down
2 changes: 1 addition & 1 deletion libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
dirac.o mpeg12data.o vorbis_data.o
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \
vorbis_data.o
OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o
OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o
OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
flacdec.o flacdata.o flac.o \
Expand Down
2 changes: 1 addition & 1 deletion libavcodec/ac3enc_opts_template.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* AC-3 encoder options
* Copyright (c) 2010 Justin Ruggles <[email protected]>
* Copyright (c) 2011 Justin Ruggles <[email protected]>
*
* This file is part of FFmpeg.
*
Expand Down
8 changes: 4 additions & 4 deletions libavcodec/bitstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static)
}

static av_always_inline uint32_t bitswap_32(uint32_t x) {
return av_reverse[x&0xFF]<<24
| av_reverse[(x>>8)&0xFF]<<16
| av_reverse[(x>>16)&0xFF]<<8
| av_reverse[x>>24];
return (uint32_t)av_reverse[x&0xFF]<<24
| (uint32_t)av_reverse[(x>>8)&0xFF]<<16
| (uint32_t)av_reverse[(x>>16)&0xFF]<<8
| (uint32_t)av_reverse[x>>24];
}

typedef struct {
Expand Down
7 changes: 4 additions & 3 deletions libavcodec/h264dsp_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ static void FUNCC(weight_h264_pixels ## W ## x ## H)(uint8_t *p_block, int strid
op_scale1(15); \
} \
} \
static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *p_dst, uint8_t *p_src, int stride, int log2_denom, int weightd, int weights, int offset){ \
static void FUNCC(biweight_h264_pixels ## W ## x ## H)(uint8_t *_dst, uint8_t *_src, int stride, int log2_denom, int weightd, int weights, int offset){ \
int y; \
pixel *dst = (pixel*)p_dst; \
pixel *src = (pixel*)p_src; \
pixel *dst = (pixel*)_dst; \
pixel *src = (pixel*)_src; \
stride >>= sizeof(pixel)-1; \
offset <<= (BIT_DEPTH-8); \
offset = ((offset + 1) | 1) << log2_denom; \
for(y=0; y<H; y++, dst += stride, src += stride){ \
op_scale2(0); \
Expand Down
16 changes: 7 additions & 9 deletions libavcodec/mpeg12.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,19 +1331,17 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
avctx->ticks_per_frame=2;
//MPEG-2 aspect
if(s->aspect_ratio_info > 1){
AVRational dar=
AVRational dar =
av_mul_q(
av_div_q(
ff_mpeg2_aspect[s->aspect_ratio_info],
(AVRational){s1->pan_scan.width, s1->pan_scan.height}
),
av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
(AVRational){s1->pan_scan.width, s1->pan_scan.height}),
(AVRational){s->width, s->height});

//we ignore the spec here and guess a bit as reality does not match the spec, see for example
// we ignore the spec here and guess a bit as reality does not match the spec, see for example
// res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg
//issue1613, 621, 562
if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0)
|| (av_cmp_q(dar,(AVRational){4,3})&&av_cmp_q(dar,(AVRational){16,9}))){
// issue1613, 621, 562
if((s1->pan_scan.width == 0 ) || (s1->pan_scan.height == 0) ||
(av_cmp_q(dar,(AVRational){4,3}) && av_cmp_q(dar,(AVRational){16,9}))) {
s->avctx->sample_aspect_ratio=
av_div_q(
ff_mpeg2_aspect[s->aspect_ratio_info],
Expand Down
9 changes: 8 additions & 1 deletion libavcodec/x86/h264_deblock_10bit.asm
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,13 @@ DEBLOCK_LUMA_INTRA avx
mova [r0+2*r1], m2
%endmacro

%macro CHROMA_V_LOAD_TC 2
movd %1, [%2]
punpcklbw %1, %1
punpcklwd %1, %1
psraw %1, 6
%endmacro

%macro DEBLOCK_CHROMA 1
;-----------------------------------------------------------------------------
; void deblock_v_chroma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
Expand All @@ -854,7 +861,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16)
LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
pxor m4, m4
LOAD_TC m6, r4
CHROMA_V_LOAD_TC m6, r4
psubw m6, [pw_3]
pmaxsw m6, m4
pand m7, m6
Expand Down
2 changes: 1 addition & 1 deletion libavformat/aacdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static int adts_aac_probe(AVProbeData *p)
uint32_t header = AV_RB16(buf2);
if((header&0xFFF6) != 0xFFF0)
break;
fsize = (AV_RB32(buf2+3)>>13) & 0x1FFF;
fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF;
if(fsize < 7)
break;
buf2 += fsize;
Expand Down
33 changes: 11 additions & 22 deletions libavformat/avidec.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

//#define DEBUG
//#define DEBUG_SEEK

#include <strings.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/bswap.h"
Expand Down Expand Up @@ -160,10 +157,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
int64_t last_pos= -1;
int64_t filesize= avio_size(s->pb);

#ifdef DEBUG_SEEK
av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
longs_pre_entry,index_type, entries_in_use, chunk_id, base);
#endif
av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
longs_pre_entry,index_type, entries_in_use, chunk_id, base);

if(stream_id >= s->nb_streams || stream_id < 0)
return -1;
Expand Down Expand Up @@ -1182,10 +1177,8 @@ static int avi_read_idx1(AVFormatContext *s, int size)
flags = avio_rl32(pb);
pos = avio_rl32(pb);
len = avio_rl32(pb);
#if defined(DEBUG_SEEK)
av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
i, tag, flags, pos, len);
#endif
av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
i, tag, flags, pos, len);
if(i==0 && pos > avi->movi_list)
avi->movi_list= 0; //FIXME better check
pos += avi->movi_list;
Expand Down Expand Up @@ -1254,22 +1247,18 @@ static int avi_load_index(AVFormatContext *s)

if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
goto the_end; // maybe truncated file
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "movi_end=0x%"PRIx64"\n", avi->movi_end);
#endif
av_dlog(s, "movi_end=0x%"PRIx64"\n", avi->movi_end);
for(;;) {
if (url_feof(pb))
break;
tag = avio_rl32(pb);
size = avio_rl32(pb);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "tag=%c%c%c%c size=0x%x\n",
tag & 0xff,
(tag >> 8) & 0xff,
(tag >> 16) & 0xff,
(tag >> 24) & 0xff,
size);
#endif
av_dlog(s, "tag=%c%c%c%c size=0x%x\n",
tag & 0xff,
(tag >> 8) & 0xff,
(tag >> 16) & 0xff,
(tag >> 24) & 0xff,
size);
switch(tag) {
case MKTAG('i', 'd', 'x', '1'):
if (avi_read_idx1(s, size) < 0)
Expand Down
14 changes: 3 additions & 11 deletions libavformat/ffmdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ static int ffm_read_data(AVFormatContext *s,
return size1 - size;
}

//#define DEBUG_SEEK

/* ensure that acutal seeking happens between FFM_PACKET_SIZE
and file_size - FFM_PACKET_SIZE */
static void ffm_seek1(AVFormatContext *s, int64_t pos1)
Expand All @@ -175,9 +173,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)

pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
pos = FFMAX(pos, FFM_PACKET_SIZE);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
#endif
av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
avio_seek(pb, pos, SEEK_SET);
}

Expand All @@ -189,9 +185,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
ffm_seek1(s, pos);
avio_skip(pb, 4);
dts = avio_rb64(pb);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
#endif
av_dlog(s, "dts=%0.6f\n", dts / 1000000.0);
return dts;
}

Expand Down Expand Up @@ -464,9 +458,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
int64_t pts_min, pts_max, pts;
double pos1;

#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
#endif
av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
/* find the position using linear interpolation (better than
dichotomy in typical cases) */
pos_min = FFM_PACKET_SIZE;
Expand Down
5 changes: 3 additions & 2 deletions libavformat/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ int ff_url_join(char *str, int size, const char *proto,
* @param dest_type the destination address type, may be NULL
* @param port the destination port of the media stream, 0 if unknown
* @param ttl the time to live of the stream, 0 if not multicast
* @param flags the AVFormatContext->flags, modifying the generated SDP
* @param fmt the AVFormatContext, which might contain options modifying
* the generated SDP
*/
void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
const char *dest_addr, const char *dest_type,
int port, int ttl, int flags);
int port, int ttl, AVFormatContext *fmt);

/**
* Write a packet to another muxer than the one the user originally
Expand Down
9 changes: 5 additions & 4 deletions libavformat/mov.c
Original file line number Diff line number Diff line change
Expand Up @@ -1537,8 +1537,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)

/* adjust first dts according to edit list */
if (sc->time_offset && mov->time_scale > 0) {
int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset;
current_dts = -rescaled;
if (sc->time_offset < 0)
sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale);
current_dts = -sc->time_offset;
if (sc->ctts_data && sc->stts_data &&
sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {
/* more than 16 frames delay, dts are likely wrong
Expand Down Expand Up @@ -2072,7 +2073,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)

if (flags & 0x001) data_offset = avio_rb32(pb);
if (flags & 0x004) first_sample_flags = avio_rb32(pb);
dts = st->duration;
dts = st->duration - sc->time_offset;
offset = frag->base_data_offset + data_offset;
distance = 0;
av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
Expand Down Expand Up @@ -2101,7 +2102,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
offset += sample_size;
}
frag->moof_offset = offset;
st->duration = dts;
st->duration = dts + sc->time_offset;
return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion libavformat/movenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "rtpenc.h"

#undef NDEBUG
#include <assert.h>

static const AVOption options[] = {
{ "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
{ NULL },
};

Expand Down Expand Up @@ -1368,7 +1370,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index)
char buf[1000] = "";
int len;

ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx->flags);
ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx);
av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
len = strlen(buf);

Expand Down
1 change: 1 addition & 0 deletions libavformat/movenc.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ typedef struct MOVMuxContext {
MOVTrack *tracks;

int flags;
int rtp_flags;
} MOVMuxContext;

#define FF_MOV_FLAG_RTP_HINT 1
Expand Down
12 changes: 3 additions & 9 deletions libavformat/mpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "internal.h"
#include "mpeg.h"

//#define DEBUG_SEEK

#undef NDEBUG
#include <assert.h>

Expand Down Expand Up @@ -592,9 +590,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
for(;;) {
len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
if (len < 0) {
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "none (ret=%d)\n", len);
#endif
av_dlog(s, "none (ret=%d)\n", len);
return AV_NOPTS_VALUE;
}
if (startcode == s->streams[stream_index]->id &&
Expand All @@ -603,10 +599,8 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
}
avio_skip(s->pb, len);
}
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
pos, dts, dts / 90000.0);
#endif
av_dlog(s, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
pos, dts, dts / 90000.0);
*ppos = pos;
return dts;
}
Expand Down
1 change: 0 additions & 1 deletion libavformat/mpegenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "mpeg.h"

#define MAX_PAYLOAD_SIZE 4096
//#define DEBUG_SEEK

#undef NDEBUG
#include <assert.h>
Expand Down
2 changes: 0 additions & 2 deletions libavformat/mpegts.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

//#define DEBUG
//#define DEBUG_SEEK
//#define USE_SYNCPOINT_SEARCH

#include "libavutil/crc.h"
Expand Down
2 changes: 0 additions & 2 deletions libavformat/nsvdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include "riff.h"
#include "libavutil/dict.h"

//#define DEBUG
//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!
//#define DEBUG_SEEK
#define CHECK_SUBSEQUENT_NSVS
//#define DISABLE_AUDIO

Expand Down
Loading

0 comments on commit 45fb647

Please sign in to comment.