Skip to content

Commit

Permalink
Merge commit 'ef1b23ad21e3f12fc4ff2a73a6d4d4cd9d630c4b'
Browse files Browse the repository at this point in the history
* commit 'ef1b23ad21e3f12fc4ff2a73a6d4d4cd9d630c4b': (21 commits)
  jvdec: set channel layout
  iss: set channel layout
  ipmovie: set channel layout
  iff: set channel layout
  idroqdec: set channel layout
  gxfdec: set channel layout when applicable
  gsmdec: set channel layout
  flvdec: set channel layout
  dv: set channel layout
  dsicin: set channel layout
  daud: set channel layout
  cdxl: set channel layout
  bmv: set channel layout
  bink: set channel layout
  bfi: set channel layout
  bethsoftvid: set channel layout
  apc: set channel layout
  amr: set channel_layout
  ppc: replace pointer casting with AV_COPY32
  ppc: fix some unused variable warnings
  ...

Conflicts:
	libavformat/amr.c
	libavformat/iff.c

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Nov 13, 2012
2 parents a8f2420 + ef1b23a commit 7eb40d8
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 21 deletions.
3 changes: 1 addition & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,10 @@ print_config(){
}

print_enabled(){
test x"$1" = x-n && end=" " && shift || end="\n"
suf=$1
shift
for v; do
enabled $v && printf "%s$end" ${v%$suf};
enabled $v && printf "%s\n" ${v%$suf};
done
}

Expand Down
3 changes: 2 additions & 1 deletion libavcodec/ppc/h264_altivec.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/ppc/types_altivec.h"
#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
Expand Down Expand Up @@ -788,7 +789,7 @@ static inline vec_u8 h264_deblock_q1(register vec_u8 p0,
alphavec = vec_splat(alphavec, 0x0); \
mask = h264_deblock_mask(p0, p1, q0, q1, alphavec, betavec); /*if in block */ \
\
*((int *)temp) = *((int *)tc0); \
AV_COPY32(temp, tc0); \
tc0vec = vec_ld(0, (signed char*)temp); \
tc0vec = vec_mergeh(tc0vec, tc0vec); \
tc0vec = vec_mergeh(tc0vec, tc0vec); \
Expand Down
15 changes: 6 additions & 9 deletions libavcodec/ppc/h264_altivec_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i
pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
psumA, psumB, sumA, sumB;

vec_u8 sum, vdst, fsum;
vec_u8 sum, fsum;

for (i = 0 ; i < 16 ; i ++) {
vec_u8 srcR1 = vec_ld(-2, src);
Expand Down Expand Up @@ -423,9 +423,8 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i
sum = vec_packsu(sumA, sumB);

ASSERT_ALIGNED(dst);
vdst = vec_ld(0, dst);

OP_U8_ALTIVEC(fsum, sum, vdst);
OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));

vec_st(fsum, 0, dst);

Expand Down Expand Up @@ -486,7 +485,7 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i
srcP3ssA, srcP3ssB,
sum1A, sum1B, sum2A, sum2B, sum3A, sum3B;

vec_u8 sum, vdst, fsum, srcP3a, srcP3b, srcP3;
vec_u8 sum, fsum, srcP3a, srcP3b, srcP3;

for (i = 0 ; i < 16 ; i++) {
srcP3a = vec_ld(0, srcbis += srcStride);
Expand Down Expand Up @@ -532,9 +531,8 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i
sum = vec_packsu(sumA, sumB);

ASSERT_ALIGNED(dst);
vdst = vec_ld(0, dst);

OP_U8_ALTIVEC(fsum, sum, vdst);
OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));

vec_st(fsum, 0, dst);

Expand Down Expand Up @@ -582,7 +580,7 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp,
pp3Ae, pp3Ao, pp3Be, pp3Bo, pp1cAe, pp1cAo, pp1cBe, pp1cBo,
pp32Ae, pp32Ao, pp32Be, pp32Bo, sumAe, sumAo, sumBe, sumBo,
ssumAe, ssumAo, ssumBe, ssumBo;
vec_u8 fsum, sumv, sum, vdst;
vec_u8 fsum, sumv, sum;
vec_s16 ssume, ssumo;

