diff options
27 files changed, 132 insertions, 192 deletions
@@ -1643,6 +1643,10 @@ https_protocol_select="tls_protocol" mmsh_protocol_select="http_protocol" mmst_protocol_deps="network" rtmp_protocol_select="tcp_protocol" +rtmpe_protocol_deps="librtmp" +rtmps_protocol_deps="librtmp" +rtmpt_protocol_deps="librtmp" +rtmpte_protocol_deps="librtmp" rtp_protocol_select="udp_protocol" tcp_protocol_deps="network" tls_protocol_deps_any="openssl gnutls" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 7ff6975da1..d14dac6010 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -747,7 +747,7 @@ HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ pcm_tablegen qdm2_tablegen sinewin_tablegen -DIRS = alpha arm avr32 bfin ppc ps2 sh4 sparc x86 +DIRS = alpha arm avr32 bfin mips ppc sh4 sparc x86 CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 2f1e7c8f67..a5d335091d 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1383,8 +1383,7 @@ static void ac3_output_frame_header(AC3EncodeContext *s) */ static void output_audio_block(AC3EncodeContext *s, int blk) { - int ch, i, baie, bnd, got_cpl; - int av_uninit(ch0); + int ch, i, baie, bnd, got_cpl, ch0; AC3Block *block = &s->blocks[blk]; /* block switching */ @@ -2233,8 +2232,7 @@ static av_cold int validate_options(AC3EncodeContext *s) */ static av_cold void set_bandwidth(AC3EncodeContext *s) { - int blk, ch; - int av_uninit(cpl_start); + int blk, ch, cpl_start; if (s->cutoff) { /* calculate bandwidth based on user-specified cutoff frequency */ diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index 60472550d1..554e0b007b 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -338,7 +338,7 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s) { int nb_coefs; int blk, bnd; - AC3Block *block, *av_uninit(block0); + AC3Block *block, *block0; if (s->channel_mode != AC3_CHMODE_STEREO) return; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index b496d72948..3ea7a24534 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1784,7 +1784,7 @@ typedef struct AVCodecContext { #define FF_IDCT_SIMPLE 2 #define FF_IDCT_SIMPLEMMX 3 #define FF_IDCT_LIBMPEG2MMX 4 -#define FF_IDCT_PS2 5 +#define FF_IDCT_MMI 5 #define FF_IDCT_ARM 7 #define FF_IDCT_ALTIVEC 8 #define FF_IDCT_SH4 9 diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 37f84bf5ef..25f1b7b847 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -66,7 +66,7 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){ */ static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst, int width, int height) { unsigned char *dst_end = dst + width*height; - int size, size1, size2, av_uninit(offset), run; + int size, size1, size2, offset, run; unsigned char *dst_start = dst; if (src[0] & 0x01) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index ca0863107a..055431b6d2 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -288,7 +288,7 @@ static int decode_subframe_fixed(FLACContext *s, int channel, int pred_order) { const int blocksize = s->blocksize; int32_t *decoded = s->decoded[channel]; - int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i; + int a, b, c, d, i; /* warm up samples */ for (i = 0; i < pred_order; i++) { diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile index 3f4da68ec9..006617687e 100644 --- a/libavcodec/mips/Makefile +++ b/libavcodec/mips/Makefile @@ -1,3 +1,3 @@ -OBJS-$(HAVE_MMI) += ps2/dsputil_mmi.o \ - ps2/idct_mmi.o \ - ps2/mpegvideo_mmi.o \ +OBJS-$(HAVE_MMI) += mips/dsputil_mmi.o \ + mips/idct_mmi.o \ + mips/mpegvideo_mmi.o \ diff --git a/libavcodec/ps2/dsputil_mmi.c b/libavcodec/mips/dsputil_mmi.c index 26259c8453..71a147fba4 100644 --- a/libavcodec/ps2/dsputil_mmi.c +++ b/libavcodec/mips/dsputil_mmi.c @@ -25,10 +25,6 @@ #include "libavcodec/dsputil.h" #include "mmi.h" -void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block); -void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block); -void ff_mmi_idct(DCTELEM *block); - static void clear_blocks_mmi(DCTELEM * blocks) { __asm__ volatile( @@ -157,7 +153,7 @@ void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx) } if (avctx->bits_per_raw_sample <= 8 && - (idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2)) { + (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_MMI)) { c->idct_put= ff_mmi_idct_put; c->idct_add= ff_mmi_idct_add; c->idct = ff_mmi_idct; diff --git a/libavcodec/ps2/idct_mmi.c b/libavcodec/mips/idct_mmi.c index 5a3af173de..5a3af173de 100644 --- a/libavcodec/ps2/idct_mmi.c +++ b/libavcodec/mips/idct_mmi.c diff --git a/libavcodec/ps2/mmi.h b/libavcodec/mips/mmi.h index 0265456108..5ff0033a87 100644 --- a/libavcodec/ps2/mmi.h +++ b/libavcodec/mips/mmi.h @@ -18,8 +18,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_PS2_MMI_H -#define AVCODEC_PS2_MMI_H +#ifndef AVCODEC_MIPS_MMI_H +#define AVCODEC_MIPS_MMI_H + +#include <stdint.h> + +#include "libavcodec/dsputil.h" + +void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block); +void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block); +void ff_mmi_idct(DCTELEM *block); #define align16 __attribute__ ((aligned (16))) @@ -168,4 +176,4 @@ #define pextlb(rs, rt, rd) \ __asm__ volatile ("pextlb " #rd ", " #rs ", " #rt ) -#endif /* AVCODEC_PS2_MMI_H */ +#endif /* AVCODEC_MIPS_MMI_H */ diff --git a/libavcodec/ps2/mpegvideo_mmi.c b/libavcodec/mips/mpegvideo_mmi.c index 8c8d3a7932..8c8d3a7932 100644 --- a/libavcodec/ps2/mpegvideo_mmi.c +++ b/libavcodec/mips/mpegvideo_mmi.c diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index c0e7682689..9ffc3439f9 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -134,8 +134,8 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de uint8_t *output, *output_end; const uint8_t* src = data; int p1, p2, line=avctx->height - 1, pos=0, i; - uint16_t av_uninit(pix16); - uint32_t av_uninit(pix32); + uint16_t pix16; + uint32_t pix32; unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3); output = pic->data[0] + (avctx->height - 1) * pic->linesize[0]; diff --git a/libavcodec/options.c b/libavcodec/options.c index b11d6abe6b..3be5861dde 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -219,7 +219,7 @@ static const AVOption options[]={ {"simple", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"libmpeg2mmx", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_LIBMPEG2MMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"ps2", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_PS2 }, INT_MIN, INT_MAX, V|E|D, "idct"}, +{"mmi", NULL, 0, AV_OPT_TYPE_CONST, { .dbl = FF_IDCT_MMI }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"arm", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c index a8963ab78a..9aa2edb4e0 100644 --- a/libavcodec/qtrleenc.c +++ b/libavcodec/qtrleenc.c @@ -126,7 +126,7 @@ static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t unsigned int skipcount; /* This will be the number of consecutive equal pixels in the current * frame, starting from the ith one also */ - unsigned int av_uninit(repeatcount); + unsigned int repeatcount; /* The cost of the three different possibilities */ int total_bulk_cost; diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 8f8b028e1d..49e525507f 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -120,7 +120,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) GradFunContext *gf = ctx->priv; float thresh = 1.2; int radius = 16; - av_unused int cpu_flags = av_get_cpu_flags(); + int cpu_flags = av_get_cpu_flags(); if (args) sscanf(args, "%f:%d", &thresh, &radius); diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 3a9637380b..c9f870539d 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -370,7 +370,7 @@ static int query_formats(AVFilterContext *ctx) static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) { YADIFContext *yadif = ctx->priv; - av_unused int cpu_flags = av_get_cpu_flags(); + int cpu_flags = av_get_cpu_flags(); yadif->mode = 0; yadif->parity = -1; diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 134839ffa1..8b1c525217 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -271,12 +271,10 @@ void av_register_all(void) REGISTER_PROTOCOL (MD5, md5); REGISTER_PROTOCOL (PIPE, pipe); REGISTER_PROTOCOL (RTMP, rtmp); -#if CONFIG_LIBRTMP - REGISTER_PROTOCOL (RTMP, rtmpt); - REGISTER_PROTOCOL (RTMP, rtmpe); - REGISTER_PROTOCOL (RTMP, rtmpte); - REGISTER_PROTOCOL (RTMP, rtmps); -#endif + REGISTER_PROTOCOL (RTMPE, rtmpe); + REGISTER_PROTOCOL (RTMPS, rtmps); + REGISTER_PROTOCOL (RTMPT, rtmpt); + REGISTER_PROTOCOL (RTMPTE, rtmpte); REGISTER_PROTOCOL (RTP, rtp); REGISTER_PROTOCOL (TCP, tcp); REGISTER_PROTOCOL (TLS, tls); diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 2c2bd47802..e2f46dc005 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -361,8 +361,8 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) /* This code assumes that extradata contains only palette */ /* This is true for all paletted codecs implemented in libavcodec */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { - int av_unused i; #if HAVE_BIGENDIAN + int i; for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) asf_st->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); #else diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index bb7a14e072..ddf60e48b2 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -967,7 +967,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size, uint8_t* data = *buf; int isize = *buf_size; uint8_t* pkt_data = NULL; - uint8_t* newpktdata; + uint8_t av_unused *newpktdata; int pkt_size = isize; int result = 0; int olen; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index dcc0d76e33..fe5a55c66f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -362,6 +362,15 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) return update_size(pb, pos); } +static int mov_write_wfex_tag(AVIOContext *pb, MOVTrack *track) +{ + int64_t pos = avio_tell(pb); + avio_wb32(pb, 0); + ffio_wfourcc(pb, "wfex"); + ff_put_wav_header(pb, track->enc); + return update_size(pb, pos); +} + static int mov_write_chan_tag(AVIOContext *pb, MOVTrack *track) { uint32_t layout_tag, bitmap; @@ -548,6 +557,8 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) mov_write_ac3_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_ALAC) mov_write_extradata_tag(pb, track); + else if (track->enc->codec_id == CODEC_ID_WMAPRO) + mov_write_wfex_tag(pb, track); else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); @@ -797,9 +808,13 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; - if (track->mode == MODE_MP4 || track->mode == MODE_PSP || track->mode == MODE_ISM) + if (track->mode == MODE_MP4 || track->mode == MODE_PSP) + tag = mp4_get_codec_tag(s, track); + else if (track->mode == MODE_ISM) { tag = mp4_get_codec_tag(s, track); - else if (track->mode == MODE_IPOD) + if (!tag && track->enc->codec_id == CODEC_ID_WMAPRO) + tag = MKTAG('w', 'm', 'a', ' '); + } else if (track->mode == MODE_IPOD) tag = ipod_get_codec_tag(s, track); else if (track->mode & MODE_3GP) tag = ff_codec_get_tag(codec_3gp_tags, track->enc->codec_id); diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 4b303def4b..b0047a216e 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -78,6 +78,8 @@ typedef struct MpegTSWrite { int pmt_start_pid; int start_pid; int m2ts_mode; + + int reemit_pat_pmt; } MpegTSWrite; /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */ @@ -101,6 +103,8 @@ static const AVOption options[] = { { "muxrate", NULL, offsetof(MpegTSWrite, mux_rate), AV_OPT_TYPE_INT, {1}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, { "pes_payload_size", "Minimum PES packet payload in bytes", offsetof(MpegTSWrite, pes_payload_size), AV_OPT_TYPE_INT, {DEFAULT_PES_PAYLOAD_SIZE}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, + { "resend_headers", "Reemit PAT/PMT before writing the next packet", + offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT, {0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, { NULL }, }; @@ -978,6 +982,12 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE)*2; int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE; + if (ts->reemit_pat_pmt) { + ts->pat_packet_count = ts->pat_packet_period - 1; + ts->sdt_packet_count = ts->sdt_packet_period - 1; + ts->reemit_pat_pmt = 0; + } + if (pkt->pts != AV_NOPTS_VALUE) pts = pkt->pts + delay; if (pkt->dts != AV_NOPTS_VALUE) diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index d581cfb50e..87abce9b21 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -272,7 +272,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s) { NSVContext *nsv = s->priv_data; AVIOContext *pb = s->pb; - unsigned int av_unused file_size; + unsigned int file_size; unsigned int size; int64_t duration; int strings_size; @@ -565,7 +565,6 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header) uint32_t vsize; uint16_t asize; uint16_t auxsize; - uint32_t av_unused auxtag; av_dlog(s, "%s(%d)\n", __FUNCTION__, fill_header); @@ -595,6 +594,7 @@ null_chunk_retry: av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); /* skip aux stuff */ for (i = 0; i < auxcount; i++) { + uint32_t auxtag; auxsize = avio_rl16(pb); auxtag = avio_rl32(pb); av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n", diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c index 730ed14807..01514c1bef 100644 --- a/libavformat/rtpdec_h264.c +++ b/libavformat/rtpdec_h264.c @@ -113,7 +113,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream, h264_data->level_idc = level_idc; } } else if (!strcmp(attr, "sprop-parameter-sets")) { - uint8_t start_sequence[]= { 0, 0, 1 }; + uint8_t start_sequence[] = { 0, 0, 0, 1 }; codec->extradata_size= 0; codec->extradata= NULL; @@ -176,7 +176,7 @@ static int h264_handle_packet(AVFormatContext *ctx, uint8_t nal = buf[0]; uint8_t type = (nal & 0x1f); int result= 0; - uint8_t start_sequence[]= {0, 0, 1}; + uint8_t start_sequence[] = { 0, 0, 0, 1 }; #ifdef DEBUG assert(data); diff --git a/libavutil/sha.c b/libavutil/sha.c index 301d1606b4..7194d43204 100644 --- a/libavutil/sha.c +++ b/libavutil/sha.c @@ -181,7 +181,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64]) { unsigned int i, a, b, c, d, e, f, g, h; uint32_t block[64]; - uint32_t T1, av_unused(T2); + uint32_t T1; a = state[0]; b = state[1]; @@ -193,6 +193,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64]) h = state[7]; #if CONFIG_SMALL for (i = 0; i < 64; i++) { + uint32_t T2; if (i < 16) T1 = blk0(i); else diff --git a/libswscale/output.c b/libswscale/output.c index d0bd72b350..180927892d 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -298,129 +298,6 @@ static void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterS } } -#define output_pixel(pos, val) \ - if (target == PIX_FMT_GRAY16BE) { \ - AV_WB16(pos, val); \ - } else { \ - AV_WL16(pos, val); \ - } - -static av_always_inline void -yuv2gray16_X_c_template(SwsContext *c, const int16_t *lumFilter, - const int32_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int32_t **chrUSrc, - const int32_t **chrVSrc, int chrFilterSize, - const int32_t **alpSrc, uint16_t *dest, int dstW, - int y, enum PixelFormat target) -{ - int i; - - for (i = 0; i < (dstW >> 1); i++) { - int j; - int Y1 = (1 << 14) - 0x40000000; - int Y2 = (1 << 14) - 0x40000000; - - for (j = 0; j < lumFilterSize; j++) { - Y1 += lumSrc[j][i * 2] * lumFilter[j]; - Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j]; - } - Y1 >>= 15; - Y2 >>= 15; - Y1 = av_clip_int16(Y1); - Y2 = av_clip_int16(Y2); - output_pixel(&dest[i * 2 + 0], 0x8000 + Y1); - output_pixel(&dest[i * 2 + 1], 0x8000 + Y2); - } -} - -static av_always_inline void -yuv2gray16_2_c_template(SwsContext *c, const int32_t *buf[2], - const int32_t *ubuf[2], const int32_t *vbuf[2], - const int32_t *abuf[2], uint16_t *dest, int dstW, - int yalpha, int uvalpha, int y, - enum PixelFormat target) -{ - int yalpha1 = 4095 - yalpha; - int i; - const int32_t *buf0 = buf[0], *buf1 = buf[1]; - - for (i = 0; i < (dstW >> 1); i++) { - int Y1 = (buf0[i * 2 ] * yalpha1 + buf1[i * 2 ] * yalpha) >> 15; - int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 15; - - output_pixel(&dest[i * 2 + 0], Y1); - output_pixel(&dest[i * 2 + 1], Y2); - } -} - -static av_always_inline void -yuv2gray16_1_c_template(SwsContext *c, const int32_t *buf0, - const int32_t *ubuf[2], const int32_t *vbuf[2], - const int32_t *abuf0, uint16_t *dest, int dstW, - int uvalpha, int y, enum PixelFormat target) -{ - int i; - - for (i = 0; i < (dstW >> 1); i++) { - int Y1 = (buf0[i * 2 ]+4)>>3; - int Y2 = (buf0[i * 2 + 1]+4)>>3; - - output_pixel(&dest[i * 2 + 0], Y1); - output_pixel(&dest[i * 2 + 1], Y2); - } -} - -#undef output_pixel - -#define YUV2PACKED16WRAPPER(name, base, ext, fmt) \ -static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ - const int16_t **_lumSrc, int lumFilterSize, \ - const int16_t *chrFilter, const int16_t **_chrUSrc, \ - const int16_t **_chrVSrc, int chrFilterSize, \ - const int16_t **_alpSrc, uint8_t *_dest, int dstW, \ - int y) \ -{ \ - const int32_t **lumSrc = (const int32_t **) _lumSrc, \ - **chrUSrc = (const int32_t **) _chrUSrc, \ - **chrVSrc = (const int32_t **) _chrVSrc, \ - **alpSrc = (const int32_t **) _alpSrc; \ - uint16_t *dest = (uint16_t *) _dest; \ - name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ - chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ - alpSrc, dest, dstW, y, fmt); \ -} \ - \ -static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ - const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ - const int16_t *_abuf[2], uint8_t *_dest, int dstW, \ - int yalpha, int uvalpha, int y) \ -{ \ - const int32_t **buf = (const int32_t **) _buf, \ - **ubuf = (const int32_t **) _ubuf, \ - **vbuf = (const int32_t **) _vbuf, \ - **abuf = (const int32_t **) _abuf; \ - uint16_t *dest = (uint16_t *) _dest; \ - name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ - dest, dstW, yalpha, uvalpha, y, fmt); \ -} \ - \ -static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \ - const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ - const int16_t *_abuf0, uint8_t *_dest, int dstW, \ - int uvalpha, int y) \ -{ \ - const int32_t *buf0 = (const int32_t *) _buf0, \ - **ubuf = (const int32_t **) _ubuf, \ - **vbuf = (const int32_t **) _vbuf, \ - *abuf0 = (const int32_t *) _abuf0; \ - uint16_t *dest = (uint16_t *) _dest; \ - name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ - dstW, uvalpha, y, fmt); \ -} - -YUV2PACKED16WRAPPER(yuv2gray16,, LE, PIX_FMT_GRAY16LE) -YUV2PACKED16WRAPPER(yuv2gray16,, BE, PIX_FMT_GRAY16BE) - #define output_pixel(pos, acc) \ if (target == PIX_FMT_MONOBLACK) { \ pos = acc; \ @@ -632,20 +509,20 @@ yuv2422_1_c_template(SwsContext *c, const int16_t *buf0, const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum PixelFormat target) { - const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], - *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; + const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; if (uvalpha < 2048) { for (i = 0; i < (dstW >> 1); i++) { int Y1 = buf0[i * 2] >> 7; int Y2 = buf0[i * 2 + 1] >> 7; - int U = ubuf1[i] >> 7; - int V = vbuf1[i] >> 7; + int U = ubuf0[i] >> 7; + int V = vbuf0[i] >> 7; output_pixels(i * 4, Y1, U, Y2, V); } } else { + const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; for (i = 0; i < (dstW >> 1); i++) { int Y1 = buf0[i * 2] >> 7; int Y2 = buf0[i * 2 + 1] >> 7; @@ -778,8 +655,7 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0, const int32_t *abuf0, uint16_t *dest, int dstW, int uvalpha, int y, enum PixelFormat target) { - const int32_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], - *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; + const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; if (uvalpha < 2048) { @@ -810,6 +686,7 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0, dest += 6; } } else { + const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2] ) >> 2; int Y2 = (buf0[i * 2 + 1]) >> 2; @@ -843,6 +720,52 @@ yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0, #undef r_b #undef b_r +#define YUV2PACKED16WRAPPER(name, base, ext, fmt) \ +static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \ + const int16_t **_lumSrc, int lumFilterSize, \ + const int16_t *chrFilter, const int16_t **_chrUSrc, \ + const int16_t **_chrVSrc, int chrFilterSize, \ + const int16_t **_alpSrc, uint8_t *_dest, int dstW, \ + int y) \ +{ \ + const int32_t **lumSrc = (const int32_t **) _lumSrc, \ + **chrUSrc = (const int32_t **) _chrUSrc, \ + **chrVSrc = (const int32_t **) _chrVSrc, \ + **alpSrc = (const int32_t **) _alpSrc; \ + uint16_t *dest = (uint16_t *) _dest; \ + name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ + chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ + alpSrc, dest, dstW, y, fmt); \ +} \ + \ +static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \ + const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ + const int16_t *_abuf[2], uint8_t *_dest, int dstW, \ + int yalpha, int uvalpha, int y) \ +{ \ + const int32_t **buf = (const int32_t **) _buf, \ + **ubuf = (const int32_t **) _ubuf, \ + **vbuf = (const int32_t **) _vbuf, \ + **abuf = (const int32_t **) _abuf; \ + uint16_t *dest = (uint16_t *) _dest; \ + name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ + dest, dstW, yalpha, uvalpha, y, fmt); \ +} \ + \ +static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \ + const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ + const int16_t *_abuf0, uint8_t *_dest, int dstW, \ + int uvalpha, int y) \ +{ \ + const int32_t *buf0 = (const int32_t *) _buf0, \ + **ubuf = (const int32_t **) _ubuf, \ + **vbuf = (const int32_t **) _vbuf, \ + *abuf0 = (const int32_t *) _abuf0; \ + uint16_t *dest = (uint16_t *) _dest; \ + name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ + dstW, uvalpha, y, fmt); \ +} + YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) @@ -980,12 +903,11 @@ yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter, int i; for (i = 0; i < (dstW >> 1); i++) { - int j; + int j, A1, A2; int Y1 = 1 << 18; int Y2 = 1 << 18; int U = 1 << 18; int V = 1 << 18; - int av_unused A1, A2; const void *r, *g, *b; for (j = 0; j < lumFilterSize; j++) { @@ -1067,16 +989,15 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, int uvalpha, int y, enum PixelFormat target, int hasAlpha) { - const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], - *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; + const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; if (uvalpha < 2048) { for (i = 0; i < (dstW >> 1); i++) { int Y1 = buf0[i * 2] >> 7; int Y2 = buf0[i * 2 + 1] >> 7; - int U = ubuf1[i] >> 7; - int V = vbuf1[i] >> 7; + int U = ubuf0[i] >> 7; + int V = vbuf0[i] >> 7; int A1, A2; const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), @@ -1091,6 +1012,7 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, r, g, b, y, target, hasAlpha); } } else { + const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; for (i = 0; i < (dstW >> 1); i++) { int Y1 = buf0[i * 2] >> 7; int Y2 = buf0[i * 2 + 1] >> 7; @@ -1180,8 +1102,7 @@ yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter, int Y = 1<<9; int U = (1<<9)-(128 << 19); int V = (1<<9)-(128 << 19); - int av_unused A; - int R, G, B; + int R, G, B, A; for (j = 0; j < lumFilterSize; j++) { Y += lumSrc[j][i] * lumFilter[j]; @@ -1489,16 +1410,6 @@ void ff_sws_init_output_funcs(SwsContext *c, } } switch (dstFormat) { - case PIX_FMT_GRAY16BE: - *yuv2packed1 = yuv2gray16BE_1_c; - *yuv2packed2 = yuv2gray16BE_2_c; - *yuv2packedX = yuv2gray16BE_X_c; - break; - case PIX_FMT_GRAY16LE: - *yuv2packed1 = yuv2gray16LE_1_c; - *yuv2packed2 = yuv2gray16LE_2_c; - *yuv2packedX = yuv2gray16LE_X_c; - break; case PIX_FMT_MONOWHITE: *yuv2packed1 = yuv2monowhite_1_c; *yuv2packed2 = yuv2monowhite_2_c; diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 12ec19bea0..0578e2dacc 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -334,7 +334,6 @@ static int swScale(SwsContext *c, const uint8_t* src[], int16_t *hChrFilter= c->hChrFilter; int32_t *lumMmxFilter= c->lumMmxFilter; int32_t *chrMmxFilter= c->chrMmxFilter; - int32_t av_unused *alpMmxFilter= c->alpMmxFilter; const int vLumFilterSize= c->vLumFilterSize; const int vChrFilterSize= c->vChrFilterSize; const int hLumFilterSize= c->hLumFilterSize; @@ -539,7 +538,7 @@ static int swScale(SwsContext *c, const uint8_t* src[], int16_t *vLumFilter= c->vLumFilter; int16_t *vChrFilter= c->vChrFilter; - if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 like + if (isPlanarYUV(dstFormat) || (isGray(dstFormat) && !isALPHA(dstFormat))) { //YV12 like const int chrSkipMask= (1<<c->chrDstVSubSample)-1; vLumFilter += dstY * vLumFilterSize; @@ -594,8 +593,8 @@ static int swScale(SwsContext *c, const uint8_t* src[], } else { assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(chrUSrcPtr + vChrFilterSize - 1 < chrUPixBuf + vChrBufSize*2); - if (c->yuv2packed1 && vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB - int chrAlpha = vChrFilter[2 * dstY + 1]; + if (c->yuv2packed1 && vLumFilterSize == 1 && vChrFilterSize <= 2) { //unscaled RGB + int chrAlpha = vChrFilterSize == 1 ? 0 : vChrFilter[2 * dstY + 1]; yuv2packed1(c, *lumSrcPtr, chrUSrcPtr, chrVSrcPtr, alpPixBuf ? *alpSrcPtr : NULL, dest[0], dstW, chrAlpha, dstY); |