From 11434c9b137257c4434a7cf2cf18297591f87a14 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 18 Aug 2012 13:20:09 +0100 Subject: [PATCH 1/4] pthread: add const to AVCodec pointers Signed-off-by: Mans Rullgard --- libavcodec/pthread.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index fd2dc1801e..e0489acffb 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -357,7 +357,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg) PerThreadContext *p = arg; FrameThreadContext *fctx = p->parent; AVCodecContext *avctx = p->avctx; - AVCodec *codec = avctx->codec; + const AVCodec *codec = avctx->codec; while (1) { if (p->state == STATE_INPUT_READY && !fctx->die) { @@ -517,7 +517,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt) { FrameThreadContext *fctx = p->parent; PerThreadContext *prev_thread = fctx->prev_thread; - AVCodec *codec = p->avctx->codec; + const AVCodec *codec = p->avctx->codec; uint8_t *buf = p->avpkt.data; if (!avpkt->size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0; @@ -720,7 +720,7 @@ static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count static void frame_thread_free(AVCodecContext *avctx, int thread_count) { FrameThreadContext *fctx = avctx->thread_opaque; - AVCodec *codec = avctx->codec; + const AVCodec *codec = avctx->codec; int i; park_frame_worker_threads(fctx, thread_count); @@ -777,7 +777,7 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count) static int frame_thread_init(AVCodecContext *avctx) { int thread_count = avctx->thread_count; - AVCodec *codec = avctx->codec; + const AVCodec *codec = avctx->codec; AVCodecContext *src = avctx; FrameThreadContext *fctx; int i, err = 0; From edb5238ccbd3ac3cd8c8fd533c3eab1287ea84b6 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 18 Aug 2012 13:22:38 +0100 Subject: [PATCH 2/4] libavformat: add const to AVCodec pointers Signed-off-by: Mans Rullgard --- libavformat/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 8bf688d1cc..81a4b34c4c 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2075,7 +2075,7 @@ static int has_decode_delay_been_guessed(AVStream *st) /* returns 1 or 0 if or if not decoded data was returned, or a negative error */ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **options) { - AVCodec *codec; + const AVCodec *codec; int got_picture = 1, ret = 0; AVFrame picture; AVPacket pkt = *avpkt; @@ -2236,7 +2236,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those for(i=0;inb_streams;i++) { - AVCodec *codec; + const AVCodec *codec; AVDictionary *thread_opt = NULL; st = ic->streams[i]; From 8b13445791952324174f50b76519eddc347dc29a Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 18 Aug 2012 13:22:57 +0100 Subject: [PATCH 3/4] avprobe: add const to AVCodec pointer Signed-off-by: Mans Rullgard --- avprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avprobe.c b/avprobe.c index 4e68313201..270baccf29 100644 --- a/avprobe.c +++ b/avprobe.c @@ -581,7 +581,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) { AVStream *stream = fmt_ctx->streams[stream_idx]; AVCodecContext *dec_ctx; - AVCodec *dec; + const AVCodec *dec; const char *profile; char val_str[128]; AVRational display_aspect_ratio; From 4855022aa11ec7aa1a3bd9797814e84795634abe Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 18 Aug 2012 14:30:11 +0100 Subject: [PATCH 4/4] vorbisdec: remove some pointless comments Signed-off-by: Mans Rullgard --- libavcodec/vorbisdec.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index ee2e5aea67..f11e2f5d61 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1364,14 +1364,14 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l) - vec[voffs + k + l * step] += codebook.codevectors[coffs + l]; // FPMATH + vec[voffs + k + l * step] += codebook.codevectors[coffs + l]; } } else if (vr_type == 1) { voffs = voffset + j * vlen; for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; ++l, ++voffs) { - vec[voffs]+=codebook.codevectors[coffs+l]; // FPMATH + vec[voffs]+=codebook.codevectors[coffs+l]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs); @@ -1383,23 +1383,23 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, if (dim == 2) { for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2; - vec[voffs + k ] += codebook.codevectors[coffs ]; // FPMATH - vec[voffs + k + vlen] += codebook.codevectors[coffs + 1]; // FPMATH + vec[voffs + k ] += codebook.codevectors[coffs ]; + vec[voffs + k + vlen] += codebook.codevectors[coffs + 1]; } } else if (dim == 4) { for (k = 0; k < step; ++k, voffs += 2) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4; - vec[voffs ] += codebook.codevectors[coffs ]; // FPMATH - vec[voffs + 1 ] += codebook.codevectors[coffs + 2]; // FPMATH - vec[voffs + vlen ] += codebook.codevectors[coffs + 1]; // FPMATH - vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3]; // FPMATH + vec[voffs ] += codebook.codevectors[coffs ]; + vec[voffs + 1 ] += codebook.codevectors[coffs + 2]; + vec[voffs + vlen ] += codebook.codevectors[coffs + 1]; + vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3]; } } else for (k = 0; k < step; ++k) { coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim; for (l = 0; l < dim; l += 2, voffs++) { - vec[voffs ] += codebook.codevectors[coffs + l ]; // FPMATH - vec[voffs + vlen] += codebook.codevectors[coffs + l + 1]; // FPMATH + vec[voffs ] += codebook.codevectors[coffs + l ]; + vec[voffs + vlen] += codebook.codevectors[coffs + l + 1]; av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n", pass, voffset / ch + (voffs % ch) * vlen, @@ -1619,7 +1619,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) mdct->imdct_half(mdct, ch_res_ptr, ch_floor_ptr); } -// Overlap/add, save data for next overlapping FPMATH +// Overlap/add, save data for next overlapping retlen = (blocksize + vc->blocksize[previous_window]) / 4; for (j = 0; j < vc->audio_channels; j++) {