src -= (2 * srcStride);
Expand Down Expand Up @@ -766,9 +764,8 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp,
sum = vec_perm(sumv, sumv, mperm);

ASSERT_ALIGNED(dst);
vdst = vec_ld(0, dst);

OP_U8_ALTIVEC(fsum, sum, vdst);
OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));

vec_st(fsum, 0, dst);

Expand Down
3 changes: 3 additions & 0 deletions libavformat/amr.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ Write and read amr data according to RFC3267, http://www.ietf.org/rfc/rfc3267.tx
Only mono files are supported.
*/

#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"

Expand Down Expand Up @@ -98,6 +100,7 @@ static int amr_read_header(AVFormatContext *s)
st->codec->sample_rate = 8000;
}
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);

Expand Down
12 changes: 9 additions & 3 deletions libavformat/apc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/

#include <string.h>

#include "libavutil/channel_layout.h"
#include "avformat.h"

static int apc_probe(AVProbeData *p)
Expand Down Expand Up @@ -58,9 +60,13 @@ static int apc_read_header(AVFormatContext *s)
/* initial predictor values for adpcm decoder */
avio_read(pb, st->codec->extradata, 2 * 4);

st->codec->channels = 1;
if (avio_rl32(pb))
st->codec->channels = 2;
if (avio_rl32(pb)) {
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
}

st->codec->bits_per_coded_sample = 4;
st->codec->bit_rate = st->codec->bits_per_coded_sample * st->codec->channels
Expand Down
2 changes: 2 additions & 0 deletions libavformat/bethsoftvid.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @see http://www.svatopluk.com/andux/docs/dfvid.html
*/

