aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-03 14:23:36 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-03 14:24:11 +0100
commit37e81996dcf3452c48dd134877bf10b5060dacb3 (patch)
tree46c9098620c5d3a73823b283e747eb23d95b8606 /libavutil
parent1885ffb03d0af28e6bac2bcc8725fa15b93f6ac9 (diff)
parent9221efef7968463f3e3d9ce79ea72eaca082e73f (diff)
downloadffmpeg-37e81996dcf3452c48dd134877bf10b5060dacb3.tar.gz
Merge commit '9221efef7968463f3e3d9ce79ea72eaca082e73f'
* 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>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/crc.c28
-rw-r--r--libavutil/crc.h30
-rw-r--r--libavutil/x86/x86util.asm12
3 files changed, 42 insertions, 28 deletions
diff --git a/libavutil/crc.c b/libavutil/crc.c
index d640184876..bba8cb10a5 100644
--- a/libavutil/crc.c
+++ b/libavutil/crc.c
@@ -40,22 +40,6 @@ static struct {
static AVCRC av_crc_table[AV_CRC_MAX][257];
#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)
{
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;
}
-/**
- * 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)
{
#if !CONFIG_HARDCODED_TABLES
@@ -108,13 +87,6 @@ const AVCRC *av_crc_get_table(AVCRCId 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,
const uint8_t *buffer, size_t length)
{
diff --git a/libavutil/crc.h b/libavutil/crc.h
index 12650542ba..9095ce6c62 100644
--- a/libavutil/crc.h
+++ b/libavutil/crc.h
@@ -36,8 +36,38 @@ typedef enum {
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
}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);
+
+/**
+ * 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);
+
+/**
+ * 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;
#endif /* AVUTIL_CRC_H */
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index ade21c68bb..df2ceccdce 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -319,6 +319,18 @@
%endif
%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
%ifnum %5
pand m%3, m%5, m%4 ; src .. y6 .. y4