summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-29 17:46:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-29 18:04:34 +0200
commit1c66807636ed8da5cf81d75cc8bb2726c6d6bc21 (patch)
treedbb5d2fafe49a56ce5d608c74ae32929c08a4405 /libavcodec
parent85c830331c36502144e1cc9cf8aa7bd177e1d79d (diff)
parentd488c3bcbaf7ddda42597e014deb661a7e9e2112 (diff)
Merge commit 'd488c3bcbaf7ddda42597e014deb661a7e9e2112'
* commit 'd488c3bcbaf7ddda42597e014deb661a7e9e2112': configure: support Bitrig OS yuv2rgb: handle line widths that are not a multiple of 4. graph2dot: Use the fallback getopt implementation if needed tools: Include io.h for open/read/write/close if unistd.h doesn't exist testprogs: Remove unused includes qt-faststart: Use other seek/tell functions on MSVC than on mingw ismindex: Include direct.h for _mkdir on windows sdp: Use static const char arrays instead of pointers to strings x86: avcodec: Drop silly "_mmx" suffixes from filenames x86: avcodec: Drop silly "_sse" suffixes from filenames sdp: Include profile-level-id for H264 utvideoenc: use ff_huff_gen_len_table huffman: add ff_huff_gen_len_table cllc: simplify/fix swapped data buffer allocation. rtpdec_h264: Don't set the pixel format h264: Check that the codec isn't null before accessing it audio_frame_queue: Define af_queue_log_state before using it Conflicts: libavcodec/audio_frame_queue.c libavcodec/h264.c libavcodec/huffman.h libavcodec/huffyuv.c libavcodec/utvideoenc.c libavcodec/x86/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/audio_frame_queue.c17
-rw-r--r--libavcodec/huffman.c114
-rw-r--r--libavcodec/huffman.h2
-rw-r--r--libavcodec/huffyuv.c4
-rw-r--r--libavcodec/motion-test.c2
-rw-r--r--libavcodec/utvideoenc.c2
-rw-r--r--libavcodec/x86/Makefile20
-rw-r--r--libavcodec/x86/cavsdsp.c (renamed from libavcodec/x86/cavsdsp_mmx.c)0
-rw-r--r--libavcodec/x86/dct32.asm (renamed from libavcodec/x86/dct32_sse.asm)0
-rw-r--r--libavcodec/x86/dsputil_mmx.c2
-rw-r--r--libavcodec/x86/fdct.c (renamed from libavcodec/x86/fdct_mmx.c)0
-rw-r--r--libavcodec/x86/fft.asm (renamed from libavcodec/x86/fft_mmx.asm)0
-rw-r--r--libavcodec/x86/h264_qpel.c (renamed from libavcodec/x86/h264_qpel_mmx.c)0
-rw-r--r--libavcodec/x86/imdct36.asm (renamed from libavcodec/x86/imdct36_sse.asm)8
-rw-r--r--libavcodec/x86/lpc.c (renamed from libavcodec/x86/lpc_mmx.c)0
-rw-r--r--libavcodec/x86/motion_est.c (renamed from libavcodec/x86/motion_est_mmx.c)0
-rw-r--r--libavcodec/x86/mpegaudiodec.c (renamed from libavcodec/x86/mpegaudiodec_mmx.c)0
-rw-r--r--libavcodec/x86/simple_idct.c (renamed from libavcodec/x86/simple_idct_mmx.c)0
-rw-r--r--libavcodec/x86/snowdsp.c (renamed from libavcodec/x86/snowdsp_mmx.c)0
19 files changed, 92 insertions, 79 deletions
diff --git a/libavcodec/audio_frame_queue.c b/libavcodec/audio_frame_queue.c
index ec515d949a..274588c9cb 100644
--- a/libavcodec/audio_frame_queue.c
+++ b/libavcodec/audio_frame_queue.c
@@ -40,6 +40,22 @@ void ff_af_queue_close(AudioFrameQueue *afq)
memset(afq, 0, sizeof(*afq));
}
+#ifdef DEBUG
+static void af_queue_log_state(AudioFrameQueue *afq)
+{
+ AudioFrame *f;
+ av_dlog(afq->avctx, "remaining delay = %d\n", afq->remaining_delay);
+ av_dlog(afq->avctx, "remaining samples = %d\n", afq->remaining_samples);
+ av_dlog(afq->avctx, "frames:\n");
+ f = afq->frame_queue;
+ while (f) {
+ av_dlog(afq->avctx, " [ pts=%9"PRId64" duration=%d ]\n",
+ f->pts, f->duration);
+ f = f->next;
+ }
+}
+#endif /* DEBUG */
+
int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f)
{
AudioFrame *new = av_fast_realloc(afq->frames, &afq->frame_alloc, sizeof(*afq->frames)*(afq->frame_count+1));
@@ -108,4 +124,3 @@ void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts,
if (duration)
*duration = ff_samples_to_time_base(afq->avctx, removed_samples);
}
-
diff --git a/libavcodec/huffman.c b/libavcodec/huffman.c
index c8d37d78b6..27fed9f022 100644
--- a/libavcodec/huffman.c
+++ b/libavcodec/huffman.c
@@ -31,6 +31,63 @@
/* symbol for Huffman tree node */
#define HNODE -1
+typedef struct {
+ uint64_t val;
+ int name;
+} HeapElem;
+
+static void heap_sift(HeapElem *h, int root, int size)
+{
+ while (root * 2 + 1 < size) {
+ int child = root * 2 + 1;
+ if (child < size - 1 && h[child].val > h[child+1].val)
+ child++;
+ if (h[root].val > h[child].val) {
+ FFSWAP(HeapElem, h[root], h[child]);
+ root = child;
+ } else
+ break;
+ }
+}
+
+void ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats)
+{
+ HeapElem h[256];
+ int up[2*256];
+ int len[2*256];
+ int offset, i, next;
+ int size = 256;
+
+ for (offset = 1; ; offset <<= 1) {
+ for (i=0; i < size; i++) {
+ h[i].name = i;
+ h[i].val = (stats[i] << 8) + offset;
+ }
+ for (i = size / 2 - 1; i >= 0; i--)
+ heap_sift(h, i, size);
+
+ for (next = size; next < size * 2 - 1; next++) {
+ // merge the two smallest entries, and put it back in the heap
+ uint64_t min1v = h[0].val;
+ up[h[0].name] = next;
+ h[0].val = INT64_MAX;
+ heap_sift(h, 0, size);
+ up[h[0].name] = next;
+ h[0].name = next;
+ h[0].val += min1v;
+ heap_sift(h, 0, size);
+ }
+
+ len[2 * size - 2] = 0;
+ for (i = 2 * size - 3; i >= size; i--)
+ len[i] = len[up[i]] + 1;
+ for (i = 0; i < size; i++) {
+ dst[i] = len[up[i]] + 1;
+ if (dst[i] >= 32) break;
+ }
+ if (i==size) break;
+ }
+}
static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
Node *nodes, int node,
@@ -117,60 +174,3 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
}
return 0;
}
-
-typedef struct {
- uint64_t val;
- int name;
-} HeapElem;
-
-static void heap_sift(HeapElem *h, int root, int size)
-{
- while(root*2+1 < size) {
- int child = root*2+1;
- if(child < size-1 && h[child].val > h[child+1].val)
- child++;
- if(h[root].val > h[child].val) {
- FFSWAP(HeapElem, h[root], h[child]);
- root = child;
- } else
- break;
- }
-}
-
-void ff_generate_len_table(uint8_t *dst, const uint64_t *stats){
- HeapElem h[256];
- int up[2*256];
- int len[2*256];
- int offset, i, next;
- int size = 256;
-
- for(offset=1; ; offset<<=1){
- for(i=0; i<size; i++){
- h[i].name = i;
- h[i].val = (stats[i] << 8) + offset;
- }
- for(i=size/2-1; i>=0; i--)
- heap_sift(h, i, size);
-
- for(next=size; next<size*2-1; next++){
- // merge the two smallest entries, and put it back in the heap
- uint64_t min1v = h[0].val;
- up[h[0].name] = next;
- h[0].val = INT64_MAX;
- heap_sift(h, 0, size);
- up[h[0].name] = next;
- h[0].name = next;
- h[0].val += min1v;
- heap_sift(h, 0, size);
- }
-
- len[2*size-2] = 0;
- for(i=2*size-3; i>=size; i--)
- len[i] = len[up[i]] + 1;
- for(i=0; i<size; i++) {
- dst[i] = len[up[i]] + 1;
- if(dst[i] >= 32) break;
- }
- if(i==size) break;
- }
-}
diff --git a/libavcodec/huffman.h b/libavcodec/huffman.h
index 956ac1fbce..2fdf88d405 100644
--- a/libavcodec/huffman.h
+++ b/libavcodec/huffman.h
@@ -42,6 +42,6 @@ typedef int (*HuffCmp)(const void *va, const void *vb);
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
Node *nodes, HuffCmp cmp, int flags);
-void ff_generate_len_table(uint8_t *dst, const uint64_t *stats);
+void ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats);
#endif /* AVCODEC_HUFFMAN_H */
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index e770b6353f..2a9ebe1b2c 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -676,7 +676,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
for (i = 0; i < 3; i++) {
- ff_generate_len_table(s->len[i], s->stats[i]);
+ ff_huff_gen_len_table(s->len[i], s->stats[i]);
if (generate_bits_table(s->bits[i], s->len[i]) < 0) {
return -1;
@@ -1286,7 +1286,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if (s->context) {
for (i = 0; i < 3; i++) {
- ff_generate_len_table(s->len[i], s->stats[i]);
+ ff_huff_gen_len_table(s->len[i], s->stats[i]);
if (generate_bits_table(s->bits[i], s->len[i]) < 0)
return -1;
size += store_table(s, s->len[i], &pkt->data[size]);
diff --git a/libavcodec/motion-test.c b/libavcodec/motion-test.c
index 1959d38721..3504ccfd68 100644
--- a/libavcodec/motion-test.c
+++ b/libavcodec/motion-test.c
@@ -26,8 +26,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
#include "config.h"
#include "dsputil.h"
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index e497333d06..5cebd910aa 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -441,7 +441,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
}
/* Calculate huffman lengths */
- ff_generate_len_table(lengths, counts);
+ ff_huff_gen_len_table(lengths, counts);
/*
* Write the plane's header into the output packet:
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 3334080225..74b7a891f9 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -4,26 +4,26 @@ OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
MMX-OBJS += x86/dsputil_mmx.o \
- x86/fdct_mmx.o \
+ x86/fdct.o \
x86/fmtconvert_init.o \
x86/idct_mmx_xvid.o \
x86/idct_sse2_xvid.o \
- x86/motion_est_mmx.o \
- x86/simple_idct_mmx.o \
+ x86/motion_est.o \
+ x86/simple_idct.o \
MMX-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o
MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o
-MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o
+MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp.o
MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o
-MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \
+MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp.o \
x86/dwt.o
MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o
MMX-OBJS-$(CONFIG_FFT) += x86/fft_init.o
MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o
MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o
MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
-MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o
-MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o
+MMX-OBJS-$(CONFIG_LPC) += x86/lpc.o
+MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec.o
MMX-OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o
MMX-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o
MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o
@@ -40,11 +40,11 @@ MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp_init.o
YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o
YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
-YASM-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o
+YASM-OBJS-$(CONFIG_DCT) += x86/dct32.o
YASM-OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o
YASM-OBJS-$(CONFIG_DWT) += x86/dwt_yasm.o
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
-YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o
+YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \
x86/h264_chromamc_10bit.o
YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
@@ -56,7 +56,7 @@ YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \
x86/h264_intrapred_10bit.o
YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_10bit.o
-YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36_sse.o
+YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o
YASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o
YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o
YASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o
diff --git a/libavcodec/x86/cavsdsp_mmx.c b/libavcodec/x86/cavsdsp.c
index 40875449fc..40875449fc 100644
--- a/libavcodec/x86/cavsdsp_mmx.c
+++ b/libavcodec/x86/cavsdsp.c
diff --git a/libavcodec/x86/dct32_sse.asm b/libavcodec/x86/dct32.asm
index 02b5f3fc89..02b5f3fc89 100644
--- a/libavcodec/x86/dct32_sse.asm
+++ b/libavcodec/x86/dct32.asm
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 170cbbedf2..db3c78dff3 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2101,7 +2101,7 @@ PREFETCH(prefetch_3dnow, prefetch)
#endif /* HAVE_INLINE_ASM */
-#include "h264_qpel_mmx.c"
+#include "h264_qpel.c"
void ff_put_h264_chroma_mc8_mmx_rnd (uint8_t *dst, uint8_t *src,
int stride, int h, int x, int y);
diff --git a/libavcodec/x86/fdct_mmx.c b/libavcodec/x86/fdct.c
index 566e0b66b3..566e0b66b3 100644
--- a/libavcodec/x86/fdct_mmx.c
+++ b/libavcodec/x86/fdct.c
diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft.asm
index e8a9925105..e8a9925105 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft.asm
diff --git a/libavcodec/x86/h264_qpel_mmx.c b/libavcodec/x86/h264_qpel.c
index 71a1fbeed9..71a1fbeed9 100644
--- a/libavcodec/x86/h264_qpel_mmx.c
+++ b/libavcodec/x86/h264_qpel.c
diff --git a/libavcodec/x86/imdct36_sse.asm b/libavcodec/x86/imdct36.asm
index 336e9f0c54..63cac10d2b 100644
--- a/libavcodec/x86/imdct36_sse.asm
+++ b/libavcodec/x86/imdct36.asm
@@ -2,20 +2,20 @@
;* 36 point SSE-optimized IMDCT transform
;* Copyright (c) 2011 Vitor Sessak
;*
-;* This file is part of Libav.
+;* This file is part of FFmpeg.
;*
-;* Libav is free software; you can redistribute it and/or
+;* FFmpeg is free software; you can redistribute it and/or
;* modify it under the terms of the GNU Lesser General Public
;* License as published by the Free Software Foundation; either
;* version 2.1 of the License, or (at your option) any later version.
;*
-;* Libav is distributed in the hope that it will be useful,
+;* FFmpeg is distributed in the hope that it will be useful,
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;* Lesser General Public License for more details.
;*
;* You should have received a copy of the GNU Lesser General Public
-;* License along with Libav; if not, write to the Free Software
+;* License along with FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc.c
index e0e6f8ba8a..e0e6f8ba8a 100644
--- a/libavcodec/x86/lpc_mmx.c
+++ b/libavcodec/x86/lpc.c
diff --git a/libavcodec/x86/motion_est_mmx.c b/libavcodec/x86/motion_est.c
index 3ee68c2105..3ee68c2105 100644
--- a/libavcodec/x86/motion_est_mmx.c
+++ b/libavcodec/x86/motion_est.c
diff --git a/libavcodec/x86/mpegaudiodec_mmx.c b/libavcodec/x86/mpegaudiodec.c
index 7bc0c30c4f..7bc0c30c4f 100644
--- a/libavcodec/x86/mpegaudiodec_mmx.c
+++ b/libavcodec/x86/mpegaudiodec.c
diff --git a/libavcodec/x86/simple_idct_mmx.c b/libavcodec/x86/simple_idct.c
index c514d755ee..c514d755ee 100644
--- a/libavcodec/x86/simple_idct_mmx.c
+++ b/libavcodec/x86/simple_idct.c
diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp.c
index 631291aafe..631291aafe 100644
--- a/libavcodec/x86/snowdsp_mmx.c
+++ b/libavcodec/x86/snowdsp.c