Browse Source

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>
Michael Niedermayer 12 years ago
parent
commit
1c66807636

+ 1 - 0
configure

@@ -1552,6 +1552,7 @@ eatqi_decoder_select="aandcttables error_resilience mpegvideo"
 exr_decoder_select="zlib"
 ffv1_decoder_select="golomb rangecoder"
 ffv1_encoder_select="rangecoder"
+ffvhuff_encoder_select="huffman"
 flac_decoder_select="golomb"
 flac_encoder_select="golomb lpc"
 flashsv_decoder_select="zlib"

+ 16 - 1
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);
 }
-

+ 57 - 57
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;
-    }
-}

+ 1 - 1
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 */

+ 2 - 2
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]);

+ 0 - 2
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"

+ 1 - 1
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:

+ 10 - 10
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

+ 0 - 0
libavcodec/x86/cavsdsp_mmx.c → libavcodec/x86/cavsdsp.c


+ 0 - 0
libavcodec/x86/dct32_sse.asm → libavcodec/x86/dct32.asm


Some files were not shown because too many files changed in this diff