#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
Expand Down Expand Up @@ -240,6 +241,7 @@ static int vid_read_packet(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_PCM_U8;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->bits_per_coded_sample = 8;
st->codec->sample_rate = vid->sample_rate;
st->codec->bit_rate = 8 * st->codec->sample_rate;
Expand Down
2 changes: 2 additions & 0 deletions libavformat/bfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @see http://wiki.multimedia.cx/index.php?title=BFI
*/

#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
Expand Down Expand Up @@ -96,6 +97,7 @@ static int bfi_read_header(AVFormatContext * s)
astream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
astream->codec->codec_id = AV_CODEC_ID_PCM_U8;
astream->codec->channels = 1;
astream->codec->channel_layout = AV_CH_LAYOUT_MONO;
astream->codec->bits_per_coded_sample = 8;
astream->codec->bit_rate =
astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
Expand Down
9 changes: 8 additions & 1 deletion libavformat/bink.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* http://wiki.multimedia.cx/index.php?title=Bink_Container
*/

#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
Expand Down Expand Up @@ -143,7 +144,13 @@ static int read_header(AVFormatContext *s)
flags = avio_rl16(pb);
ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
AV_CODEC_ID_BINKAUDIO_DCT : AV_CODEC_ID_BINKAUDIO_RDFT;
ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
if (flags & BINK_AUD_STEREO) {
ast->codec->channels = 2;
ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
ast->codec->channels = 1;
ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
ast->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
if (!ast->codec->extradata)
return AVERROR(ENOMEM);
Expand Down
2 changes: 2 additions & 0 deletions libavformat/bmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"

Expand Down Expand Up @@ -58,6 +59,7 @@ static int bmv_read_header(AVFormatContext *s)
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_BMV_AUDIO;
ast->codec->channels = 2;
ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
ast->codec->sample_rate = 22050;
avpriv_set_pts_info(ast, 16, 1, 22050);

Expand Down
9 changes: 8 additions & 1 deletion libavformat/cdxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/parseutils.h"
#include "libavutil/opt.h"
Expand Down Expand Up @@ -143,7 +144,13 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_tag = 0;
st->codec->codec_id = AV_CODEC_ID_PCM_S8;
st->codec->channels = cdxl->header[1] & 0x10 ? 2 : 1;
if (cdxl->header[1] & 0x10) {
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
st->codec->sample_rate = cdxl->sample_rate;
st->start_time = 0;
cdxl->audio_stream_index = st->index;
Expand Down
3 changes: 3 additions & 0 deletions libavformat/daud.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/channel_layout.h"
#include "avformat.h"

static int daud_header(AVFormatContext *s) {
Expand All @@ -28,6 +30,7 @@ static int daud_header(AVFormatContext *s) {
st->codec->codec_id = AV_CODEC_ID_PCM_S24DAUD;
st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
st->codec->channels = 6;
st->codec->channel_layout = AV_CH_LAYOUT_5POINT1;
st->codec->sample_rate = 96000;
st->codec->bit_rate = 3 * 6 * 96000 * 8;
st->codec->block_align = 3 * 6;
Expand Down
2 changes: 2 additions & 0 deletions libavformat/dsicin.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Delphine Software International CIN file demuxer
*/

#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
Expand Down Expand Up @@ -132,6 +133,7 @@ static int cin_read_header(AVFormatContext *s)
st->codec->codec_id = AV_CODEC_ID_DSICINAUDIO;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 22050;
st->codec->bits_per_coded_sample = 8;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
Expand Down
2 changes: 2 additions & 0 deletions libavformat/dv.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "internal.h"
#include "libavcodec/dv_profile.h"
#include "libavcodec/dvdata.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/timecode.h"
Expand Down Expand Up @@ -252,6 +253,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
}
c->ast[i]->codec->sample_rate = dv_audio_frequency[freq];
c->ast[i]->codec->channels = 2;
c->ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16;
c->ast[i]->start_time = 0;
}
Expand Down
4 changes: 4 additions & 0 deletions libavformat/flvdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
#include "libavutil/intfloat.h"
Expand Down Expand Up @@ -778,6 +779,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
if(!st->codec->channels || !st->codec->sample_rate || !st->codec->bits_per_coded_sample) {
st->codec->channels = channels;
st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = sample_rate;
st->codec->bits_per_coded_sample = bits_per_coded_sample;
}
Expand Down Expand Up @@ -824,6 +827,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
st->codec->extradata_size * 8, 1) >= 0) {
st->codec->channels = cfg.channels;
st->codec->channel_layout = 0;
if (cfg.ext_sample_rate)
st->codec->sample_rate = cfg.ext_sample_rate;
else
Expand Down
2 changes: 2 additions & 0 deletions libavformat/gsmdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/channel_layout.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
Expand Down Expand Up @@ -63,6 +64,7 @@ static int gsm_read_header(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = s->iformat->raw_codec_id;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = c->sample_rate;
st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;

Expand Down
4 changes: 4 additions & 0 deletions libavformat/gxf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "avformat.h"
#include "internal.h"
Expand Down Expand Up @@ -141,6 +142,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_PCM_S24LE;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 48000;
st->codec->bit_rate = 3 * 1 * 48000 * 8;
st->codec->block_align = 3 * 1;
Expand All @@ -150,6 +152,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 48000;
st->codec->bit_rate = 2 * 1 * 48000 * 8;
st->codec->block_align = 2 * 1;
Expand All @@ -159,6 +162,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_AC3;
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = 48000;
break;
// timecode tracks:
Expand Down
10 changes: 9 additions & 1 deletion libavformat/idroqdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* http://www.csse.monash.edu.au/~timf/
*/

#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
Expand Down Expand Up @@ -178,7 +179,14 @@ static int roq_read_packet(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_ROQ_DPCM;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = roq->audio_channels = chunk_type == RoQ_SOUND_STEREO ? 2 : 1;
if (chunk_type == RoQ_SOUND_STEREO) {
st->codec->channels = 2;
st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
st->codec->channels = 1;
st->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
roq->audio_channels = st->codec->channels;
st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE;
st->codec->bits_per_coded_sample = 16;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
Expand Down
Loading

0 comments on commit 7eb40d8

Please sign in to comment.