summaryrefslogtreecommitdiffstats
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
parent85c830331c36502144e1cc9cf8aa7bd177e1d79d (diff)
parentd488c3bcbaf7ddda42597e014deb661a7e9e2112 (diff)
downloadffmpeg-streaming-1c66807636ed8da5cf81d75cc8bb2726c6d6bc21.zip
ffmpeg-streaming-1c66807636ed8da5cf81d75cc8bb2726c6d6bc21.tar.gz
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>
-rwxr-xr-xconfigure1
-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
-rw-r--r--libavformat/rtpdec_h264.c1
-rw-r--r--libavformat/sdp.c14
-rw-r--r--libswscale/colorspace-test.c1
-rw-r--r--libswscale/yuv2rgb.c64
-rw-r--r--tools/cws2fws.c6
-rw-r--r--tools/graph2dot.c7
-rw-r--r--tools/ismindex.c4
-rw-r--r--tools/pktdumper.c6
-rw-r--r--tools/qt-faststart.c3
29 files changed, 178 insertions, 100 deletions
diff --git a/configure b/configure
index 857eb57..4b86c8e 100755
--- a/configure
+++ b/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"
diff --git a/libavcodec/audio_frame_queue.c b/libavcodec/audio_frame_queue.c
index ec515d9..274588c 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 c8d37d7..27fed9f 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 956ac1f..2fdf88d 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 e770b63..2a9ebe1 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 1959d38..3504ccf 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 e497333..5cebd91 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 3334080..74b7a89 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 4087544..4087544 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 02b5f3f..02b5f3f 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 170cbbe..db3c78d 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 566e0b6..566e0b6 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 e8a9925..e8a9925 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 71a1fbe..71a1fbe 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 336e9f0..63cac10 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 e0e6f8b..e0e6f8b 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 3ee68c2..3ee68c2 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 7bc0c30..7bc0c30 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 c514d75..c514d75 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 631291a..631291a 100644
--- a/libavcodec/x86/snowdsp_mmx.c
+++ b/libavcodec/x86/snowdsp.c
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 61e038a..083f8e8 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -369,7 +369,6 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
// set our parameters
codec->width = atoi(buf1);
codec->height = atoi(p + 1); // skip the -
- codec->pix_fmt = PIX_FMT_YUV420P;
} else if (av_strstart(p, "fmtp:", &p)) {
return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264);
} else if (av_strstart(p, "cliprect:", &p)) {
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 48dfb86..9d7dc0b 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -154,9 +154,11 @@ static char *extradata2psets(AVCodecContext *c)
{
char *psets, *p;
const uint8_t *r;
- const char *pset_string = "; sprop-parameter-sets=";
+ static const char pset_string[] = "; sprop-parameter-sets=";
+ static const char profile_string[] = "; profile-level-id=";
uint8_t *orig_extradata = NULL;
int orig_extradata_size = 0;
+ const uint8_t *sps = NULL, *sps_end;
if (c->extradata_size > MAX_EXTRADATA_SIZE) {
av_log(c, AV_LOG_ERROR, "Too much extradata!\n");
@@ -210,6 +212,10 @@ static char *extradata2psets(AVCodecContext *c)
*p = ',';
p++;
}
+ if (!sps) {
+ sps = r;
+ sps_end = r1;
+ }
if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) {
av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets);
@@ -219,6 +225,12 @@ static char *extradata2psets(AVCodecContext *c)
p += strlen(p);
r = r1;
}
+ if (sps && sps_end - sps >= 4) {
+ memcpy(p, profile_string, strlen(profile_string));
+ p += strlen(p);
+ ff_data_to_hex(p, sps + 1, 3, 0);
+ p[6] = '\0';
+ }
if (orig_extradata) {
av_free(c->extradata);
c->extradata = orig_extradata;
diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
index 962861c..42a915b 100644
--- a/libswscale/colorspace-test.c
+++ b/libswscale/colorspace-test.c
@@ -20,7 +20,6 @@
#include <stdio.h>
#include <string.h> /* for memset() */
-#include <unistd.h>
#include <stdlib.h>
#include <inttypes.h>
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 67cf19e..073fa66 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -149,15 +149,15 @@ const int *sws_getCoefficients(int colorspace)
while (h_size--) { \
int av_unused U, V, Y; \
-#define ENDYUV2RGBLINE(dst_delta) \
- pu += 4; \
- pv += 4; \
- py_1 += 8; \
- py_2 += 8; \
- dst_1 += dst_delta; \
- dst_2 += dst_delta; \
+#define ENDYUV2RGBLINE(dst_delta, ss) \
+ pu += 4 >> ss; \
+ pv += 4 >> ss; \
+ py_1 += 8 >> ss; \
+ py_2 += 8 >> ss; \
+ dst_1 += dst_delta >> ss; \
+ dst_2 += dst_delta >> ss; \
} \
- if (c->dstW & 4) { \
+ if (c->dstW & (4 >> ss)) { \
int av_unused Y, U, V; \
#define ENDYUV2RGBFUNC() \
@@ -167,7 +167,7 @@ const int *sws_getCoefficients(int colorspace)
}
#define CLOSEYUV2RGBFUNC(dst_delta) \
- ENDYUV2RGBLINE(dst_delta) \
+ ENDYUV2RGBLINE(dst_delta, 0) \
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0)
@@ -186,7 +186,7 @@ YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0)
LOADCHROMA(3);
PUTRGB48(dst_2, py_2, 3);
PUTRGB48(dst_1, py_1, 3);
-ENDYUV2RGBLINE(48)
+ENDYUV2RGBLINE(48, 0)
LOADCHROMA(0);
PUTRGB48(dst_1, py_1, 0);
PUTRGB48(dst_2, py_2, 0);
@@ -194,6 +194,10 @@ ENDYUV2RGBLINE(48)
LOADCHROMA(1);
PUTRGB48(dst_2, py_2, 1);
PUTRGB48(dst_1, py_1, 1);
+ENDYUV2RGBLINE(48, 1)
+ LOADCHROMA(0);
+ PUTRGB48(dst_1, py_1, 0);
+ PUTRGB48(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0)
@@ -212,7 +216,7 @@ YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0)
LOADCHROMA(3);
PUTBGR48(dst_2, py_2, 3);
PUTBGR48(dst_1, py_1, 3);
-ENDYUV2RGBLINE(48)
+ENDYUV2RGBLINE(48, 0)
LOADCHROMA(0);
PUTBGR48(dst_1, py_1, 0);
PUTBGR48(dst_2, py_2, 0);
@@ -220,6 +224,10 @@ ENDYUV2RGBLINE(48)
LOADCHROMA(1);
PUTBGR48(dst_2, py_2, 1);
PUTBGR48(dst_1, py_1, 1);
+ENDYUV2RGBLINE(48, 1)
+ LOADCHROMA(0);
+ PUTBGR48(dst_1, py_1, 0);
+ PUTBGR48(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
@@ -238,7 +246,7 @@ YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
LOADCHROMA(3);
PUTRGB(dst_2, py_2, 3);
PUTRGB(dst_1, py_1, 3);
-ENDYUV2RGBLINE(8)
+ENDYUV2RGBLINE(8, 0)
LOADCHROMA(0);
PUTRGB(dst_1, py_1, 0);
PUTRGB(dst_2, py_2, 0);
@@ -246,6 +254,10 @@ ENDYUV2RGBLINE(8)
LOADCHROMA(1);
PUTRGB(dst_2, py_2, 1);
PUTRGB(dst_1, py_1, 1);
+ENDYUV2RGBLINE(8, 1)
+ LOADCHROMA(0);
+ PUTRGB(dst_1, py_1, 0);
+ PUTRGB(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
@@ -266,7 +278,7 @@ YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
PUTRGBA(dst_1, py_1, pa_2, 3, 24);
pa_1 += 8; \
pa_2 += 8; \
-ENDYUV2RGBLINE(8)
+ENDYUV2RGBLINE(8, 0)
LOADCHROMA(0);
PUTRGBA(dst_1, py_1, pa_1, 0, 24);
PUTRGBA(dst_2, py_2, pa_2, 0, 24);
@@ -274,6 +286,12 @@ ENDYUV2RGBLINE(8)
LOADCHROMA(1);
PUTRGBA(dst_2, py_2, pa_1, 1, 24);
PUTRGBA(dst_1, py_1, pa_2, 1, 24);
+ pa_1 += 4; \
+ pa_2 += 4; \
+ENDYUV2RGBLINE(8, 1)
+ LOADCHROMA(0);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 24);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 24);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
@@ -294,7 +312,7 @@ YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
PUTRGBA(dst_1, py_1, pa_1, 3, 0);
pa_1 += 8; \
pa_2 += 8; \
-ENDYUV2RGBLINE(8)
+ENDYUV2RGBLINE(8, 0)
LOADCHROMA(0);
PUTRGBA(dst_1, py_1, pa_1, 0, 0);
PUTRGBA(dst_2, py_2, pa_2, 0, 0);
@@ -302,6 +320,12 @@ ENDYUV2RGBLINE(8)
LOADCHROMA(1);
PUTRGBA(dst_2, py_2, pa_2, 1, 0);
PUTRGBA(dst_1, py_1, pa_1, 1, 0);
+ pa_1 += 4; \
+ pa_2 += 4; \
+ENDYUV2RGBLINE(8, 1)
+ LOADCHROMA(0);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 0);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
@@ -320,7 +344,7 @@ YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
LOADCHROMA(3);
PUTRGB24(dst_2, py_2, 3);
PUTRGB24(dst_1, py_1, 3);
-ENDYUV2RGBLINE(24)
+ENDYUV2RGBLINE(24, 0)
LOADCHROMA(0);
PUTRGB24(dst_1, py_1, 0);
PUTRGB24(dst_2, py_2, 0);
@@ -328,6 +352,10 @@ ENDYUV2RGBLINE(24)
LOADCHROMA(1);
PUTRGB24(dst_2, py_2, 1);
PUTRGB24(dst_1, py_1, 1);
+ENDYUV2RGBLINE(24, 1)
+ LOADCHROMA(0);
+ PUTRGB24(dst_1, py_1, 0);
+ PUTRGB24(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
// only trivial mods from yuv2rgb_c_24_rgb
@@ -347,7 +375,7 @@ YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0)
LOADCHROMA(3);
PUTBGR24(dst_2, py_2, 3);
PUTBGR24(dst_1, py_1, 3);
-ENDYUV2RGBLINE(24)
+ENDYUV2RGBLINE(24, 0)
LOADCHROMA(0);
PUTBGR24(dst_1, py_1, 0);
PUTBGR24(dst_2, py_2, 0);
@@ -355,6 +383,10 @@ ENDYUV2RGBLINE(24)
LOADCHROMA(1);
PUTBGR24(dst_2, py_2, 1);
PUTBGR24(dst_1, py_1, 1);
+ENDYUV2RGBLINE(24, 1)
+ LOADCHROMA(0);
+ PUTBGR24(dst_1, py_1, 0);
+ PUTBGR24(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_16_ordered_dither, uint16_t, 0)
diff --git a/tools/cws2fws.c b/tools/cws2fws.c
index 68f7953..74588c1 100644
--- a/tools/cws2fws.c
+++ b/tools/cws2fws.c
@@ -6,11 +6,17 @@
* This utility converts compressed Macromedia Flash files to uncompressed ones.
*/
+#include "config.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
#include <zlib.h>
#ifdef DEBUG
diff --git a/tools/graph2dot.c b/tools/graph2dot.c
index fa21ede..14f0e7a 100644
--- a/tools/graph2dot.c
+++ b/tools/graph2dot.c
@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+#if HAVE_UNISTD_H
#include <unistd.h> /* getopt */
+#endif
#include <stdio.h>
#include <string.h>
@@ -27,6 +30,10 @@
#include "libavutil/audioconvert.h"
#include "libavfilter/avfiltergraph.h"
+#if !HAVE_GETOPT
+#include "compat/getopt.c"
+#endif
+
static void usage(void)
{
printf("Convert a libavfilter graph to a dot file\n");
diff --git a/tools/ismindex.c b/tools/ismindex.c
index 1b69e28..b801d43 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -36,8 +36,8 @@
#include <string.h>
#include <sys/stat.h>
#ifdef _WIN32
-#include <io.h>
-#define mkdir(a, b) mkdir(a)
+#include <direct.h>
+#define mkdir(a, b) _mkdir(a)
#endif
#include "libavformat/avformat.h"
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index 1711210..3fb94f6 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -18,12 +18,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include <limits.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
#include "libavutil/time.h"
#include "libavformat/avformat.h"
diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index bb8e02e..ebbe952 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -32,6 +32,9 @@
#ifdef __MINGW32__
#define fseeko(x, y, z) fseeko64(x, y, z)
#define ftello(x) ftello64(x)
+#elif defined(_WIN32)
+#define fseeko(x, y, z) _fseeki64(x, y, z)
+#define ftello(x) _ftelli64(x)
#endif
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
OpenPOWER on IntegriCloud