* commit '9221efef7968463f3e3d9ce79ea72eaca082e73f': lavf: fix av_interleaved_write_frame() doxy. lavf: clarify the lifetime of demuxed packets. avconv: do not free muxed packet on streamcopy. crc: move doxy to the header vf_drawtext: do not use deprecated av_tree_node_size x86: Refactor PSWAPD fallback implementations and port to cpuflags Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n1.1
| @@ -1394,7 +1394,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p | |||||
| write_frame(of->ctx, &opkt, ost); | write_frame(of->ctx, &opkt, ost); | ||||
| ost->st->codec->frame_number++; | ost->st->codec->frame_number++; | ||||
| av_free_packet(&opkt); | |||||
| } | } | ||||
| static void rate_emu_sleep(InputStream *ist) | static void rate_emu_sleep(InputStream *ist) | ||||
| @@ -105,7 +105,8 @@ SECTION_TEXT | |||||
| pfadd %5, %4 ; {t6,t5} | pfadd %5, %4 ; {t6,t5} | ||||
| pxor %3, [ps_m1p1] ; {t8,t7} | pxor %3, [ps_m1p1] ; {t8,t7} | ||||
| mova %6, %1 | mova %6, %1 | ||||
| PSWAPD %3, %3 | |||||
| movd [r0+12], %3 | |||||
| punpckhdq %3, [r0+8] | |||||
| pfadd %1, %5 ; {r0,i0} | pfadd %1, %5 ; {r0,i0} | ||||
| pfsub %6, %5 ; {r2,i2} | pfsub %6, %5 ; {r2,i2} | ||||
| mova %4, %2 | mova %4, %2 | ||||
| @@ -499,19 +500,6 @@ fft8 %+ SUFFIX: | |||||
| %endmacro | %endmacro | ||||
| %if ARCH_X86_32 | %if ARCH_X86_32 | ||||
| %macro PSWAPD 2 | |||||
| %if cpuflag(3dnowext) | |||||
| pswapd %1, %2 | |||||
| %elifidn %1, %2 | |||||
| movd [r0+12], %1 | |||||
| punpckhdq %1, [r0+8] | |||||
| %else | |||||
| movq %1, %2 | |||||
| psrlq %1, 32 | |||||
| punpckldq %1, %2 | |||||
| %endif | |||||
| %endmacro | |||||
| INIT_MMX 3dnowext | INIT_MMX 3dnowext | ||||
| FFT48_3DNOW | FFT48_3DNOW | ||||
| @@ -246,16 +246,6 @@ FLOAT_TO_INT16_INTERLEAVE2 | |||||
| INIT_XMM sse2 | INIT_XMM sse2 | ||||
| FLOAT_TO_INT16_INTERLEAVE2 | FLOAT_TO_INT16_INTERLEAVE2 | ||||
| %macro PSWAPD_SSE 2 | |||||
| pshufw %1, %2, 0x4e | |||||
| %endmacro | |||||
| %macro PSWAPD_3DNOW 2 | |||||
| movq %1, %2 | |||||
| psrlq %1, 32 | |||||
| punpckldq %1, %2 | |||||
| %endmacro | |||||
| %macro FLOAT_TO_INT16_INTERLEAVE6 0 | %macro FLOAT_TO_INT16_INTERLEAVE6 0 | ||||
| ; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len) | ; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len) | ||||
| cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, src5, len | cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, src5, len | ||||
| @@ -285,11 +275,11 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, s | |||||
| packssdw mm0, mm3 | packssdw mm0, mm3 | ||||
| packssdw mm1, mm4 | packssdw mm1, mm4 | ||||
| packssdw mm2, mm5 | packssdw mm2, mm5 | ||||
| pswapd mm3, mm0 | |||||
| PSWAPD mm3, mm0 | |||||
| punpcklwd mm0, mm1 | punpcklwd mm0, mm1 | ||||
| punpckhwd mm1, mm2 | punpckhwd mm1, mm2 | ||||
| punpcklwd mm2, mm3 | punpcklwd mm2, mm3 | ||||
| pswapd mm3, mm0 | |||||
| PSWAPD mm3, mm0 | |||||
| punpckldq mm0, mm2 | punpckldq mm0, mm2 | ||||
| punpckhdq mm2, mm1 | punpckhdq mm2, mm1 | ||||
| punpckldq mm1, mm3 | punpckldq mm1, mm3 | ||||
| @@ -305,12 +295,9 @@ cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, s | |||||
| %endmacro ; FLOAT_TO_INT16_INTERLEAVE6 | %endmacro ; FLOAT_TO_INT16_INTERLEAVE6 | ||||
| INIT_MMX sse | INIT_MMX sse | ||||
| %define pswapd PSWAPD_SSE | |||||
| FLOAT_TO_INT16_INTERLEAVE6 | FLOAT_TO_INT16_INTERLEAVE6 | ||||
| INIT_MMX 3dnow | INIT_MMX 3dnow | ||||
| %define pswapd PSWAPD_3DNOW | |||||
| FLOAT_TO_INT16_INTERLEAVE6 | FLOAT_TO_INT16_INTERLEAVE6 | ||||
| %undef pswapd | |||||
| INIT_MMX 3dnowext | INIT_MMX 3dnowext | ||||
| FLOAT_TO_INT16_INTERLEAVE6 | FLOAT_TO_INT16_INTERLEAVE6 | ||||
| @@ -277,7 +277,7 @@ static int load_glyph(AVFilterContext *ctx, Glyph **glyph_ptr, uint32_t code) | |||||
| FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox); | FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox); | ||||
| /* cache the newly created glyph */ | /* cache the newly created glyph */ | ||||
| if (!(node = av_mallocz(av_tree_node_size))) { | |||||
| if (!(node = av_tree_node_alloc())) { | |||||
| ret = AVERROR(ENOMEM); | ret = AVERROR(ENOMEM); | ||||
| goto error; | goto error; | ||||
| } | } | ||||
| @@ -158,9 +158,15 @@ | |||||
| * information will be in AVStream.time_base units, i.e. it has to be | * information will be in AVStream.time_base units, i.e. it has to be | ||||
| * multiplied by the timebase to convert them to seconds. | * multiplied by the timebase to convert them to seconds. | ||||
| * | * | ||||
| * The packet data belongs to the demuxer and is invalid after the next call to | |||||
| * av_read_frame(). The user must free the packet with av_free_packet() before | |||||
| * calling av_read_frame() again or closing the file. | |||||
| * If AVPacket.destruct is set on the returned packet, then the packet is | |||||
| * allocated dynamically and the user may keep it indefinitely. | |||||
| * Otherwise, if AVPacket.destruct is NULL, the packet data is backed by a | |||||
| * static storage somewhere inside the demuxer and the packet is only valid | |||||
| * until the next av_read_frame() call or closing the file. If the caller | |||||
| * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy | |||||
| * of it. | |||||
| * In both cases, the packet must be freed with av_free_packet() when it is no | |||||
| * longer needed. | |||||
| * | * | ||||
| * @section lavf_decoding_seek Seeking | * @section lavf_decoding_seek Seeking | ||||
| * @} | * @} | ||||
| @@ -1550,13 +1556,13 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt); | |||||
| * omit invalid data between valid frames so as to give the decoder the maximum | * omit invalid data between valid frames so as to give the decoder the maximum | ||||
| * information possible for decoding. | * information possible for decoding. | ||||
| * | * | ||||
| * The returned packet is valid | |||||
| * until the next av_read_frame() or until av_close_input_file() and | |||||
| * must be freed with av_free_packet. For video, the packet contains | |||||
| * exactly one frame. For audio, it contains an integer number of | |||||
| * frames if each frame has a known fixed size (e.g. PCM or ADPCM | |||||
| * data). If the audio frames have a variable size (e.g. MPEG audio), | |||||
| * then it contains one frame. | |||||
| * If pkt->destruct is NULL, then the packet is valid until the next | |||||
| * av_read_frame() or until av_close_input_file(). Otherwise the packet is valid | |||||
| * indefinitely. In both cases the packet must be freed with | |||||
| * av_free_packet when it is no longer needed. For video, the packet contains | |||||
| * exactly one frame. For audio, it contains an integer number of frames if each | |||||
| * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames | |||||
| * have a variable size (e.g. MPEG audio), then it contains one frame. | |||||
| * | * | ||||
| * pkt->pts, pkt->dts and pkt->duration are always set to correct | * pkt->pts, pkt->dts and pkt->duration are always set to correct | ||||
| * values in AVStream.time_base units (and guessed if the format cannot | * values in AVStream.time_base units (and guessed if the format cannot | ||||
| @@ -1724,10 +1730,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt); | |||||
| * @param s media file handle | * @param s media file handle | ||||
| * @param pkt The packet containing the data to be written. Libavformat takes | * @param pkt The packet containing the data to be written. Libavformat takes | ||||
| * ownership of the data and will free it when it sees fit using the packet's | * ownership of the data and will free it when it sees fit using the packet's | ||||
| * This can be NULL (at any time, not just at the end), to flush the | |||||
| * interleaving queues. | |||||
| * @ref AVPacket.destruct "destruct" field. The caller must not access the data | * @ref AVPacket.destruct "destruct" field. The caller must not access the data | ||||
| * after this function returns, as it may already be freed. | * after this function returns, as it may already be freed. | ||||
| * This can be NULL (at any time, not just at the end), to flush the | |||||
| * interleaving queues. | |||||
| * Packet's @ref AVPacket.stream_index "stream_index" field must be set to the | * Packet's @ref AVPacket.stream_index "stream_index" field must be set to the | ||||
| * index of the corresponding stream in @ref AVFormatContext.streams | * index of the corresponding stream in @ref AVFormatContext.streams | ||||
| * "s.streams". | * "s.streams". | ||||
| @@ -40,22 +40,6 @@ static struct { | |||||
| static AVCRC av_crc_table[AV_CRC_MAX][257]; | static AVCRC av_crc_table[AV_CRC_MAX][257]; | ||||
| #endif | #endif | ||||
| /** | |||||
| * Initialize a CRC table. | |||||
| * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 | |||||
| * @param le If 1, the lowest bit represents the coefficient for the highest | |||||
| * exponent of the corresponding polynomial (both for poly and | |||||
| * actual CRC). | |||||
| * If 0, you must swap the CRC parameter and the result of av_crc | |||||
| * if you need the standard representation (can be simplified in | |||||
| * most cases to e.g. bswap16): | |||||
| * av_bswap32(crc << (32-bits)) | |||||
| * @param bits number of bits for the CRC | |||||
| * @param poly generator polynomial without the x**bits coefficient, in the | |||||
| * representation as specified by le | |||||
| * @param ctx_size size of ctx in bytes | |||||
| * @return <0 on failure | |||||
| */ | |||||
| int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size) | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size) | ||||
| { | { | ||||
| unsigned i, j; | unsigned i, j; | ||||
| @@ -89,11 +73,6 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| /** | |||||
| * Get an initialized standard CRC table. | |||||
| * @param crc_id ID of a standard CRC | |||||
| * @return a pointer to the CRC table or NULL on failure | |||||
| */ | |||||
| const AVCRC *av_crc_get_table(AVCRCId crc_id) | const AVCRC *av_crc_get_table(AVCRCId crc_id) | ||||
| { | { | ||||
| #if !CONFIG_HARDCODED_TABLES | #if !CONFIG_HARDCODED_TABLES | ||||
| @@ -108,13 +87,6 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id) | |||||
| return av_crc_table[crc_id]; | return av_crc_table[crc_id]; | ||||
| } | } | ||||
| /** | |||||
| * Calculate the CRC of a block. | |||||
| * @param crc CRC of previous blocks if any or initial value for CRC | |||||
| * @return CRC updated with the data from the given block | |||||
| * | |||||
| * @see av_crc_init() "le" parameter | |||||
| */ | |||||
| uint32_t av_crc(const AVCRC *ctx, uint32_t crc, | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, | ||||
| const uint8_t *buffer, size_t length) | const uint8_t *buffer, size_t length) | ||||
| { | { | ||||
| @@ -36,8 +36,38 @@ typedef enum { | |||||
| AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ | ||||
| }AVCRCId; | }AVCRCId; | ||||
| /** | |||||
| * Initialize a CRC table. | |||||
| * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 | |||||
| * @param le If 1, the lowest bit represents the coefficient for the highest | |||||
| * exponent of the corresponding polynomial (both for poly and | |||||
| * actual CRC). | |||||
| * If 0, you must swap the CRC parameter and the result of av_crc | |||||
| * if you need the standard representation (can be simplified in | |||||
| * most cases to e.g. bswap16): | |||||
| * av_bswap32(crc << (32-bits)) | |||||
| * @param bits number of bits for the CRC | |||||
| * @param poly generator polynomial without the x**bits coefficient, in the | |||||
| * representation as specified by le | |||||
| * @param ctx_size size of ctx in bytes | |||||
| * @return <0 on failure | |||||
| */ | |||||
| int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); | ||||
| /** | |||||
| * Get an initialized standard CRC table. | |||||
| * @param crc_id ID of a standard CRC | |||||
| * @return a pointer to the CRC table or NULL on failure | |||||
| */ | |||||
| const AVCRC *av_crc_get_table(AVCRCId crc_id); | const AVCRC *av_crc_get_table(AVCRCId crc_id); | ||||
| /** | |||||
| * Calculate the CRC of a block. | |||||
| * @param crc CRC of previous blocks if any or initial value for CRC | |||||
| * @return CRC updated with the data from the given block | |||||
| * | |||||
| * @see av_crc_init() "le" parameter | |||||
| */ | |||||
| uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure; | uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure; | ||||
| #endif /* AVUTIL_CRC_H */ | #endif /* AVUTIL_CRC_H */ | ||||
| @@ -319,6 +319,18 @@ | |||||
| %endif | %endif | ||||
| %endmacro | %endmacro | ||||
| %macro PSWAPD 2 | |||||
| %if cpuflag(mmxext) | |||||
| pshufw %1, %2, q1032 | |||||
| %elif cpuflag(3dnowext) | |||||
| pswapd %1, %2 | |||||
| %elif cpuflag(3dnow) | |||||
| movq %1, %2 | |||||
| psrlq %1, 32 | |||||
| punpckldq %1, %2 | |||||
| %endif | |||||
| %endmacro | |||||
| %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from | %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from | ||||
| %ifnum %5 | %ifnum %5 | ||||
| pand m%3, m%5, m%4 ; src .. y6 .. y4 | pand m%3, m%5, m%4 ; src .. y6 .. y4 | ||||