diff options
Diffstat (limited to 'gst-libs/ext/libav/libavcodec')
-rw-r--r-- | gst-libs/ext/libav/libavcodec/adpcmenc.c | 3 | ||||
-rw-r--r-- | gst-libs/ext/libav/libavcodec/avpacket.c | 1 | ||||
-rw-r--r-- | gst-libs/ext/libav/libavcodec/jpeg2000.c | 31 | ||||
-rw-r--r-- | gst-libs/ext/libav/libavcodec/libmp3lame.c | 8 | ||||
-rw-r--r-- | gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c | 4 | ||||
-rw-r--r-- | gst-libs/ext/libav/libavcodec/ppc/asm.S | 8 |
6 files changed, 44 insertions, 11 deletions
diff --git a/gst-libs/ext/libav/libavcodec/adpcmenc.c b/gst-libs/ext/libav/libavcodec/adpcmenc.c index fb3ce0d..341dda4 100644 --- a/gst-libs/ext/libav/libavcodec/adpcmenc.c +++ b/gst-libs/ext/libav/libavcodec/adpcmenc.c @@ -549,10 +549,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, put_bits(&pb, 7, status->step_index); if (avctx->trellis > 0) { uint8_t buf[64]; - adpcm_compress_trellis(avctx, &samples_p[ch][1], buf, status, + adpcm_compress_trellis(avctx, &samples_p[ch][0], buf, status, 64, 1); for (i = 0; i < 64; i++) put_bits(&pb, 4, buf[i ^ 1]); + status->prev_sample = status->predictor; } else { for (i = 0; i < 64; i += 2) { int t1, t2; diff --git a/gst-libs/ext/libav/libavcodec/avpacket.c b/gst-libs/ext/libav/libavcodec/avpacket.c index c0a0f8c..052aaf8 100644 --- a/gst-libs/ext/libav/libavcodec/avpacket.c +++ b/gst-libs/ext/libav/libavcodec/avpacket.c @@ -325,7 +325,6 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) dst->convergence_duration = src->convergence_duration; dst->flags = src->flags; dst->stream_index = src->stream_index; - dst->side_data_elems = src->side_data_elems; for (i = 0; i < src->side_data_elems; i++) { enum AVPacketSideDataType type = src->side_data[i].type; diff --git a/gst-libs/ext/libav/libavcodec/jpeg2000.c b/gst-libs/ext/libav/libavcodec/jpeg2000.c index bf46398..154409e 100644 --- a/gst-libs/ext/libav/libavcodec/jpeg2000.c +++ b/gst-libs/ext/libav/libavcodec/jpeg2000.c @@ -228,7 +228,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, if (!comp->i_data) return AVERROR(ENOMEM); } - comp->reslevel = av_malloc_array(codsty->nreslevels, sizeof(*comp->reslevel)); + comp->reslevel = av_mallocz_array(codsty->nreslevels, sizeof(*comp->reslevel)); if (!comp->reslevel) return AVERROR(ENOMEM); /* LOOP on resolution levels */ @@ -276,7 +276,7 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, reslevel->log2_prec_height) - (reslevel->coord[1][0] >> reslevel->log2_prec_height); - reslevel->band = av_malloc_array(reslevel->nbands, sizeof(*reslevel->band)); + reslevel->band = av_mallocz_array(reslevel->nbands, sizeof(*reslevel->band)); if (!reslevel->band) return AVERROR(ENOMEM); @@ -372,9 +372,9 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, for (j = 0; j < 2; j++) band->coord[1][j] = ff_jpeg2000_ceildiv(band->coord[1][j], dy); - band->prec = av_malloc_array(reslevel->num_precincts_x * - reslevel->num_precincts_y, - sizeof(*band->prec)); + band->prec = av_mallocz_array(reslevel->num_precincts_x * + reslevel->num_precincts_y, + sizeof(*band->prec)); if (!band->prec) return AVERROR(ENOMEM); @@ -487,15 +487,30 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty) for (reslevelno = 0; comp->reslevel && reslevelno < codsty->nreslevels; reslevelno++) { - Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; + Jpeg2000ResLevel *reslevel; + + if (!comp->reslevel) + continue; + reslevel = comp->reslevel + reslevelno; for (bandno = 0; bandno < reslevel->nbands; bandno++) { - Jpeg2000Band *band = reslevel->band + bandno; + Jpeg2000Band *band; + + if (!reslevel->band) + continue; + + band = reslevel->band + bandno; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++) { - Jpeg2000Prec *prec = band->prec + precno; + Jpeg2000Prec *prec; + + if (!band->prec) + continue; + + prec = band->prec + precno; av_freep(&prec->zerobits); av_freep(&prec->cblkincl); av_freep(&prec->cblk); + } av_freep(&band->prec); diff --git a/gst-libs/ext/libav/libavcodec/libmp3lame.c b/gst-libs/ext/libav/libavcodec/libmp3lame.c index ee76ff8..2fc080f 100644 --- a/gst-libs/ext/libav/libavcodec/libmp3lame.c +++ b/gst-libs/ext/libav/libavcodec/libmp3lame.c @@ -175,6 +175,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, MPADecodeHeader hdr; int len, ret, ch; int lame_result; + uint32_t h; if (frame) { switch (avctx->sample_fmt) { @@ -230,7 +231,12 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, determine the frame size. */ if (s->buffer_index < 4) return 0; - if (avpriv_mpegaudio_decode_header(&hdr, AV_RB32(s->buffer))) { + h = AV_RB32(s->buffer); + if (ff_mpa_check_header(h) < 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid mp3 header at start of buffer\n"); + return AVERROR_BUG; + } + if (avpriv_mpegaudio_decode_header(&hdr, h)) { av_log(avctx, AV_LOG_ERROR, "free format output not supported\n"); return -1; } diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c b/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c index 69dda45..25e7319 100644 --- a/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c +++ b/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c @@ -24,6 +24,8 @@ * MPEG Audio header decoder. */ +#include "libavutil/common.h" + #include "avcodec.h" #include "mpegaudio.h" #include "mpegaudiodata.h" @@ -45,6 +47,8 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) s->layer = 4 - ((header >> 17) & 3); /* extract frequency */ sample_rate_index = (header >> 10) & 3; + if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) + sample_rate_index = 0; sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); sample_rate_index += 3 * (s->lsf + mpeg25); s->sample_rate_index = sample_rate_index; diff --git a/gst-libs/ext/libav/libavcodec/ppc/asm.S b/gst-libs/ext/libav/libavcodec/ppc/asm.S index 4d4285b..141dee9 100644 --- a/gst-libs/ext/libav/libavcodec/ppc/asm.S +++ b/gst-libs/ext/libav/libavcodec/ppc/asm.S @@ -36,12 +36,20 @@ .macro extfunc name .global X(\name) +#if _CALL_ELF == 2 + .text +X(\name): + addis %r2, %r12, .TOC.-X(\name)@ha + addi %r2, %r2, .TOC.-X(\name)@l + .localentry X(\name), .-X(\name) +#else .section .opd, "aw" X(\name): .quad L(\name), .TOC.@tocbase, 0 .previous .type X(\name), STT_FUNC L(\name): +#endif .endm .macro movrel rd, sym, gp |