* 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>tags/n1.0
@@ -1552,6 +1552,7 @@ eatqi_decoder_select="aandcttables error_resilience mpegvideo" | |||||
exr_decoder_select="zlib" | exr_decoder_select="zlib" | ||||
ffv1_decoder_select="golomb rangecoder" | ffv1_decoder_select="golomb rangecoder" | ||||
ffv1_encoder_select="rangecoder" | ffv1_encoder_select="rangecoder" | ||||
ffvhuff_encoder_select="huffman" | |||||
flac_decoder_select="golomb" | flac_decoder_select="golomb" | ||||
flac_encoder_select="golomb lpc" | flac_encoder_select="golomb lpc" | ||||
flashsv_decoder_select="zlib" | flashsv_decoder_select="zlib" | ||||
@@ -40,6 +40,22 @@ void ff_af_queue_close(AudioFrameQueue *afq) | |||||
memset(afq, 0, sizeof(*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) | 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)); | 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) | if (duration) | ||||
*duration = ff_samples_to_time_base(afq->avctx, removed_samples); | *duration = ff_samples_to_time_base(afq->avctx, removed_samples); | ||||
} | } | ||||
@@ -31,6 +31,63 @@ | |||||
/* symbol for Huffman tree node */ | /* symbol for Huffman tree node */ | ||||
#define HNODE -1 | #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, | static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat, | ||||
Node *nodes, int node, | Node *nodes, int node, | ||||
@@ -117,60 +174,3 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, | |||||
} | } | ||||
return 0; | 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; | |||||
} | |||||
} |
@@ -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, | int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, | ||||
Node *nodes, HuffCmp cmp, int flags); | 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 */ | #endif /* AVCODEC_HUFFMAN_H */ |
@@ -676,7 +676,7 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
} | } | ||||
for (i = 0; i < 3; i++) { | 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) { | if (generate_bits_table(s->bits[i], s->len[i]) < 0) { | ||||
return -1; | return -1; | ||||
@@ -1286,7 +1286,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, | |||||
if (s->context) { | if (s->context) { | ||||
for (i = 0; i < 3; i++) { | 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) | if (generate_bits_table(s->bits[i], s->len[i]) < 0) | ||||
return -1; | return -1; | ||||
size += store_table(s, s->len[i], &pkt->data[size]); | size += store_table(s, s->len[i], &pkt->data[size]); | ||||
@@ -26,8 +26,6 @@ | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sys/time.h> | |||||
#include <unistd.h> | |||||
#include "config.h" | #include "config.h" | ||||
#include "dsputil.h" | #include "dsputil.h" | ||||
@@ -441,7 +441,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src, | |||||
} | } | ||||
/* Calculate huffman lengths */ | /* 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: | * Write the plane's header into the output packet: | ||||
@@ -4,26 +4,26 @@ OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o | |||||
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o | OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o | ||||
MMX-OBJS += x86/dsputil_mmx.o \ | MMX-OBJS += x86/dsputil_mmx.o \ | ||||
x86/fdct_mmx.o \ | |||||
x86/fdct.o \ | |||||
x86/fmtconvert_init.o \ | x86/fmtconvert_init.o \ | ||||
x86/idct_mmx_xvid.o \ | x86/idct_mmx_xvid.o \ | ||||
x86/idct_sse2_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_AAC_DECODER) += x86/sbrdsp_init.o | ||||
MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_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_DNXHD_ENCODER) += x86/dnxhdenc.o | ||||
MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o \ | |||||
MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp.o \ | |||||
x86/dwt.o | x86/dwt.o | ||||
MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o | MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o | ||||
MMX-OBJS-$(CONFIG_FFT) += x86/fft_init.o | MMX-OBJS-$(CONFIG_FFT) += x86/fft_init.o | ||||
MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o | MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o | ||||
MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o | MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o | ||||
MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_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_MPEGVIDEO) += x86/mpegvideo.o | ||||
MMX-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o | MMX-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o | ||||
MMX-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.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_AAC_DECODER) += x86/sbrdsp.o | ||||
YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.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_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o | ||||
YASM-OBJS-$(CONFIG_DWT) += x86/dwt_yasm.o | YASM-OBJS-$(CONFIG_DWT) += x86/dwt_yasm.o | ||||
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.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 \ | YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \ | ||||
x86/h264_chromamc_10bit.o | x86/h264_chromamc_10bit.o | ||||
YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.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 \ | YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \ | ||||
x86/h264_intrapred_10bit.o | x86/h264_intrapred_10bit.o | ||||
YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_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_PNG_DECODER) += x86/pngdsp.o | ||||
YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o | YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o | ||||
YASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o | YASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o | ||||
@@ -2101,7 +2101,7 @@ PREFETCH(prefetch_3dnow, prefetch) | |||||
#endif /* HAVE_INLINE_ASM */ | #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, | void ff_put_h264_chroma_mc8_mmx_rnd (uint8_t *dst, uint8_t *src, | ||||
int stride, int h, int x, int y); | int stride, int h, int x, int y); | ||||
@@ -2,20 +2,20 @@ | |||||
;* 36 point SSE-optimized IMDCT transform | ;* 36 point SSE-optimized IMDCT transform | ||||
;* Copyright (c) 2011 Vitor Sessak | ;* 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 | ;* modify it under the terms of the GNU Lesser General Public | ||||
;* License as published by the Free Software Foundation; either | ;* License as published by the Free Software Foundation; either | ||||
;* version 2.1 of the License, or (at your option) any later version. | ;* 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 | ;* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
;* Lesser General Public License for more details. | ;* Lesser General Public License for more details. | ||||
;* | ;* | ||||
;* You should have received a copy of the GNU Lesser General Public | ;* 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 | ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
;****************************************************************************** | ;****************************************************************************** | ||||
@@ -369,7 +369,6 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index, | |||||
// set our parameters | // set our parameters | ||||
codec->width = atoi(buf1); | codec->width = atoi(buf1); | ||||
codec->height = atoi(p + 1); // skip the - | codec->height = atoi(p + 1); // skip the - | ||||
codec->pix_fmt = PIX_FMT_YUV420P; | |||||
} else if (av_strstart(p, "fmtp:", &p)) { | } else if (av_strstart(p, "fmtp:", &p)) { | ||||
return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); | return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264); | ||||
} else if (av_strstart(p, "cliprect:", &p)) { | } else if (av_strstart(p, "cliprect:", &p)) { | ||||
@@ -154,9 +154,11 @@ static char *extradata2psets(AVCodecContext *c) | |||||
{ | { | ||||
char *psets, *p; | char *psets, *p; | ||||
const uint8_t *r; | 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; | uint8_t *orig_extradata = NULL; | ||||
int orig_extradata_size = 0; | int orig_extradata_size = 0; | ||||
const uint8_t *sps = NULL, *sps_end; | |||||
if (c->extradata_size > MAX_EXTRADATA_SIZE) { | if (c->extradata_size > MAX_EXTRADATA_SIZE) { | ||||
av_log(c, AV_LOG_ERROR, "Too much extradata!\n"); | av_log(c, AV_LOG_ERROR, "Too much extradata!\n"); | ||||
@@ -210,6 +212,10 @@ static char *extradata2psets(AVCodecContext *c) | |||||
*p = ','; | *p = ','; | ||||
p++; | p++; | ||||
} | } | ||||
if (!sps) { | |||||
sps = r; | |||||
sps_end = r1; | |||||
} | |||||
if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) { | 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_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r); | ||||
av_free(psets); | av_free(psets); | ||||
@@ -219,6 +225,12 @@ static char *extradata2psets(AVCodecContext *c) | |||||
p += strlen(p); | p += strlen(p); | ||||
r = r1; | 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) { | if (orig_extradata) { | ||||
av_free(c->extradata); | av_free(c->extradata); | ||||
c->extradata = orig_extradata; | c->extradata = orig_extradata; | ||||
@@ -20,7 +20,6 @@ | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> /* for memset() */ | #include <string.h> /* for memset() */ | ||||
#include <unistd.h> | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <inttypes.h> | #include <inttypes.h> | ||||
@@ -149,15 +149,15 @@ const int *sws_getCoefficients(int colorspace) | |||||
while (h_size--) { \ | while (h_size--) { \ | ||||
int av_unused U, V, Y; \ | 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; \ | int av_unused Y, U, V; \ | ||||
#define ENDYUV2RGBFUNC() \ | #define ENDYUV2RGBFUNC() \ | ||||
@@ -167,7 +167,7 @@ const int *sws_getCoefficients(int colorspace) | |||||
} | } | ||||
#define CLOSEYUV2RGBFUNC(dst_delta) \ | #define CLOSEYUV2RGBFUNC(dst_delta) \ | ||||
ENDYUV2RGBLINE(dst_delta) \ | |||||
ENDYUV2RGBLINE(dst_delta, 0) \ | |||||
ENDYUV2RGBFUNC() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0) | YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0) | ||||
@@ -186,7 +186,7 @@ YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0) | |||||
LOADCHROMA(3); | LOADCHROMA(3); | ||||
PUTRGB48(dst_2, py_2, 3); | PUTRGB48(dst_2, py_2, 3); | ||||
PUTRGB48(dst_1, py_1, 3); | PUTRGB48(dst_1, py_1, 3); | ||||
ENDYUV2RGBLINE(48) | |||||
ENDYUV2RGBLINE(48, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTRGB48(dst_1, py_1, 0); | PUTRGB48(dst_1, py_1, 0); | ||||
PUTRGB48(dst_2, py_2, 0); | PUTRGB48(dst_2, py_2, 0); | ||||
@@ -194,6 +194,10 @@ ENDYUV2RGBLINE(48) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTRGB48(dst_2, py_2, 1); | PUTRGB48(dst_2, py_2, 1); | ||||
PUTRGB48(dst_1, py_1, 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() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0) | YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0) | ||||
@@ -212,7 +216,7 @@ YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0) | |||||
LOADCHROMA(3); | LOADCHROMA(3); | ||||
PUTBGR48(dst_2, py_2, 3); | PUTBGR48(dst_2, py_2, 3); | ||||
PUTBGR48(dst_1, py_1, 3); | PUTBGR48(dst_1, py_1, 3); | ||||
ENDYUV2RGBLINE(48) | |||||
ENDYUV2RGBLINE(48, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTBGR48(dst_1, py_1, 0); | PUTBGR48(dst_1, py_1, 0); | ||||
PUTBGR48(dst_2, py_2, 0); | PUTBGR48(dst_2, py_2, 0); | ||||
@@ -220,6 +224,10 @@ ENDYUV2RGBLINE(48) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTBGR48(dst_2, py_2, 1); | PUTBGR48(dst_2, py_2, 1); | ||||
PUTBGR48(dst_1, py_1, 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() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0) | YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0) | ||||
@@ -238,7 +246,7 @@ YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0) | |||||
LOADCHROMA(3); | LOADCHROMA(3); | ||||
PUTRGB(dst_2, py_2, 3); | PUTRGB(dst_2, py_2, 3); | ||||
PUTRGB(dst_1, py_1, 3); | PUTRGB(dst_1, py_1, 3); | ||||
ENDYUV2RGBLINE(8) | |||||
ENDYUV2RGBLINE(8, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTRGB(dst_1, py_1, 0); | PUTRGB(dst_1, py_1, 0); | ||||
PUTRGB(dst_2, py_2, 0); | PUTRGB(dst_2, py_2, 0); | ||||
@@ -246,6 +254,10 @@ ENDYUV2RGBLINE(8) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTRGB(dst_2, py_2, 1); | PUTRGB(dst_2, py_2, 1); | ||||
PUTRGB(dst_1, py_1, 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() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1) | 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); | PUTRGBA(dst_1, py_1, pa_2, 3, 24); | ||||
pa_1 += 8; \ | pa_1 += 8; \ | ||||
pa_2 += 8; \ | pa_2 += 8; \ | ||||
ENDYUV2RGBLINE(8) | |||||
ENDYUV2RGBLINE(8, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTRGBA(dst_1, py_1, pa_1, 0, 24); | PUTRGBA(dst_1, py_1, pa_1, 0, 24); | ||||
PUTRGBA(dst_2, py_2, pa_2, 0, 24); | PUTRGBA(dst_2, py_2, pa_2, 0, 24); | ||||
@@ -274,6 +286,12 @@ ENDYUV2RGBLINE(8) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTRGBA(dst_2, py_2, pa_1, 1, 24); | PUTRGBA(dst_2, py_2, pa_1, 1, 24); | ||||
PUTRGBA(dst_1, py_1, pa_2, 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() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuva2argb_c, uint32_t, 1) | 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); | PUTRGBA(dst_1, py_1, pa_1, 3, 0); | ||||
pa_1 += 8; \ | pa_1 += 8; \ | ||||
pa_2 += 8; \ | pa_2 += 8; \ | ||||
ENDYUV2RGBLINE(8) | |||||
ENDYUV2RGBLINE(8, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTRGBA(dst_1, py_1, pa_1, 0, 0); | PUTRGBA(dst_1, py_1, pa_1, 0, 0); | ||||
PUTRGBA(dst_2, py_2, pa_2, 0, 0); | PUTRGBA(dst_2, py_2, pa_2, 0, 0); | ||||
@@ -302,6 +320,12 @@ ENDYUV2RGBLINE(8) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTRGBA(dst_2, py_2, pa_2, 1, 0); | PUTRGBA(dst_2, py_2, pa_2, 1, 0); | ||||
PUTRGBA(dst_1, py_1, pa_1, 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() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0) | YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0) | ||||
@@ -320,7 +344,7 @@ YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0) | |||||
LOADCHROMA(3); | LOADCHROMA(3); | ||||
PUTRGB24(dst_2, py_2, 3); | PUTRGB24(dst_2, py_2, 3); | ||||
PUTRGB24(dst_1, py_1, 3); | PUTRGB24(dst_1, py_1, 3); | ||||
ENDYUV2RGBLINE(24) | |||||
ENDYUV2RGBLINE(24, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTRGB24(dst_1, py_1, 0); | PUTRGB24(dst_1, py_1, 0); | ||||
PUTRGB24(dst_2, py_2, 0); | PUTRGB24(dst_2, py_2, 0); | ||||
@@ -328,6 +352,10 @@ ENDYUV2RGBLINE(24) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTRGB24(dst_2, py_2, 1); | PUTRGB24(dst_2, py_2, 1); | ||||
PUTRGB24(dst_1, py_1, 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() | ENDYUV2RGBFUNC() | ||||
// only trivial mods from yuv2rgb_c_24_rgb | // only trivial mods from yuv2rgb_c_24_rgb | ||||
@@ -347,7 +375,7 @@ YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0) | |||||
LOADCHROMA(3); | LOADCHROMA(3); | ||||
PUTBGR24(dst_2, py_2, 3); | PUTBGR24(dst_2, py_2, 3); | ||||
PUTBGR24(dst_1, py_1, 3); | PUTBGR24(dst_1, py_1, 3); | ||||
ENDYUV2RGBLINE(24) | |||||
ENDYUV2RGBLINE(24, 0) | |||||
LOADCHROMA(0); | LOADCHROMA(0); | ||||
PUTBGR24(dst_1, py_1, 0); | PUTBGR24(dst_1, py_1, 0); | ||||
PUTBGR24(dst_2, py_2, 0); | PUTBGR24(dst_2, py_2, 0); | ||||
@@ -355,6 +383,10 @@ ENDYUV2RGBLINE(24) | |||||
LOADCHROMA(1); | LOADCHROMA(1); | ||||
PUTBGR24(dst_2, py_2, 1); | PUTBGR24(dst_2, py_2, 1); | ||||
PUTBGR24(dst_1, py_1, 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() | ENDYUV2RGBFUNC() | ||||
YUV2RGBFUNC(yuv2rgb_c_16_ordered_dither, uint16_t, 0) | YUV2RGBFUNC(yuv2rgb_c_16_ordered_dither, uint16_t, 0) | ||||
@@ -6,11 +6,17 @@ | |||||
* This utility converts compressed Macromedia Flash files to uncompressed ones. | * This utility converts compressed Macromedia Flash files to uncompressed ones. | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#if HAVE_UNISTD_H | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#endif | |||||
#if HAVE_IO_H | |||||
#include <io.h> | |||||
#endif | |||||
#include <zlib.h> | #include <zlib.h> | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
@@ -18,7 +18,10 @@ | |||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#include "config.h" | |||||
#if HAVE_UNISTD_H | |||||
#include <unistd.h> /* getopt */ | #include <unistd.h> /* getopt */ | ||||
#endif | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
@@ -27,6 +30,10 @@ | |||||
#include "libavutil/audioconvert.h" | #include "libavutil/audioconvert.h" | ||||
#include "libavfilter/avfiltergraph.h" | #include "libavfilter/avfiltergraph.h" | ||||
#if !HAVE_GETOPT | |||||
#include "compat/getopt.c" | |||||
#endif | |||||
static void usage(void) | static void usage(void) | ||||
{ | { | ||||
printf("Convert a libavfilter graph to a dot file\n"); | printf("Convert a libavfilter graph to a dot file\n"); | ||||
@@ -36,8 +36,8 @@ | |||||
#include <string.h> | #include <string.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#ifdef _WIN32 | #ifdef _WIN32 | ||||
#include <io.h> | |||||
#define mkdir(a, b) mkdir(a) | |||||
#include <direct.h> | |||||
#define mkdir(a, b) _mkdir(a) | |||||
#endif | #endif | ||||
#include "libavformat/avformat.h" | #include "libavformat/avformat.h" | ||||
@@ -18,12 +18,18 @@ | |||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#include "config.h" | |||||
#include <limits.h> | #include <limits.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#if HAVE_UNISTD_H | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#endif | |||||
#if HAVE_IO_H | |||||
#include <io.h> | |||||
#endif | |||||
#include "libavutil/time.h" | #include "libavutil/time.h" | ||||
#include "libavformat/avformat.h" | #include "libavformat/avformat.h" | ||||
@@ -32,6 +32,9 @@ | |||||
#ifdef __MINGW32__ | #ifdef __MINGW32__ | ||||
#define fseeko(x, y, z) fseeko64(x, y, z) | #define fseeko(x, y, z) fseeko64(x, y, z) | ||||
#define ftello(x) ftello64(x) | #define ftello(x) ftello64(x) | ||||
#elif defined(_WIN32) | |||||
#define fseeko(x, y, z) _fseeki64(x, y, z) | |||||
#define ftello(x) _ftelli64(x) | |||||
#endif | #endif | ||||
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) | #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) | ||||