* qatar/master: rtpdec: Use 4 byte startcodes for H.264 matroskadec: Mark variable as av_unused. Move some conditionally used variables into the block where they are used. Drop some completely unnecessary av_unused attributes. swscale: Remove unused variable alpMmxFilter. Drop unnecessary av_uninit attributes from some variable declarations. movenc: Support muxing wmapro in ismv/isma mpegtsenc: Add an AVOption for forcing a new PAT/PMT/SDT to be written swscale: move YUV2PACKED16WRAPPER() macro down to where it is used. swscale: handle gray16 as a "planar" YUV format (Y-only, of course). swscale: use yuv2packed1() functions for unscaled chroma also. swscale: fix incorrect chroma bias in yuv2rgb48_1_c(). swscale: fix invalid memory accesses in yuvpacked1() functions. Move PS2 MMI code below the mips subdirectory, where it belongs. mips: Move MMI function declarations to a header. build: Set correct dependencies for rtmp* protocols implemented by librtmp. Conflicts: libavcodec/ac3enc_template.c libavformat/mpegtsenc.c libswscale/output.c Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n0.11
@@ -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" | |||
@@ -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) | |||
@@ -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 */ | |||
@@ -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; | |||
@@ -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 | |||
@@ -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) | |||
@@ -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++) { | |||
@@ -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 \ |
@@ -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; |
@@ -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 */ |
@@ -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]; | |||
@@ -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"}, | |||
@@ -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; | |||
@@ -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); | |||
@@ -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; | |||
@@ -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); | |||
@@ -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 | |||
@@ -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; | |||
@@ -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); | |||
@@ -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) | |||
@@ -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", | |||
@@ -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); | |||
@@ -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 | |||
@@ -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; | |||
@@ -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); | |||