* qatar/master: x86: fft: fix imdct_half() for AVX rtmppkt: Add missing libavcodec/bytestream.h include. rtmp: add functions for reading AMF values vc1dec: remove useless #include simple_idct.h dct-test: always link with aandcttab.o vp8: pack struct VP8ThreadData more efficiently x86: remove libmpeg2 mmx(ext) idct functions eamad: Use dsputils instead of a custom bswap16_buf Canopus Lossless decoder Conflicts: Changelog LICENSE libavcodec/avcodec.h libavcodec/cllc.c libavcodec/eamad.c libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.0
| @@ -829,7 +829,7 @@ HOSTPROGS = aac_tablegen \ | |||||
| CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) | CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) | ||||
| $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o | |||||
| $(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o | |||||
| TRIG_TABLES = cos cos_fixed sin | TRIG_TABLES = cos cos_fixed sin | ||||
| TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c) | TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c) | ||||
| @@ -261,6 +261,7 @@ enum CodecID { | |||||
| CODEC_ID_MSA1, | CODEC_ID_MSA1, | ||||
| CODEC_ID_TSCC2, | CODEC_ID_TSCC2, | ||||
| CODEC_ID_MTS2, | CODEC_ID_MTS2, | ||||
| CODEC_ID_CLLC, | |||||
| CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), | CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), | ||||
| CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), | CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), | ||||
| CODEC_ID_EXR = MKBETAG('0','E','X','R'), | CODEC_ID_EXR = MKBETAG('0','E','X','R'), | ||||
| @@ -274,7 +275,6 @@ enum CodecID { | |||||
| CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), | CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), | ||||
| CODEC_ID_SANM = MKBETAG('S','A','N','M'), | CODEC_ID_SANM = MKBETAG('S','A','N','M'), | ||||
| CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'), | CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'), | ||||
| CODEC_ID_CLLC = MKBETAG('C','L','L','C'), | |||||
| /* various PCM "codecs" */ | /* various PCM "codecs" */ | ||||
| CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs | CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs | ||||
| @@ -36,7 +36,6 @@ | |||||
| #include "vc1acdata.h" | #include "vc1acdata.h" | ||||
| #include "msmpeg4data.h" | #include "msmpeg4data.h" | ||||
| #include "unary.h" | #include "unary.h" | ||||
| #include "simple_idct.h" | |||||
| #include "mathops.h" | #include "mathops.h" | ||||
| #include "vdpau_internal.h" | #include "vdpau_internal.h" | ||||
| #include "libavutil/avassert.h" | #include "libavutil/avassert.h" | ||||
| @@ -27,7 +27,7 @@ | |||||
| */ | */ | ||||
| #define LIBAVCODEC_VERSION_MAJOR 54 | #define LIBAVCODEC_VERSION_MAJOR 54 | ||||
| #define LIBAVCODEC_VERSION_MINOR 47 | |||||
| #define LIBAVCODEC_VERSION_MINOR 48 | |||||
| #define LIBAVCODEC_VERSION_MICRO 100 | #define LIBAVCODEC_VERSION_MICRO 100 | ||||
| #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||
| @@ -94,21 +94,8 @@ typedef struct { | |||||
| } VP8Macroblock; | } VP8Macroblock; | ||||
| typedef struct { | typedef struct { | ||||
| #if HAVE_THREADS | |||||
| pthread_mutex_t lock; | |||||
| pthread_cond_t cond; | |||||
| #endif | |||||
| int thread_nr; | |||||
| int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF) | |||||
| int wait_mb_pos; // What the current thread is waiting on. | |||||
| uint8_t *edge_emu_buffer; | |||||
| /** | |||||
| * For coeff decode, we need to know whether the above block had non-zero | |||||
| * coefficients. This means for each macroblock, we need data for 4 luma | |||||
| * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9 | |||||
| * per macroblock. We keep the last row in top_nnz. | |||||
| */ | |||||
| DECLARE_ALIGNED(8, uint8_t, left_nnz)[9]; | |||||
| DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; | |||||
| DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; | |||||
| /** | /** | ||||
| * This is the index plus one of the last non-zero coeff | * This is the index plus one of the last non-zero coeff | ||||
| * for each of the blocks in the current macroblock. | * for each of the blocks in the current macroblock. | ||||
| @@ -117,8 +104,21 @@ typedef struct { | |||||
| * 2+-> full transform | * 2+-> full transform | ||||
| */ | */ | ||||
| DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4]; | DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4]; | ||||
| DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16]; | |||||
| DECLARE_ALIGNED(16, DCTELEM, block_dc)[16]; | |||||
| /** | |||||
| * For coeff decode, we need to know whether the above block had non-zero | |||||
| * coefficients. This means for each macroblock, we need data for 4 luma | |||||
| * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9 | |||||
| * per macroblock. We keep the last row in top_nnz. | |||||
| */ | |||||
| DECLARE_ALIGNED(8, uint8_t, left_nnz)[9]; | |||||
| int thread_nr; | |||||
| #if HAVE_THREADS | |||||
| pthread_mutex_t lock; | |||||
| pthread_cond_t cond; | |||||
| #endif | |||||
| int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF) | |||||
| int wait_mb_pos; // What the current thread is waiting on. | |||||
| uint8_t *edge_emu_buffer; | |||||
| VP8FilterStrength *filter_strength; | VP8FilterStrength *filter_strength; | ||||
| } VP8ThreadData; | } VP8ThreadData; | ||||
| @@ -1010,7 +1010,11 @@ cglobal imdct_half, 3,12,8; FFTContext *s, FFTSample *output, const FFTSample *i | |||||
| push rrevtab | push rrevtab | ||||
| %endif | %endif | ||||
| sub r3, mmsize/4 | |||||
| %if mmsize == 8 | |||||
| sub r3, 2 | |||||
| %else | |||||
| sub r3, 4 | |||||
| %endif | |||||
| %if ARCH_X86_64 || mmsize == 8 | %if ARCH_X86_64 || mmsize == 8 | ||||
| xor r4, r4 | xor r4, r4 | ||||
| sub r4, r3 | sub r4, r3 | ||||
| @@ -1037,7 +1041,9 @@ cglobal imdct_half, 3,12,8; FFTContext *s, FFTSample *output, const FFTSample *i | |||||
| mova [r1+r5*8], m0 | mova [r1+r5*8], m0 | ||||
| mova [r1+r6*8], m2 | mova [r1+r6*8], m2 | ||||
| add r4, 2 | add r4, 2 | ||||
| %elif ARCH_X86_64 | |||||
| sub r4, 2 | |||||
| %else | |||||
| %if ARCH_X86_64 | |||||
| movzx r5, word [rrevtab+r4-4] | movzx r5, word [rrevtab+r4-4] | ||||
| movzx r6, word [rrevtab+r4-2] | movzx r6, word [rrevtab+r4-2] | ||||
| movzx r10, word [rrevtab+r3] | movzx r10, word [rrevtab+r3] | ||||
| @@ -1058,7 +1064,8 @@ cglobal imdct_half, 3,12,8; FFTContext *s, FFTSample *output, const FFTSample *i | |||||
| movlps [r1+r5*8], xmm1 | movlps [r1+r5*8], xmm1 | ||||
| movhps [r1+r4*8], xmm1 | movhps [r1+r4*8], xmm1 | ||||
| %endif | %endif | ||||
| sub r3, mmsize/4 | |||||
| sub r3, 4 | |||||
| %endif | |||||
| jns .pre | jns .pre | ||||
| mov r5, r0 | mov r5, r0 | ||||
| @@ -71,6 +71,51 @@ void ff_amf_write_object_end(uint8_t **dst) | |||||
| bytestream_put_be24(dst, AMF_DATA_TYPE_OBJECT_END); | bytestream_put_be24(dst, AMF_DATA_TYPE_OBJECT_END); | ||||
| } | } | ||||
| int ff_amf_read_bool(GetByteContext *bc, int *val) | |||||
| { | |||||
| if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_BOOL) | |||||
| return AVERROR_INVALIDDATA; | |||||
| *val = bytestream2_get_byte(bc); | |||||
| return 0; | |||||
| } | |||||
| int ff_amf_read_number(GetByteContext *bc, double *val) | |||||
| { | |||||
| uint64_t read; | |||||
| if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_NUMBER) | |||||
| return AVERROR_INVALIDDATA; | |||||
| read = bytestream2_get_be64(bc); | |||||
| *val = av_int2double(read); | |||||
| return 0; | |||||
| } | |||||
| int ff_amf_read_string(GetByteContext *bc, uint8_t *str, | |||||
| int strsize, int *length) | |||||
| { | |||||
| int stringlen = 0; | |||||
| int readsize; | |||||
| if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_STRING) | |||||
| return AVERROR_INVALIDDATA; | |||||
| stringlen = bytestream2_get_be16(bc); | |||||
| if (stringlen + 1 > strsize) | |||||
| return AVERROR(EINVAL); | |||||
| readsize = bytestream2_get_buffer(bc, str, stringlen); | |||||
| if (readsize != stringlen) { | |||||
| av_log(NULL, AV_LOG_WARNING, | |||||
| "Unable to read as many bytes as AMF string signaled\n"); | |||||
| } | |||||
| str[readsize] = '\0'; | |||||
| *length = FFMIN(stringlen, readsize); | |||||
| return 0; | |||||
| } | |||||
| int ff_amf_read_null(GetByteContext *bc) | |||||
| { | |||||
| if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_NULL) | |||||
| return AVERROR_INVALIDDATA; | |||||
| return 0; | |||||
| } | |||||
| int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p, | int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p, | ||||
| int chunk_size, RTMPPacket *prev_pkt) | int chunk_size, RTMPPacket *prev_pkt) | ||||
| { | { | ||||
| @@ -22,6 +22,7 @@ | |||||
| #ifndef AVFORMAT_RTMPPKT_H | #ifndef AVFORMAT_RTMPPKT_H | ||||
| #define AVFORMAT_RTMPPKT_H | #define AVFORMAT_RTMPPKT_H | ||||
| #include "libavcodec/bytestream.h" | |||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "url.h" | #include "url.h" | ||||
| @@ -231,6 +232,48 @@ void ff_amf_write_field_name(uint8_t **dst, const char *str); | |||||
| */ | */ | ||||
| void ff_amf_write_object_end(uint8_t **dst); | void ff_amf_write_object_end(uint8_t **dst); | ||||
| /** | |||||
| * Read AMF boolean value. | |||||
| * | |||||
| *@param[in,out] gbc GetByteContext initialized with AMF-formatted data | |||||
| *@param[out] val 0 or 1 | |||||
| *@return 0 on success or an AVERROR code on failure | |||||
| */ | |||||
| int ff_amf_read_bool(GetByteContext *gbc, int *val); | |||||
| /** | |||||
| * Read AMF number value. | |||||
| * | |||||
| *@param[in,out] gbc GetByteContext initialized with AMF-formatted data | |||||
| *@param[out] val read value | |||||
| *@return 0 on success or an AVERROR code on failure | |||||
| */ | |||||
| int ff_amf_read_number(GetByteContext *gbc, double *val); | |||||
| /** | |||||
| * Read AMF string value. | |||||
| * | |||||
| * Appends a trailing \0 to output string in order to | |||||
| * ease later parsing. | |||||
| * | |||||
| *@param[in,out] gbc GetByteContext initialized with AMF-formatted data | |||||
| *@param[out] str read string | |||||
| *@param[in] strsize buffer size available to store the read string | |||||
| *@param[out] length read string length | |||||
| *@return 0 on success or an AVERROR code on failure | |||||
| */ | |||||
| int ff_amf_read_string(GetByteContext *gbc, uint8_t *str, | |||||
| int strsize, int *length); | |||||
| /** | |||||
| * Read AMF NULL value. | |||||
| * | |||||
| *@param[in,out] gbc GetByteContext initialized with AMF-formatted data | |||||
| *@return 0 on success or an AVERROR code on failure | |||||
| */ | |||||
| int ff_amf_read_null(GetByteContext *gbc); | |||||
| /** @} */ // AMF funcs | /** @} */ // AMF funcs | ||||
| #endif /* AVFORMAT_RTMPPKT_H */ | #endif /* AVFORMAT_RTMPPKT_H */ | ||||