summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-13 00:39:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-13 00:39:19 +0200
commitca19862d3879dfadfd6c1a1a443eac40fc433385 (patch)
treedc114d719849d6c3645063e02378dfddecbc991a
parent5eeecde859ebfa384fbe3c8a1aa62a6b8f6c58e4 (diff)
parent18e8fef7c9292041e3266487d9bc6b59e5eaa798 (diff)
downloadffmpeg-ca19862d3879dfadfd6c1a1a443eac40fc433385.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: libxvid: remove disabled code qdm2: make a table static const qdm2: simplify bitstream reader setup for some subpacket types qdm2: use get_bits_left() build: Consistently handle conditional compilation for all optimization OBJS. avpacket, bfi, bgmc, rawenc: K&R prettyprinting cosmetics msrle: convert MS RLE decoding function to bytestream2. x86inc improvements for 64-bit Conflicts: common.mak libavcodec/avpacket.c libavcodec/bfi.c libavcodec/msrledec.c libavcodec/qdm2.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--Makefile3
-rw-r--r--arch.mak13
-rw-r--r--common.mak2
-rw-r--r--libavcodec/aasc.c12
-rw-r--r--libavcodec/arm/Makefile13
-rw-r--r--libavcodec/avpacket.c112
-rw-r--r--libavcodec/bfi.c34
-rw-r--r--libavcodec/bgmc.c732
-rw-r--r--libavcodec/bmp.c4
-rw-r--r--libavcodec/libxvid_rc.c4
-rw-r--r--libavcodec/mips/Makefile6
-rw-r--r--libavcodec/msrle.c4
-rw-r--r--libavcodec/msrledec.c133
-rw-r--r--libavcodec/msrledec.h8
-rw-r--r--libavcodec/ppc/Makefile3
-rw-r--r--libavcodec/qdm2.c94
-rw-r--r--libavcodec/sparc/Makefile4
-rw-r--r--libavcodec/tscc.c8
-rw-r--r--libavcodec/x86/Makefile5
-rw-r--r--libavcodec/x86/diracdsp_yasm.asm8
-rw-r--r--libavcodec/x86/dsputil_yasm.asm36
-rw-r--r--libavcodec/x86/fft_mmx.asm25
-rw-r--r--libavcodec/x86/fmtconvert.asm6
-rw-r--r--libavcodec/x86/h264_chromamc.asm48
-rw-r--r--libavcodec/x86/h264_deblock.asm60
-rw-r--r--libavcodec/x86/h264_idct.asm156
-rw-r--r--libavcodec/x86/h264_idct_10bit.asm24
-rw-r--r--libavcodec/x86/h264_intrapred.asm30
-rw-r--r--libavcodec/x86/h264_qpel_10bit.asm20
-rw-r--r--libavcodec/x86/h264_weight.asm14
-rw-r--r--libavformat/rawenc.c72
-rw-r--r--libavutil/x86/x86inc.asm218
-rw-r--r--libswscale/Makefile8
-rw-r--r--libswscale/x86/output.asm4
-rw-r--r--libswscale/x86/scale.asm18
35 files changed, 960 insertions, 981 deletions
diff --git a/Makefile b/Makefile
index 3bb4112c1a..2c728104a7 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,8 @@ config.h: .config
SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
- ALTIVEC-OBJS ARMV6-OBJS MMX-OBJS NEON-OBJS YASM-OBJS \
+ ALTIVEC-OBJS ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS MMI-OBJS \
+ MMX-OBJS NEON-OBJS VIS-OBJS YASM-OBJS \
OBJS TESTOBJS
define RESET
diff --git a/arch.mak b/arch.mak
new file mode 100644
index 0000000000..33018f37f7
--- /dev/null
+++ b/arch.mak
@@ -0,0 +1,13 @@
+OBJS-$(HAVE_ARMV5TE) += $(ARMV5TE-OBJS) $(ARMV5TE-OBJS-yes)
+OBJS-$(HAVE_ARMV6) += $(ARMV6-OBJS) $(ARMV6-OBJS-yes)
+OBJS-$(HAVE_ARMVFP) += $(ARMVFP-OBJS) $(ARMVFP-OBJS-yes)
+OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-OBJS-yes)
+
+OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes)
+
+OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
+
+OBJS-$(HAVE_VIS) += $(VIS-OBJS) $(VIS-OBJS-yes)
+
+OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
+OBJS-$(HAVE_YASM) += $(YASM-OBJS) $(YASM-OBJS-yes)
diff --git a/common.mak b/common.mak
index b7786c5c67..b47b19f42f 100644
--- a/common.mak
+++ b/common.mak
@@ -73,7 +73,7 @@ COMPILE_S = $(call COMPILE,AS)
$(OBJS):
endif
-OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
+include $(SRC_PATH)/arch.mak
OBJS += $(OBJS-yes)
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c
index a115718a39..c2758229b3 100644
--- a/libavcodec/aasc.c
+++ b/libavcodec/aasc.c
@@ -34,17 +34,10 @@
typedef struct AascContext {
AVCodecContext *avctx;
+ GetByteContext gb;
AVFrame frame;
} AascContext;
-#define FETCH_NEXT_STREAM_BYTE() \
- if (stream_ptr >= buf_size) \
- { \
- av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (fetch)\n"); \
- break; \
- } \
- stream_byte = buf[stream_ptr++];
-
static av_cold int aasc_decode_init(AVCodecContext *avctx)
{
AascContext *s = avctx->priv_data;
@@ -89,7 +82,8 @@ static int aasc_decode_frame(AVCodecContext *avctx,
}
break;
case 1:
- ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, buf - 4, buf_size + 4);
+ bytestream2_init(&s->gb, buf - 4, buf_size + 4);
+ ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 39852c4f4a..8b96232468 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -28,21 +28,19 @@ OBJS += arm/dsputil_init_arm.o \
arm/mpegvideo_arm.o \
arm/simple_idct_arm.o \
-OBJS-$(HAVE_ARMV5TE) += arm/dsputil_init_armv5te.o \
+ARMV5TE-OBJS += arm/dsputil_init_armv5te.o \
arm/mpegvideo_armv5te.o \
arm/mpegvideo_armv5te_s.o \
arm/simple_idct_armv5te.o \
-OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \
+ARMV6-OBJS += arm/dsputil_init_armv6.o \
arm/dsputil_armv6.o \
arm/simple_idct_armv6.o \
- $(ARMV6-OBJS-yes)
-VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \
+ARMVFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o
-OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \
+ARMVFP-OBJS += arm/dsputil_vfp.o \
arm/dsputil_init_vfp.o \
- $(VFP-OBJS-yes)
NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \
arm/fft_fixed_neon.o \
@@ -84,10 +82,9 @@ NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_neon.o \
NEON-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_neon.o
-OBJS-$(HAVE_NEON) += arm/dsputil_init_neon.o \
+NEON-OBJS += arm/dsputil_init_neon.o \
arm/dsputil_neon.o \
arm/fmtconvert_neon.o \
arm/int_neon.o \
arm/mpegvideo_neon.o \
arm/simple_idct_neon.o \
- $(NEON-OBJS-yes)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 425b040b6c..a8e5c643c9 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -19,14 +19,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "avcodec.h"
#include "internal.h"
#include "libavutil/avassert.h"
#include "bytestream.h"
+#include "avcodec.h"
void av_destruct_packet_nofree(AVPacket *pkt)
{
- pkt->data = NULL; pkt->size = 0;
+ pkt->data = NULL;
+ pkt->size = 0;
pkt->side_data = NULL;
pkt->side_data_elems = 0;
}
@@ -43,47 +44,49 @@ void ff_packet_free_side_data(AVPacket *pkt)
void av_destruct_packet(AVPacket *pkt)
{
av_free(pkt->data);
- pkt->data = NULL; pkt->size = 0;
+ pkt->data = NULL;
+ pkt->size = 0;
ff_packet_free_side_data(pkt);
}
void av_init_packet(AVPacket *pkt)
{
- pkt->pts = AV_NOPTS_VALUE;
- pkt->dts = AV_NOPTS_VALUE;
- pkt->pos = -1;
- pkt->duration = 0;
+ pkt->pts = AV_NOPTS_VALUE;
+ pkt->dts = AV_NOPTS_VALUE;
+ pkt->pos = -1;
+ pkt->duration = 0;
pkt->convergence_duration = 0;
- pkt->flags = 0;
- pkt->stream_index = 0;
- pkt->destruct= NULL;
- pkt->side_data = NULL;
- pkt->side_data_elems = 0;
+ pkt->flags = 0;
+ pkt->stream_index = 0;
+ pkt->destruct = NULL;
+ pkt->side_data = NULL;
+ pkt->side_data_elems = 0;
}
int av_new_packet(AVPacket *pkt, int size)
{
- uint8_t *data= NULL;
- if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
+ uint8_t *data = NULL;
+ if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (data){
+ if (data) {
memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- }else
- size=0;
+ } else
+ size = 0;
av_init_packet(pkt);
- pkt->data = data;
- pkt->size = size;
+ pkt->data = data;
+ pkt->size = size;
pkt->destruct = av_destruct_packet;
- if(!data)
+ if (!data)
return AVERROR(ENOMEM);
return 0;
}
void av_shrink_packet(AVPacket *pkt, int size)
{
- if (pkt->size <= size) return;
+ if (pkt->size <= size)
+ return;
pkt->size = size;
memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
@@ -94,40 +97,45 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
av_assert0((unsigned)pkt->size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
if (!pkt->size)
return av_new_packet(pkt, grow_by);
- if ((unsigned)grow_by > INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE))
+ if ((unsigned)grow_by >
+ INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE))
return -1;
- new_ptr = av_realloc(pkt->data, pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE);
+ new_ptr = av_realloc(pkt->data,
+ pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE);
if (!new_ptr)
return AVERROR(ENOMEM);
- pkt->data = new_ptr;
+ pkt->data = new_ptr;
pkt->size += grow_by;
memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
return 0;
}
-#define DUP_DATA(dst, src, size, padding) \
- do { \
- void *data; \
- if (padding) { \
- if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
- goto failed_alloc; \
- data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
- } else { \
- data = av_malloc(size); \
- } \
- if (!data) \
- goto failed_alloc; \
- memcpy(data, src, size); \
- if (padding) \
- memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \
- dst = data; \
- } while(0)
+#define DUP_DATA(dst, src, size, padding) \
+ do { \
+ void *data; \
+ if (padding) { \
+ if ((unsigned)(size) > \
+ (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
+ goto failed_alloc; \
+ data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
+ } else { \
+ data = av_malloc(size); \
+ } \
+ if (!data) \
+ goto failed_alloc; \
+ memcpy(data, src, size); \
+ if (padding) \
+ memset((uint8_t *)data + size, 0, \
+ FF_INPUT_BUFFER_PADDING_SIZE); \
+ dst = data; \
+ } while (0)
int av_dup_packet(AVPacket *pkt)
{
AVPacket tmp_pkt;
- if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
+ if (((pkt->destruct == av_destruct_packet_nofree) ||
+ (pkt->destruct == NULL)) && pkt->data) {
tmp_pkt = *pkt;
pkt->data = NULL;
@@ -140,14 +148,15 @@ int av_dup_packet(AVPacket *pkt)
DUP_DATA(pkt->side_data, tmp_pkt.side_data,
pkt->side_data_elems * sizeof(*pkt->side_data), 0);
- memset(pkt->side_data, 0, pkt->side_data_elems * sizeof(*pkt->side_data));
- for (i = 0; i < pkt->side_data_elems; i++) {
+ memset(pkt->side_data, 0,
+ pkt->side_data_elems * sizeof(*pkt->side_data));
+ for (i = 0; i < pkt->side_data_elems; i++)
DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data,
pkt->side_data[i].size, 1);
- }
}
}
return 0;
+
failed_alloc:
av_destruct_packet(pkt);
return AVERROR(ENOMEM);
@@ -156,14 +165,16 @@ failed_alloc:
void av_free_packet(AVPacket *pkt)
{
if (pkt) {
- if (pkt->destruct) pkt->destruct(pkt);
- pkt->data = NULL; pkt->size = 0;
+ if (pkt->destruct)
+ pkt->destruct(pkt);
+ pkt->data = NULL;
+ pkt->size = 0;
pkt->side_data = NULL;
pkt->side_data_elems = 0;
}
}
-uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
int size)
{
int elems = pkt->side_data_elems;
@@ -173,7 +184,8 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
return NULL;
- pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data));
+ pkt->side_data = av_realloc(pkt->side_data,
+ (elems + 1) * sizeof(*pkt->side_data));
if (!pkt->side_data)
return NULL;
@@ -187,7 +199,7 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
return pkt->side_data[elems].data;
}
-uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
int *size)
{
int i;
diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
index 66313b0bb9..a47269aae2 100644
--- a/libavcodec/bfi.c
+++ b/libavcodec/bfi.c
@@ -40,9 +40,9 @@ typedef struct BFIContext {
static av_cold int bfi_decode_init(AVCodecContext *avctx)
{
BFIContext *bfi = avctx->priv_data;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = PIX_FMT_PAL8;
avcodec_get_frame_defaults(&bfi->frame);
- bfi->dst = av_mallocz(avctx->width * avctx->height);
+ bfi->dst = av_mallocz(avctx->width * avctx->height);
return 0;
}
@@ -50,9 +50,9 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
GetByteContext g;
- int buf_size = avpkt->size;
+ int buf_size = avpkt->size;
BFIContext *bfi = avctx->priv_data;
- uint8_t *dst = bfi->dst;
+ uint8_t *dst = bfi->dst;
uint8_t *src, *dst_offset, colour1, colour2;
uint8_t *frame_end = bfi->dst + avctx->width * avctx->height;
uint32_t *pal;
@@ -84,9 +84,8 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
int shift = 16;
*pal = 0xFF << 24;
for (j = 0; j < 3; j++, shift -= 8)
- *pal +=
- ((avctx->extradata[i * 3 + j] << 2) |
- (avctx->extradata[i * 3 + j] >> 4)) << shift;
+ *pal += ((avctx->extradata[i * 3 + j] << 2) |
+ (avctx->extradata[i * 3 + j] >> 4)) << shift;
pal++;
}
memcpy(bfi->pal, bfi->frame.data[1], sizeof(bfi->pal));
@@ -112,7 +111,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
return -1;
}
- /* Get length and offset(if required) */
+ /* Get length and offset (if required) */
if (length == 0) {
if (code == 1) {
length = bytestream2_get_byte(&g);
@@ -132,8 +131,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
break;
switch (code) {
-
- case 0: //Normal Chain
+ case 0: // normal chain
if (length >= bytestream2_get_bytes_left(&g)) {
av_log(avctx, AV_LOG_ERROR, "Frame larger than buffer.\n");
return -1;
@@ -141,21 +139,18 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
bytestream2_get_buffer(&g, dst, length);
dst += length;
break;
-
- case 1: //Back Chain
+ case 1: // back chain
dst_offset = dst - offset;
- length *= 4; //Convert dwords to bytes.
+ length *= 4; // Convert dwords to bytes.
if (dst_offset < bfi->dst)
break;
while (length--)
*dst++ = *dst_offset++;
break;
-
- case 2: //Skip Chain
+ case 2: // skip chain
dst += length;
break;
-
- case 3: //Fill Chain
+ case 3: // fill chain
colour1 = bytestream2_get_byte(&g);
colour2 = bytestream2_get_byte(&g);
while (length--) {
@@ -163,7 +158,6 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
*dst++ = colour2;
}
break;
-
}
}
@@ -174,12 +168,12 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
src += avctx->width;
dst += bfi->frame.linesize[0];
}
- *data_size = sizeof(AVFrame);
+ *data_size = sizeof(AVFrame);
*(AVFrame *)data = bfi->frame;
return buf_size;
}
-static av_cold int bfi_decode_close(AVCodecContext * avctx)
+static av_cold int bfi_decode_close(AVCodecContext *avctx)
{
BFIContext *bfi = avctx->priv_data;
if (bfi->frame.data[0])
diff --git a/libavcodec/bgmc.c b/libavcodec/bgmc.c
index 772a0af254..e4f937cac1 100644
--- a/libavcodec/bgmc.c
+++ b/libavcodec/bgmc.c
@@ -25,10 +25,8 @@
* @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
*/
-
#include "bgmc.h"
-
#define FREQ_BITS 14 // bits used by frequency counters
#define VALUE_BITS 18 // bits used to represent the values
#define TOP_VALUE ((1 << VALUE_BITS) - 1) // maximum value
@@ -41,382 +39,381 @@
#define LUT_BUFF 4 // number of buffered lookup tables
-/** Cumulative frequency tables for block Gilbert-Moore coding.
- */
+/** Cumulative frequency tables for block Gilbert-Moore coding. */
static const uint16_t cf_tables_1[3][129] = {
{
- 16384, 16066, 15748, 15431, 15114, 14799, 14485, 14173, 13861, 13552,
- 13243, 12939, 12635, 12336, 12038, 11745, 11452, 11161, 10870, 10586,
- 10303, 10027, 9751, 9483, 9215, 8953, 8692, 8440, 8189, 7946,
- 7704, 7472, 7240, 7008, 6776, 6554, 6333, 6122, 5912, 5711,
- 5512, 5320, 5128, 4947, 4766, 4595, 4425, 4264, 4104, 3946,
- 3788, 3640, 3493, 3355, 3218, 3090, 2963, 2842, 2721, 2609,
- 2498, 2395, 2292, 2196, 2100, 2004, 1908, 1820, 1732, 1651,
- 1570, 1497, 1424, 1355, 1287, 1223, 1161, 1100, 1044, 988,
- 938, 888, 839, 790, 746, 702, 662, 623, 588, 553,
- 520, 488, 459, 431, 405, 380, 357, 334, 311, 288,
- 268, 248, 230, 213, 197, 182, 168, 154, 142, 130,
- 119, 108, 99, 90, 81, 72, 64, 56, 49, 42,
- 36, 30, 25, 20, 15, 11, 7, 3, 0
- },
- {
- 16384, 16080, 15776, 15473, 15170, 14868, 14567, 14268, 13970, 13674,
- 13378, 13086, 12794, 12505, 12218, 11936, 11654, 11373, 11092, 10818,
- 10544, 10276, 10008, 9749, 9490, 9236, 8982, 8737, 8492, 8256,
- 8020, 7792, 7564, 7336, 7108, 6888, 6669, 6459, 6249, 6050,
- 5852, 5660, 5468, 5286, 5104, 4931, 4760, 4598, 4436, 4275,
- 4115, 3965, 3816, 3674, 3534, 3403, 3272, 3147, 3023, 2907,
- 2792, 2684, 2577, 2476, 2375, 2274, 2173, 2079, 1986, 1897,
- 1810, 1724, 1645, 1567, 1493, 1419, 1351, 1284, 1222, 1161,
- 1105, 1050, 995, 941, 891, 842, 797, 753, 713, 673,
- 636, 599, 566, 533, 503, 473, 446, 419, 392, 365,
- 340, 316, 294, 272, 253, 234, 216, 199, 184, 169,
- 155, 142, 130, 118, 106, 95, 85, 75, 66, 57,
- 49, 41, 34, 27, 21, 15, 10, 5, 0
- },
- {
- 16384, 16092, 15801, 15510, 15219, 14930, 14641, 14355, 14069, 13785,
- 13501, 13219, 12938, 12661, 12384, 12112, 11841, 11571, 11301, 11037,
- 10773, 10514, 10256, 10005, 9754, 9508, 9263, 9025, 8787, 8557,
- 8327, 8103, 7879, 7655, 7431, 7215, 7000, 6792, 6585, 6387,
- 6190, 5998, 5807, 5625, 5445, 5272, 5100, 4937, 4774, 4613,
- 4452, 4301, 4150, 4007, 3865, 3731, 3597, 3469, 3341, 3218,
- 3099, 2981, 2869, 2758, 2652, 2546, 2440, 2334, 2234, 2134,
- 2041, 1949, 1864, 1779, 1699, 1620, 1547, 1474, 1407, 1340,
- 1278, 1217, 1157, 1097, 1043, 989, 940, 891, 846, 801,
- 759, 718, 680, 643, 609, 575, 543, 511, 479, 447,
- 418, 389, 363, 337, 314, 291, 270, 249, 230, 212,
- 195, 179, 164, 149, 135, 121, 108, 96, 85, 74,
- 64, 54, 45, 36, 28, 20, 13, 6, 0
- }
+ 16384, 16066, 15748, 15431, 15114, 14799, 14485, 14173, 13861, 13552,
+ 13243, 12939, 12635, 12336, 12038, 11745, 11452, 11161, 10870, 10586,
+ 10303, 10027, 9751, 9483, 9215, 8953, 8692, 8440, 8189, 7946,
+ 7704, 7472, 7240, 7008, 6776, 6554, 6333, 6122, 5912, 5711,
+ 5512, 5320, 5128, 4947, 4766, 4595, 4425, 4264, 4104, 3946,
+ 3788, 3640, 3493, 3355, 3218, 3090, 2963, 2842, 2721, 2609,
+ 2498, 2395, 2292, 2196, 2100, 2004, 1908, 1820, 1732, 1651,
+ 1570, 1497, 1424, 1355, 1287, 1223, 1161, 1100, 1044, 988,
+ 938, 888, 839, 790, 746, 702, 662, 623, 588, 553,
+ 520, 488, 459, 431, 405, 380, 357, 334, 311, 288,
+ 268, 248, 230, 213, 197, 182, 168, 154, 142, 130,
+ 119, 108, 99, 90, 81, 72, 64, 56, 49, 42,
+ 36, 30, 25, 20, 15, 11, 7, 3, 0
+ },
+ {
+ 16384, 16080, 15776, 15473, 15170, 14868, 14567, 14268, 13970, 13674,
+ 13378, 13086, 12794, 12505, 12218, 11936, 11654, 11373, 11092, 10818,
+ 10544, 10276, 10008, 9749, 9490, 9236, 8982, 8737, 8492, 8256,
+ 8020, 7792, 7564, 7336, 7108, 6888, 6669, 6459, 6249, 6050,
+ 5852, 5660, 5468, 5286, 5104, 4931, 4760, 4598, 4436, 4275,
+ 4115, 3965, 3816, 3674, 3534, 3403, 3272, 3147, 3023, 2907,
+ 2792, 2684, 2577, 2476, 2375, 2274, 2173, 2079, 1986, 1897,
+ 1810, 1724, 1645, 1567, 1493, 1419, 1351, 1284, 1222, 1161,
+ 1105, 1050, 995, 941, 891, 842, 797, 753, 713, 673,
+ 636, 599, 566, 533, 503, 473, 446, 419, 392, 365,
+ 340, 316, 294, 272, 253, 234, 216, 199, 184, 169,
+ 155, 142, 130, 118, 106, 95, 85, 75, 66, 57,
+ 49, 41, 34, 27, 21, 15, 10, 5, 0
+ },
+ {
+ 16384, 16092, 15801, 15510, 15219, 14930, 14641, 14355, 14069, 13785,
+ 13501, 13219, 12938, 12661, 12384, 12112, 11841, 11571, 11301, 11037,
+ 10773, 10514, 10256, 10005, 9754, 9508, 9263, 9025, 8787, 8557,
+ 8327, 8103, 7879, 7655, 7431, 7215, 7000, 6792, 6585, 6387,
+ 6190, 5998, 5807, 5625, 5445, 5272, 5100, 4937, 4774, 4613,
+ 4452, 4301, 4150, 4007, 3865, 3731, 3597, 3469, 3341, 3218,
+ 3099, 2981, 2869, 2758, 2652, 2546, 2440, 2334, 2234, 2134,
+ 2041, 1949, 1864, 1779, 1699, 1620, 1547, 1474, 1407, 1340,
+ 1278, 1217, 1157, 1097, 1043, 989, 940, 891, 846, 801,
+ 759, 718, 680, 643, 609, 575, 543, 511, 479, 447,
+ 418, 389, 363, 337, 314, 291, 270, 249, 230, 212,
+ 195, 179, 164, 149, 135, 121, 108, 96, 85, 74,
+ 64, 54, 45, 36, 28, 20, 13, 6, 0
+ }
};
static const uint16_t cf_tables_2[8][193] = {
{
- 16384, 16104, 15825, 15546, 15268, 14991, 14714, 14439, 14164, 13891,
- 13620, 13350, 13081, 12815, 12549, 12287, 12025, 11765, 11505, 11250,
- 10996, 10746, 10497, 10254, 10011, 9772, 9534, 9303, 9072, 8848,
- 8624, 8406, 8188, 7970, 7752, 7539, 7327, 7123, 6919, 6724,
- 6529, 6339, 6150, 5970, 5790, 5618, 5446, 5282, 5119, 4957,
- 4795, 4642, 4490, 4345, 4201, 4065, 3929, 3798, 3669, 3547,
- 3425, 3310, 3196, 3086, 2976, 2866, 2756, 2650, 2545, 2447,
- 2350, 2260, 2170, 2085, 2000, 1921, 1843, 1770, 1698, 1632,
- 1566, 1501, 1436, 1376, 1316, 1261, 1207, 1157, 1108, 1061,
- 1015, 973, 931, 893, 855, 819, 783, 747, 711, 677,
- 644, 614, 584, 557, 530, 505, 480, 458, 436, 416,
- 396, 378, 360, 343, 326, 310, 295, 281, 267, 255,
- 243, 232, 221, 211, 201, 192, 183, 174, 166, 158,
- 150, 142, 134, 126, 119, 112, 106, 100, 95, 90,
- 85, 80, 76, 72, 69, 66, 63, 60, 57, 54,
- 51, 48, 46, 44, 42, 40, 38, 36, 34, 33,
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
- 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16104, 15825, 15546, 15268, 14991, 14714, 14439, 14164, 13891,
+ 13620, 13350, 13081, 12815, 12549, 12287, 12025, 11765, 11505, 11250,
+ 10996, 10746, 10497, 10254, 10011, 9772, 9534, 9303, 9072, 8848,
+ 8624, 8406, 8188, 7970, 7752, 7539, 7327, 7123, 6919, 6724,
+ 6529, 6339, 6150, 5970, 5790, 5618, 5446, 5282, 5119, 4957,
+ 4795, 4642, 4490, 4345, 4201, 4065, 3929, 3798, 3669, 3547,
+ 3425, 3310, 3196, 3086, 2976, 2866, 2756, 2650, 2545, 2447,
+ 2350, 2260, 2170, 2085, 2000, 1921, 1843, 1770, 1698, 1632,
+ 1566, 1501, 1436, 1376, 1316, 1261, 1207, 1157, 1108, 1061,
+ 1015, 973, 931, 893, 855, 819, 783, 747, 711, 677,
+ 644, 614, 584, 557, 530, 505, 480, 458, 436, 416,
+ 396, 378, 360, 343, 326, 310, 295, 281, 267, 255,
+ 243, 232, 221, 211, 201, 192, 183, 174, 166, 158,
+ 150, 142, 134, 126, 119, 112, 106, 100, 95, 90,
+ 85, 80, 76, 72, 69, 66, 63, 60, 57, 54,
+ 51, 48, 46, 44, 42, 40, 38, 36, 34, 33,
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
+ 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16116, 15849, 15582, 15316, 15050, 14785, 14521, 14257, 13995,
- 13734, 13476, 13218, 12963, 12708, 12457, 12206, 11956, 11706, 11460,
- 11215, 10975, 10735, 10500, 10265, 10034, 9803, 9579, 9355, 9136,
- 8917, 8703, 8489, 8275, 8061, 7853, 7645, 7444, 7244, 7051,
- 6858, 6671, 6484, 6305, 6127, 5956, 5785, 5622, 5459, 5298,
- 5137, 4983, 4830, 4684, 4539, 4401, 4263, 4131, 3999, 3874,
- 3750, 3632, 3515, 3401, 3287, 3173, 3059, 2949, 2840, 2737,
- 2635, 2539, 2444, 2354, 2264, 2181, 2098, 2020, 1943, 1872,
- 1801, 1731, 1661, 1596, 1532, 1472, 1412, 1357, 1303, 1251,
- 1200, 1153, 1106, 1063, 1020, 979, 938, 897, 856, 818,
- 780, 746, 712, 681, 650, 621, 592, 566, 540, 517,
- 494, 473, 452, 431, 410, 391, 373, 356, 340, 325,
- 310, 296, 282, 270, 258, 247, 236, 225, 214, 203,
- 192, 182, 172, 162, 153, 144, 136, 128, 121, 114,
- 108, 102, 97, 92, 87, 82, 77, 73, 69, 65,
- 62, 59, 56, 53, 50, 47, 45, 43, 41, 39,
- 37, 35, 33, 31, 29, 27, 26, 25, 24, 23,
- 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16116, 15849, 15582, 15316, 15050, 14785, 14521, 14257, 13995,
+ 13734, 13476, 13218, 12963, 12708, 12457, 12206, 11956, 11706, 11460,
+ 11215, 10975, 10735, 10500, 10265, 10034, 9803, 9579, 9355, 9136,
+ 8917, 8703, 8489, 8275, 8061, 7853, 7645, 7444, 7244, 7051,
+ 6858, 6671, 6484, 6305, 6127, 5956, 5785, 5622, 5459, 5298,
+ 5137, 4983, 4830, 4684, 4539, 4401, 4263, 4131, 3999, 3874,
+ 3750, 3632, 3515, 3401, 3287, 3173, 3059, 2949, 2840, 2737,
+ 2635, 2539, 2444, 2354, 2264, 2181, 2098, 2020, 1943, 1872,
+ 1801, 1731, 1661, 1596, 1532, 1472, 1412, 1357, 1303, 1251,
+ 1200, 1153, 1106, 1063, 1020, 979, 938, 897, 856, 818,
+ 780, 746, 712, 681, 650, 621, 592, 566, 540, 517,
+ 494, 473, 452, 431, 410, 391, 373, 356, 340, 325,
+ 310, 296, 282, 270, 258, 247, 236, 225, 214, 203,
+ 192, 182, 172, 162, 153, 144, 136, 128, 121, 114,
+ 108, 102, 97, 92, 87, 82, 77, 73, 69, 65,
+ 62, 59, 56, 53, 50, 47, 45, 43, 41, 39,
+ 37, 35, 33, 31, 29, 27, 26, 25, 24, 23,
+ 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16128, 15872, 15617, 15362, 15107, 14853, 14600, 14347, 14096,
- 13846, 13597, 13350, 13105, 12860, 12618, 12376, 12135, 11894, 11657,
- 11421, 11189, 10957, 10730, 10503, 10279, 10056, 9838, 9620, 9407,
- 9195, 8987, 8779, 8571, 8363, 8159, 7955, 7758, 7561, 7371,
- 7182, 6997, 6812, 6635, 6459, 6289, 6120, 5957, 5795, 5634,
- 5473, 5319, 5165, 5018, 4871, 4732, 4593, 4458, 4324, 4197,
- 4071, 3951, 3831, 3714, 3597, 3480, 3363, 3250, 3138, 3032,
- 2927, 2828, 2729, 2635, 2541, 2453, 2366, 2284, 2202, 2126,
- 2050, 1975, 1900, 1830, 1761, 1697, 1633, 1574, 1515, 1459,
- 1403, 1351, 1300, 1252, 1205, 1160, 1115, 1070, 1025, 982,
- 939, 899, 860, 824, 789, 756, 723, 693, 663, 636,
- 609, 584, 559, 535, 511, 489, 467, 447, 427, 409,
- 391, 374, 358, 343, 328, 313, 300, 287, 274, 261,
- 248, 235, 223, 211, 200, 189, 179, 169, 160, 151,
- 143, 135, 128, 121, 115, 109, 103, 97, 92, 87,
- 82, 77, 73, 69, 65, 61, 58, 55, 52, 49,
- 46, 43, 40, 37, 35, 33, 31, 29, 27, 25,
- 23, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16128, 15872, 15617, 15362, 15107, 14853, 14600, 14347, 14096,
+ 13846, 13597, 13350, 13105, 12860, 12618, 12376, 12135, 11894, 11657,
+ 11421, 11189, 10957, 10730, 10503, 10279, 10056, 9838, 9620, 9407,
+ 9195, 8987, 8779, 8571, 8363, 8159, 7955, 7758, 7561, 7371,
+ 7182, 6997, 6812, 6635, 6459, 6289, 6120, 5957, 5795, 5634,
+ 5473, 5319, 5165, 5018, 4871, 4732, 4593, 4458, 4324, 4197,
+ 4071, 3951, 3831, 3714, 3597, 3480, 3363, 3250, 3138, 3032,
+ 2927, 2828, 2729, 2635, 2541, 2453, 2366, 2284, 2202, 2126,
+ 2050, 1975, 1900, 1830, 1761, 1697, 1633, 1574, 1515, 1459,
+ 1403, 1351, 1300, 1252, 1205, 1160, 1115, 1070, 1025, 982,
+ 939, 899, 860, 824, 789, 756, 723, 693, 663, 636,
+ 609, 584, 559, 535, 511, 489, 467, 447, 427, 409,
+ 391, 374, 358, 343, 328, 313, 300, 287, 274, 261,
+ 248, 235, 223, 211, 200, 189, 179, 169, 160, 151,
+ 143, 135, 128, 121, 115, 109, 103, 97, 92, 87,
+ 82, 77, 73, 69, 65, 61, 58, 55, 52, 49,
+ 46, 43, 40, 37, 35, 33, 31, 29, 27, 25,
+ 23, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16139, 15894, 15649, 15405, 15162, 14919, 14677, 14435, 14195,
- 13955, 13717, 13479, 13243, 13008, 12775, 12542, 12310, 12079, 11851,
- 11623, 11399, 11176, 10956, 10737, 10521, 10305, 10094, 9883, 9677,
- 9471, 9268, 9065, 8862, 8659, 8459, 8260, 8067, 7874, 7688,
- 7502, 7321, 7140, 6965, 6790, 6621, 6452, 6290, 6128, 5968,
- 5808, 5655, 5503, 5356, 5209, 5069, 4929, 4794, 4660, 4532,
- 4404, 4282, 4160, 4041, 3922, 3803, 3684, 3568, 3452, 3343,
- 3234, 3131, 3029, 2931, 2833, 2741, 2649, 2563, 2477, 2396,
- 2316, 2236, 2157, 2083, 2009, 1940, 1871, 1807, 1743, 1683,
- 1623, 1567, 1511, 1459, 1407, 1357, 1307, 1257, 1207, 1159,
- 1111, 1067, 1023, 983, 943, 905, 868, 834, 800, 769,
- 738, 709, 681, 653, 625, 600, 575, 552, 529, 508,
- 487, 466, 447, 428, 410, 392, 376, 360, 344, 328,
- 313, 298, 283, 268, 255, 242, 230, 218, 207, 196,
- 186, 176, 167, 158, 150, 142, 135, 128, 121, 114,
- 108, 102, 97, 92, 87, 82, 78, 74, 70, 66,
- 62, 58, 54, 50, 47, 44, 41, 38, 35, 32,
- 30, 28, 26, 24, 22, 20, 18, 16, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16139, 15894, 15649, 15405, 15162, 14919, 14677, 14435, 14195,
+ 13955, 13717, 13479, 13243, 13008, 12775, 12542, 12310, 12079, 11851,
+ 11623, 11399, 11176, 10956, 10737, 10521, 10305, 10094, 9883, 9677,
+ 9471, 9268, 9065, 8862, 8659, 8459, 8260, 8067, 7874, 7688,
+ 7502, 7321, 7140, 6965, 6790, 6621, 6452, 6290, 6128, 5968,
+ 5808, 5655, 5503, 5356, 5209, 5069, 4929, 4794, 4660, 4532,
+ 4404, 4282, 4160, 4041, 3922, 3803, 3684, 3568, 3452, 3343,
+ 3234, 3131, 3029, 2931, 2833, 2741, 2649, 2563, 2477, 2396,
+ 2316, 2236, 2157, 2083, 2009, 1940, 1871, 1807, 1743, 1683,
+ 1623, 1567, 1511, 1459, 1407, 1357, 1307, 1257, 1207, 1159,
+ 1111, 1067, 1023, 983, 943, 905, 868, 834, 800, 769,
+ 738, 709, 681, 653, 625, 600, 575, 552, 529, 508,
+ 487, 466, 447, 428, 410, 392, 376, 360, 344, 328,
+ 313, 298, 283, 268, 255, 242, 230, 218, 207, 196,
+ 186, 176, 167, 158, 150, 142, 135, 128, 121, 114,
+ 108, 102, 97, 92, 87, 82, 78, 74, 70, 66,
+ 62, 58, 54, 50, 47, 44, 41, 38, 35, 32,
+ 30, 28, 26, 24, 22, 20, 18, 16, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16149, 15915, 15681, 15447, 15214, 14981, 14749, 14517, 14286,
- 14055, 13827, 13599, 13373, 13147, 12923, 12699, 12476, 12253, 12034,
- 11815, 11599, 11383, 11171, 10959, 10750, 10541, 10337, 10133, 9933,
- 9733, 9536, 9339, 9142, 8945, 8751, 8557, 8369, 8181, 7998,
- 7816, 7638, 7460, 7288, 7116, 6950, 6785, 6625, 6465, 6306,
- 6147, 5995, 5843, 5697, 5551, 5411, 5271, 5135, 5000, 4871,
- 4742, 4618, 4495, 4374, 4253, 4132, 4011, 3893, 3775, 3663,
- 3552, 3446, 3340, 3239, 3138, 3043, 2948, 2858, 2768, 2684,
- 2600, 2516, 2433, 2355, 2278, 2205, 2133, 2065, 1997, 1932,
- 1867, 1807, 1747, 1690, 1634, 1580, 1526, 1472, 1418, 1366,
- 1314, 1266, 1218, 1174, 1130, 1088, 1047, 1009, 971, 936,
- 901, 868, 836, 804, 772, 743, 714, 685, 658, 631,
- 606, 582, 559, 536, 515, 494, 475, 456, 437, 418,
- 399, 380, 362, 344, 328, 312, 297, 283, 270, 257,
- 245, 233, 222, 211, 201, 191, 181, 172, 163, 155,
- 147, 139, 132, 125, 119, 113, 107, 101, 96, 91,
- 86, 81, 76, 71, 66, 62, 58, 54, 50, 46,
- 43, 40, 37, 34, 31, 28, 26, 24, 22, 20,
- 18, 16, 14, 12, 10, 8, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16149, 15915, 15681, 15447, 15214, 14981, 14749, 14517, 14286,
+ 14055, 13827, 13599, 13373, 13147, 12923, 12699, 12476, 12253, 12034,
+ 11815, 11599, 11383, 11171, 10959, 10750, 10541, 10337, 10133, 9933,
+ 9733, 9536, 9339, 9142, 8945, 8751, 8557, 8369, 8181, 7998,
+ 7816, 7638, 7460, 7288, 7116, 6950, 6785, 6625, 6465, 6306,
+ 6147, 5995, 5843, 5697, 5551, 5411, 5271, 5135, 5000, 4871,
+ 4742, 4618, 4495, 4374, 4253, 4132, 4011, 3893, 3775, 3663,
+ 3552, 3446, 3340, 3239, 3138, 3043, 2948, 2858, 2768, 2684,
+ 2600, 2516, 2433, 2355, 2278, 2205, 2133, 2065, 1997, 1932,
+ 1867, 1807, 1747, 1690, 1634, 1580, 1526, 1472, 1418, 1366,
+ 1314, 1266, 1218, 1174, 1130, 1088, 1047, 1009, 971, 936,
+ 901, 868, 836, 804, 772, 743, 714, 685, 658, 631,
+ 606, 582, 559, 536, 515, 494, 475, 456, 437, 418,
+ 399, 380, 362, 344, 328, 312, 297, 283, 270, 257,
+ 245, 233, 222, 211, 201, 191, 181, 172, 163, 155,
+ 147, 139, 132, 125, 119, 113, 107, 101, 96, 91,
+ 86, 81, 76, 71, 66, 62, 58, 54, 50, 46,
+ 43, 40, 37, 34, 31, 28, 26, 24, 22, 20,
+ 18, 16, 14, 12, 10, 8, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16159, 15934, 15709, 15485, 15261, 15038, 14816, 14594, 14373,
- 14152, 13933, 13714, 13497, 13280, 13065, 12850, 12636, 12422, 12211,
- 12000, 11791, 11583, 11378, 11173, 10971, 10769, 10571, 10373, 10179,
- 9985, 9793, 9601, 9409, 9217, 9029, 8842, 8658, 8475, 8297,
- 8120, 7946, 7773, 7604, 7435, 7271, 7108, 6950, 6792, 6634,
- 6477, 6326, 6175, 6029, 5883, 5742, 5602, 5466, 5330, 5199,
- 5068, 4943, 4818, 4696, 4574, 4452, 4330, 4211, 4093, 3979,
- 3866, 3759, 3652, 3549, 3446, 3348, 3250, 3157, 3065, 2977,
- 2889, 2802, 2716, 2634, 2553, 2476, 2399, 2326, 2254, 2185,
- 2117, 2052, 1987, 1926, 1866, 1808, 1750, 1692, 1634, 1578,
- 1522, 1470, 1418, 1369, 1321, 1275, 1229, 1187, 1145, 1105,
- 1066, 1027, 991, 955, 919, 883, 850, 817, 786, 756,
- 728, 700, 674, 648, 624, 600, 578, 556, 534, 512,
- 490, 468, 447, 426, 407, 388, 371, 354, 338, 322,
- 307, 293, 280, 267, 255, 243, 231, 219, 209, 199,
- 189, 179, 170, 161, 153, 145, 138, 131, 124, 117,
- 111, 105, 99, 93, 87, 81, 76, 71, 66, 61,
- 57, 53, 49, 45, 42, 39, 36, 33, 30, 27,
- 24, 21, 19, 17, 15, 13, 11, 9, 7, 5,
- 3, 1, 0
+ 16384, 16159, 15934, 15709, 15485, 15261, 15038, 14816, 14594, 14373,
+ 14152, 13933, 13714, 13497, 13280, 13065, 12850, 12636, 12422, 12211,
+ 12000, 11791, 11583, 11378, 11173, 10971, 10769, 10571, 10373, 10179,
+ 9985, 9793, 9601, 9409, 9217, 9029, 8842, 8658, 8475, 8297,
+ 8120, 7946, 7773, 7604, 7435, 7271, 7108, 6950, 6792, 6634,
+ 6477, 6326, 6175, 6029, 5883, 5742, 5602, 5466, 5330, 5199,
+ 5068, 4943, 4818, 4696, 4574, 4452, 4330, 4211, 4093, 3979,
+ 3866, 3759, 3652, 3549, 3446, 3348, 3250, 3157, 3065, 2977,
+ 2889, 2802, 2716, 2634, 2553, 2476, 2399, 2326, 2254, 2185,
+ 2117, 2052, 1987, 1926, 1866, 1808, 1750, 1692, 1634, 1578,
+ 1522, 1470, 1418, 1369, 1321, 1275, 1229, 1187, 1145, 1105,
+ 1066, 1027, 991, 955, 919, 883, 850, 817, 786, 756,
+ 728, 700, 674, 648, 624, 600, 578, 556, 534, 512,
+ 490, 468, 447, 426, 407, 388, 371, 354, 338, 322,
+ 307, 293, 280, 267, 255, 243, 231, 219, 209, 199,
+ 189, 179, 170, 161, 153, 145, 138, 131, 124, 117,
+ 111, 105, 99, 93, 87, 81, 76, 71, 66, 61,
+ 57, 53, 49, 45, 42, 39, 36, 33, 30, 27,
+ 24, 21, 19, 17, 15, 13, 11, 9, 7, 5,
+ 3, 1, 0
},
{
- 16384, 16169, 15954, 15739, 15524, 15310, 15096, 14883, 14670, 14458,
- 14246, 14035, 13824, 13614, 13405, 13198, 12991, 12785, 12579, 12376,
- 12173, 11972, 11772, 11574, 11377, 11182, 10987, 10795, 10603, 10414,
- 10226, 10040, 9854, 9668, 9482, 9299, 9116, 8937, 8759, 8585,
- 8411, 8241, 8071, 7906, 7741, 7580, 7419, 7263, 7107, 6952,
- 6797, 6647, 6497, 6353, 6209, 6070, 5931, 5796, 5661, 5531,
- 5401, 5275, 5150, 5027, 4904, 4781, 4658, 4538, 4419, 4304,
- 4190, 4081, 3972, 3867, 3762, 3662, 3562, 3467, 3372, 3281,
- 3191, 3101, 3012, 2928, 2844, 2764, 2684, 2608, 2533, 2460,
- 2387, 2318, 2250, 2185, 2121, 2059, 1997, 1935, 1873, 1813,
- 1754, 1698, 1642, 1588, 1535, 1483, 1433, 1384, 1338, 1292,
- 1249, 1206, 1165, 1125, 1085, 1045, 1008, 971, 937, 903,
- 871, 840, 810, 780, 752, 724, 698, 672, 647, 622,
- 597, 572, 548, 524, 502, 480, 460, 440, 421, 403,
- 386, 369, 353, 337, 323, 309, 295, 281, 268, 255,
- 243, 231, 220, 209, 199, 189, 180, 171, 163, 155,
- 147, 139, 131, 123, 116, 109, 102, 95, 89, 83,
- 77, 72, 67, 62, 57, 52, 48, 44, 40, 36,
- 32, 28, 25, 22, 19, 16, 13, 10, 8, 6,
- 4, 2, 0
+ 16384, 16169, 15954, 15739, 15524, 15310, 15096, 14883, 14670, 14458,
+ 14246, 14035, 13824, 13614, 13405, 13198, 12991, 12785, 12579, 12376,
+ 12173, 11972, 11772, 11574, 11377, 11182, 10987, 10795, 10603, 10414,
+ 10226, 10040, 9854, 9668, 9482, 9299, 9116, 8937, 8759, 8585,
+ 8411, 8241, 8071, 7906, 7741, 7580, 7419, 7263, 7107, 6952,
+ 6797, 6647, 6497, 6353, 6209, 6070, 5931, 5796, 5661, 5531,
+ 5401, 5275, 5150, 5027, 4904, 4781, 4658, 4538, 4419, 4304,
+ 4190, 4081, 3972, 3867, 3762, 3662, 3562, 3467, 3372, 3281,
+ 3191, 3101, 3012, 2928, 2844, 2764, 2684, 2608, 2533, 2460,
+ 2387, 2318, 2250, 2185, 2121, 2059, 1997, 1935, 1873, 1813,
+ 1754, 1698, 1642, 1588, 1535, 1483, 1433, 1384, 1338, 1292,
+ 1249, 1206, 1165, 1125, 1085, 1045, 1008, 971, 937, 903,
+ 871, 840, 810, 780, 752, 724, 698, 672, 647, 622,
+ 597, 572, 548, 524, 502, 480, 460, 440, 421, 403,
+ 386, 369, 353, 337, 323, 309, 295, 281, 268, 255,
+ 243, 231, 220, 209, 199, 189, 180, 171, 163, 155,
+ 147, 139, 131, 123, 116, 109, 102, 95, 89, 83,
+ 77, 72, 67, 62, 57, 52, 48, 44, 40, 36,
+ 32, 28, 25, 22, 19, 16, 13, 10, 8, 6,
+ 4, 2, 0
},
{
- 16384, 16177, 15970, 15764, 15558, 15353, 15148, 14944, 14740, 14537,
- 14334, 14132, 13930, 13729, 13529, 13330, 13131, 12933, 12735, 12539,
- 12343, 12150, 11957, 11766, 11576, 11388, 11200, 11015, 10830, 10647,
- 10465, 10285, 10105, 9925, 9745, 9568, 9391, 9218, 9045, 8876,
- 8707, 8541, 8375, 8213, 8051, 7894, 7737, 7583, 7429, 7277,
- 7125, 6977, 6830, 6687, 6544, 6406, 6268, 6133, 5998, 5868,
- 5738, 5612, 5487, 5364, 5241, 5118, 4995, 4875, 4755, 4640,
- 4525, 4414, 4304, 4198, 4092, 3990, 3888, 3790, 3693, 3600,
- 3507, 3415, 3323, 3235, 3147, 3064, 2981, 2902, 2823, 2746,
- 2670, 2594, 2522, 2450, 2382, 2314, 2248, 2182, 2116, 2050,
- 1987, 1924, 1864, 1804, 1748, 1692, 1638, 1585, 1534, 1484,
- 1437, 1390, 1346, 1302, 1258, 1215, 1174, 1133, 1095, 1057,
- 1021, 986, 952, 918, 887, 856, 827, 798, 770, 742,
- 714, 686, 659, 632, 607, 582, 559, 536, 514, 492,
- 472, 452, 433, 415, 398, 381, 364, 348, 333, 318,
- 304, 290, 277, 264, 252, 240, 229, 218, 208, 198,
- 188, 178, 168, 158, 149, 140, 132, 124, 116, 108,
- 101, 94, 87, 81, 75, 69, 64, 59, 54, 49,
- 44, 39, 35, 31, 27, 23, 19, 15, 12, 9,
- 6, 3, 0
+ 16384, 16177, 15970, 15764, 15558, 15353, 15148, 14944, 14740, 14537,
+ 14334, 14132, 13930, 13729, 13529, 13330, 13131, 12933, 12735, 12539,
+ 12343, 12150, 11957, 11766, 11576, 11388, 11200, 11015, 10830, 10647,
+ 10465, 10285, 10105, 9925, 9745, 9568, 9391, 9218, 9045, 8876,
+ 8707, 8541, 8375, 8213, 8051, 7894, 7737, 7583, 7429, 7277,
+ 7125, 6977, 6830, 6687, 6544, 6406, 6268, 6133, 5998, 5868,
+ 5738, 5612, 5487, 5364, 5241, 5118, 4995, 4875, 4755, 4640,
+ 4525, 4414, 4304, 4198, 4092, 3990, 3888, 3790, 3693, 3600,
+ 3507, 3415, 3323, 3235, 3147, 3064, 2981, 2902, 2823, 2746,
+ 2670, 2594, 2522, 2450, 2382, 2314, 2248, 2182, 2116, 2050,
+ 1987, 1924, 1864, 1804, 1748, 1692, 1638, 1585, 1534, 1484,
+ 1437, 1390, 1346, 1302, 1258, 1215, 1174, 1133, 1095, 1057,
+ 1021, 986, 952, 918, 887, 856, 827, 798, 770, 742,
+ 714, 686, 659, 632, 607, 582, 559, 536, 514, 492,
+ 472, 452, 433, 415, 398, 381, 364, 348, 333, 318,
+ 304, 290, 277, 264, 252, 240, 229, 218, 208, 198,
+ 188, 178, 168, 158, 149, 140, 132, 124, 116, 108,
+ 101, 94, 87, 81, 75, 69, 64, 59, 54, 49,
+ 44, 39, 35, 31, 27, 23, 19, 15, 12, 9,
+ 6, 3, 0
}
};
static const uint16_t cf_tables_3[5][257] = {
{
- 16384, 16187, 15990, 15793, 15597, 15401, 15205, 15009, 14813, 14618,
- 14423, 14230, 14037, 13845, 13653, 13463, 13273, 13083, 12894, 12706,
- 12518, 12332, 12146, 11962, 11778, 11597, 11416, 11237, 11059, 10882,
- 10706, 10532, 10358, 10184, 10010, 9838, 9666, 9497, 9328, 9163,
- 8999, 8837, 8675, 8517, 8359, 8205, 8051, 7901, 7751, 7602,
- 7453, 7308, 7163, 7022, 6882, 6745, 6609, 6476, 6343, 6214,
- 6085, 5960, 5835, 5712, 5589, 5466, 5343, 5223, 5103, 4987,
- 4872, 4761, 4650, 4542, 4435, 4332, 4229, 4130, 4031, 3936,
- 3841, 3747, 3653, 3563, 3473, 3387, 3302, 3220, 3138, 3059,
- 2980, 2905, 2830, 2759, 2688, 2619, 2550, 2481, 2412, 2345,
- 2278, 2215, 2152, 2092, 2032, 1974, 1917, 1863, 1809, 1758,
- 1707, 1659, 1611, 1564, 1517, 1473, 1429, 1387, 1346, 1307,
- 1268, 1230, 1193, 1158, 1123, 1090, 1058, 1026, 994, 962,
- 930, 899, 869, 841, 813, 786, 760, 735, 710, 687,
- 664, 643, 622, 602, 582, 562, 543, 525, 507, 490,
- 473, 457, 442, 427, 412, 398, 385, 373, 361, 349,
- 337, 325, 313, 301, 290, 279, 269, 259, 249, 240,
- 231, 222, 214, 206, 199, 192, 185, 178, 171, 165,
- 159, 153, 148, 143, 138, 133, 128, 123, 119, 115,
- 111, 107, 103, 99, 95, 91, 87, 83, 80, 77,
- 74, 71, 68, 65, 63, 61, 59, 57, 55, 53,
- 51, 49, 47, 45, 43, 41, 40, 39, 38, 37,
- 36, 35, 34, 33, 32, 31, 30, 29, 28, 27,
- 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16187, 15990, 15793, 15597, 15401, 15205, 15009, 14813, 14618,
+ 14423, 14230, 14037, 13845, 13653, 13463, 13273, 13083, 12894, 12706,
+ 12518, 12332, 12146, 11962, 11778, 11597, 11416, 11237, 11059, 10882,
+ 10706, 10532, 10358, 10184, 10010, 9838, 9666, 9497, 9328, 9163,
+ 8999, 8837, 8675, 8517, 8359, 8205, 8051, 7901, 7751, 7602,
+ 7453, 7308, 7163, 7022, 6882, 6745, 6609, 6476, 6343, 6214,
+ 6085, 5960, 5835, 5712, 5589, 5466, 5343, 5223, 5103, 4987,
+ 4872, 4761, 4650, 4542, 4435, 4332, 4229, 4130, 4031, 3936,
+ 3841, 3747, 3653, 3563, 3473, 3387, 3302, 3220, 3138, 3059,
+ 2980, 2905, 2830, 2759, 2688, 2619, 2550, 2481, 2412, 2345,
+ 2278, 2215, 2152, 2092, 2032, 1974, 1917, 1863, 1809, 1758,
+ 1707, 1659, 1611, 1564, 1517, 1473, 1429, 1387, 1346, 1307,
+ 1268, 1230, 1193, 1158, 1123, 1090, 1058, 1026, 994, 962,
+ 930, 899, 869, 841, 813, 786, 760, 735, 710, 687,
+ 664, 643, 622, 602, 582, 562, 543, 525, 507, 490,
+ 473, 457, 442, 427, 412, 398, 385, 373, 361, 349,
+ 337, 325, 313, 301, 290, 279, 269, 259, 249, 240,
+ 231, 222, 214, 206, 199, 192, 185, 178, 171, 165,
+ 159, 153, 148, 143, 138, 133, 128, 123, 119, 115,
+ 111, 107, 103, 99, 95, 91, 87, 83, 80, 77,
+ 74, 71, 68, 65, 63, 61, 59, 57, 55, 53,
+ 51, 49, 47, 45, 43, 41, 40, 39, 38, 37,
+ 36, 35, 34, 33, 32, 31, 30, 29, 28, 27,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16195, 16006, 15817, 15629, 15441, 15253, 15065, 14878, 14692,
- 14506, 14321, 14136, 13952, 13768, 13585, 13402, 13219, 13037, 12857,
- 12677, 12499, 12321, 12144, 11967, 11792, 11617, 11444, 11271, 11100,
- 10930, 10762, 10594, 10426, 10258, 10091, 9925, 9761, 9598, 9438,
- 9278, 9120, 8963, 8809, 8655, 8504, 8354, 8207, 8060, 7914,
- 7769, 7627, 7485, 7347, 7209, 7074, 6939, 6807, 6676, 6548,
- 6420, 6296, 6172, 6050, 5928, 5806, 5684, 5564, 5444, 5328,
- 5212, 5100, 4988, 4879, 4771, 4667, 4563, 4462, 4362, 4265,
- 4169, 4073, 3978, 3886, 3795, 3707, 3619, 3535, 3451, 3369,
- 3288, 3210, 3133, 3059, 2985, 2913, 2841, 2769, 2697, 2627,
- 2557, 2490, 2424, 2360, 2297, 2237, 2177, 2119, 2062, 2007,
- 1953, 1901, 1849, 1798, 1748, 1700, 1652, 1607, 1562, 1519,
- 1476, 1435, 1394, 1355, 1317, 1281, 1245, 1210, 1175, 1140,
- 1105, 1071, 1037, 1005, 973, 943, 913, 885, 857, 830,
- 804, 779, 754, 731, 708, 685, 663, 642, 621, 601,
- 581, 563, 545, 528, 511, 495, 479, 463, 448, 433,
- 419, 405, 391, 377, 364, 351, 338, 326, 314, 302,
- 291, 280, 270, 260, 251, 242, 234, 226, 218, 210,
- 202, 195, 188, 181, 174, 168, 162, 156, 150, 144,
- 139, 134, 129, 124, 119, 114, 109, 104, 100, 96,
- 92, 88, 84, 80, 77, 74, 71, 68, 65, 62,
- 59, 56, 54, 52, 50, 48, 46, 44, 42, 40,
- 38, 36, 34, 33, 32, 31, 30, 29, 28, 27,
- 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16195, 16006, 15817, 15629, 15441, 15253, 15065, 14878, 14692,
+ 14506, 14321, 14136, 13952, 13768, 13585, 13402, 13219, 13037, 12857,
+ 12677, 12499, 12321, 12144, 11967, 11792, 11617, 11444, 11271, 11100,
+ 10930, 10762, 10594, 10426, 10258, 10091, 9925, 9761, 9598, 9438,
+ 9278, 9120, 8963, 8809, 8655, 8504, 8354, 8207, 8060, 7914,
+ 7769, 7627, 7485, 7347, 7209, 7074, 6939, 6807, 6676, 6548,
+ 6420, 6296, 6172, 6050, 5928, 5806, 5684, 5564, 5444, 5328,
+ 5212, 5100, 4988, 4879, 4771, 4667, 4563, 4462, 4362, 4265,
+ 4169, 4073, 3978, 3886, 3795, 3707, 3619, 3535, 3451, 3369,
+ 3288, 3210, 3133, 3059, 2985, 2913, 2841, 2769, 2697, 2627,
+ 2557, 2490, 2424, 2360, 2297, 2237, 2177, 2119, 2062, 2007,
+ 1953, 1901, 1849, 1798, 1748, 1700, 1652, 1607, 1562, 1519,
+ 1476, 1435, 1394, 1355, 1317, 1281, 1245, 1210, 1175, 1140,
+ 1105, 1071, 1037, 1005, 973, 943, 913, 885, 857, 830,
+ 804, 779, 754, 731, 708, 685, 663, 642, 621, 601,
+ 581, 563, 545, 528, 511, 495, 479, 463, 448, 433,
+ 419, 405, 391, 377, 364, 351, 338, 326, 314, 302,
+ 291, 280, 270, 260, 251, 242, 234, 226, 218, 210,
+ 202, 195, 188, 181, 174, 168, 162, 156, 150, 144,
+ 139, 134, 129, 124, 119, 114, 109, 104, 100, 96,
+ 92, 88, 84, 80, 77, 74, 71, 68, 65, 62,
+ 59, 56, 54, 52, 50, 48, 46, 44, 42, 40,
+ 38, 36, 34, 33, 32, 31, 30, 29, 28, 27,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16203, 16022, 15842, 15662, 15482, 15302, 15122, 14942, 14763,
- 14584, 14406, 14228, 14051, 13874, 13698, 13522, 13347, 13172, 12998,
- 12824, 12652, 12480, 12310, 12140, 11971, 11803, 11637, 11471, 11307,
- 11143, 10980, 10817, 10654, 10491, 10330, 10169, 10011, 9853, 9697,
- 9542, 9389, 9236, 9086, 8936, 8789, 8642, 8498, 8355, 8212,
- 8070, 7931, 7792, 7656, 7520, 7388, 7256, 7126, 6996, 6870,
- 6744, 6621, 6498, 6377, 6256, 6135, 6014, 5895, 5776, 5660,
- 5545, 5433, 5321, 5212, 5104, 4999, 4895, 4793, 4692, 4594,
- 4496, 4400, 4304, 4211, 4118, 4028, 3939, 3853, 3767, 3684,
- 3601, 3521, 3441, 3364, 3287, 3212, 3137, 3062, 2987, 2915,
- 2843, 2773, 2704, 2638, 2572, 2508, 2445, 2384, 2324, 2266,
- 2208, 2153, 2098, 2044, 1990, 1939, 1888, 1839, 1791, 1745,
- 1699, 1655, 1611, 1569, 1527, 1487, 1448, 1409, 1370, 1331,
- 1292, 1255, 1218, 1183, 1148, 1115, 1082, 1051, 1020, 990,
- 960, 932, 904, 878, 852, 826, 801, 777, 753, 731,
- 709, 687, 666, 645, 625, 605, 586, 567, 550, 533,
- 516, 499, 482, 465, 449, 433, 418, 403, 389, 375,
- 362, 349, 337, 325, 314, 303, 293, 283, 273, 263,
- 254, 245, 236, 227, 219, 211, 204, 197, 190, 183,
- 177, 171, 165, 159, 153, 147, 141, 135, 130, 125,
- 120, 115, 110, 105, 101, 97, 93, 89, 85, 81,
- 77, 74, 71, 68, 65, 62, 59, 56, 53, 51,
- 49, 47, 45, 43, 41, 39, 37, 35, 33, 31,
- 29, 27, 25, 23, 22, 21, 20, 19, 18, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16203, 16022, 15842, 15662, 15482, 15302, 15122, 14942, 14763,
+ 14584, 14406, 14228, 14051, 13874, 13698, 13522, 13347, 13172, 12998,
+ 12824, 12652, 12480, 12310, 12140, 11971, 11803, 11637, 11471, 11307,
+ 11143, 10980, 10817, 10654, 10491, 10330, 10169, 10011, 9853, 9697,
+ 9542, 9389, 9236, 9086, 8936, 8789, 8642, 8498, 8355, 8212,
+ 8070, 7931, 7792, 7656, 7520, 7388, 7256, 7126, 6996, 6870,
+ 6744, 6621, 6498, 6377, 6256, 6135, 6014, 5895, 5776, 5660,
+ 5545, 5433, 5321, 5212, 5104, 4999, 4895, 4793, 4692, 4594,
+ 4496, 4400, 4304, 4211, 4118, 4028, 3939, 3853, 3767, 3684,
+ 3601, 3521, 3441, 3364, 3287, 3212, 3137, 3062, 2987, 2915,
+ 2843, 2773, 2704, 2638, 2572, 2508, 2445, 2384, 2324, 2266,
+ 2208, 2153, 2098, 2044, 1990, 1939, 1888, 1839, 1791, 1745,
+ 1699, 1655, 1611, 1569, 1527, 1487, 1448, 1409, 1370, 1331,
+ 1292, 1255, 1218, 1183, 1148, 1115, 1082, 1051, 1020, 990,
+ 960, 932, 904, 878, 852, 826, 801, 777, 753, 731,
+ 709, 687, 666, 645, 625, 605, 586, 567, 550, 533,
+ 516, 499, 482, 465, 449, 433, 418, 403, 389, 375,
+ 362, 349, 337, 325, 314, 303, 293, 283, 273, 263,
+ 254, 245, 236, 227, 219, 211, 204, 197, 190, 183,
+ 177, 171, 165, 159, 153, 147, 141, 135, 130, 125,
+ 120, 115, 110, 105, 101, 97, 93, 89, 85, 81,
+ 77, 74, 71, 68, 65, 62, 59, 56, 53, 51,
+ 49, 47, 45, 43, 41, 39, 37, 35, 33, 31,
+ 29, 27, 25, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16210, 16036, 15863, 15690, 15517, 15344, 15172, 15000, 14828,
- 14656, 14485, 14314, 14145, 13976, 13808, 13640, 13472, 13304, 13137,
- 12970, 12804, 12639, 12475, 12312, 12149, 11987, 11827, 11667, 11508,
- 11349, 11192, 11035, 10878, 10721, 10565, 10410, 10257, 10104, 9953,
- 9802, 9654, 9506, 9359, 9213, 9070, 8927, 8787, 8647, 8508,
- 8369, 8233, 8097, 7964, 7831, 7700, 7570, 7442, 7315, 7190,
- 7065, 6943, 6821, 6701, 6581, 6461, 6341, 6223, 6105, 5990,
- 5876, 5764, 5653, 5545, 5437, 5331, 5226, 5124, 5022, 4924,
- 4826, 4729, 4632, 4538, 4444, 4353, 4262, 4174, 4087, 4002,
- 3917, 3835, 3753, 3674, 3595, 3518, 3441, 3364, 3287, 3212,
- 3138, 3066, 2995, 2926, 2858, 2792, 2726, 2662, 2599, 2538,
- 2478, 2420, 2362, 2305, 2249, 2195, 2141, 2089, 2037, 1988,
- 1939, 1891, 1844, 1799, 1754, 1711, 1668, 1626, 1584, 1542,
- 1500, 1459, 1418, 1380, 1342, 1305, 1269, 1234, 1199, 1166,
- 1133, 1102, 1071, 1041, 1012, 983, 954, 926, 899, 872,
- 847, 822, 798, 774, 751, 728, 707, 686, 666, 646,
- 627, 608, 589, 570, 552, 534, 517, 500, 484, 468,
- 453, 438, 424, 410, 397, 384, 372, 360, 348, 336,
- 325, 314, 303, 293, 283, 273, 264, 255, 246, 237,
- 229, 221, 213, 205, 197, 189, 181, 174, 167, 160,
- 154, 148, 142, 136, 131, 126, 121, 116, 111, 106,
- 101, 97, 93, 89, 85, 81, 77, 73, 70, 67,
- 64, 61, 58, 55, 52, 49, 46, 43, 40, 37,
- 35, 33, 31, 29, 27, 25, 23, 21, 19, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16210, 16036, 15863, 15690, 15517, 15344, 15172, 15000, 14828,
+ 14656, 14485, 14314, 14145, 13976, 13808, 13640, 13472, 13304, 13137,
+ 12970, 12804, 12639, 12475, 12312, 12149, 11987, 11827, 11667, 11508,
+ 11349, 11192, 11035, 10878, 10721, 10565, 10410, 10257, 10104, 9953,
+ 9802, 9654, 9506, 9359, 9213, 9070, 8927, 8787, 8647, 8508,
+ 8369, 8233, 8097, 7964, 7831, 7700, 7570, 7442, 7315, 7190,
+ 7065, 6943, 6821, 6701, 6581, 6461, 6341, 6223, 6105, 5990,
+ 5876, 5764, 5653, 5545, 5437, 5331, 5226, 5124, 5022, 4924,
+ 4826, 4729, 4632, 4538, 4444, 4353, 4262, 4174, 4087, 4002,
+ 3917, 3835, 3753, 3674, 3595, 3518, 3441, 3364, 3287, 3212,
+ 3138, 3066, 2995, 2926, 2858, 2792, 2726, 2662, 2599, 2538,
+ 2478, 2420, 2362, 2305, 2249, 2195, 2141, 2089, 2037, 1988,
+ 1939, 1891, 1844, 1799, 1754, 1711, 1668, 1626, 1584, 1542,
+ 1500, 1459, 1418, 1380, 1342, 1305, 1269, 1234, 1199, 1166,
+ 1133, 1102, 1071, 1041, 1012, 983, 954, 926, 899, 872,
+ 847, 822, 798, 774, 751, 728, 707, 686, 666, 646,
+ 627, 608, 589, 570, 552, 534, 517, 500, 484, 468,
+ 453, 438, 424, 410, 397, 384, 372, 360, 348, 336,
+ 325, 314, 303, 293, 283, 273, 264, 255, 246, 237,
+ 229, 221, 213, 205, 197, 189, 181, 174, 167, 160,
+ 154, 148, 142, 136, 131, 126, 121, 116, 111, 106,
+ 101, 97, 93, 89, 85, 81, 77, 73, 70, 67,
+ 64, 61, 58, 55, 52, 49, 46, 43, 40, 37,
+ 35, 33, 31, 29, 27, 25, 23, 21, 19, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16218, 16052, 15886, 15720, 15554, 15389, 15224, 15059, 14895,
- 14731, 14567, 14403, 14240, 14077, 13915, 13753, 13591, 13429, 13269,
- 13109, 12950, 12791, 12633, 12476, 12320, 12164, 12009, 11854, 11701,
- 11548, 11396, 11244, 11092, 10940, 10790, 10640, 10492, 10344, 10198,
- 10052, 9908, 9764, 9622, 9481, 9342, 9203, 9066, 8929, 8793,
- 8657, 8524, 8391, 8261, 8131, 8003, 7875, 7749, 7624, 7502,
- 7380, 7260, 7140, 7022, 6904, 6786, 6668, 6551, 6435, 6322,
- 6209, 6099, 5989, 5881, 5773, 5668, 5563, 5461, 5359, 5260,
- 5161, 5063, 4965, 4871, 4777, 4686, 4595, 4506, 4417, 4331,
- 4245, 4162, 4079, 3999, 3919, 3841, 3763, 3685, 3607, 3530,
- 3454, 3380, 3307, 3236, 3166, 3097, 3029, 2963, 2897, 2834,
- 2771, 2710, 2650, 2591, 2532, 2475, 2418, 2363, 2309, 2257,
- 2205, 2155, 2105, 2057, 2009, 1963, 1918, 1873, 1828, 1783,
- 1738, 1694, 1650, 1607, 1565, 1524, 1484, 1445, 1407, 1369,
- 1333, 1297, 1263, 1229, 1197, 1165, 1134, 1103, 1073, 1043,
- 1015, 987, 960, 933, 907, 882, 858, 834, 811, 788,
- 766, 744, 722, 700, 679, 658, 638, 618, 599, 581,
- 563, 545, 528, 511, 495, 480, 465, 451, 437, 423,
- 410, 397, 384, 372, 360, 348, 337, 326, 315, 305,
- 295, 285, 275, 265, 255, 245, 236, 227, 219, 211,
- 203, 195, 188, 181, 174, 167, 161, 155, 149, 143,
- 137, 131, 126, 121, 116, 111, 106, 101, 97, 93,
- 89, 85, 81, 77, 73, 69, 65, 61, 58, 55,
- 52, 49, 46, 43, 40, 37, 34, 32, 30, 28,
- 26, 24, 22, 20, 18, 16, 14, 12, 10, 8,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16218, 16052, 15886, 15720, 15554, 15389, 15224, 15059, 14895,
+ 14731, 14567, 14403, 14240, 14077, 13915, 13753, 13591, 13429, 13269,
+ 13109, 12950, 12791, 12633, 12476, 12320, 12164, 12009, 11854, 11701,
+ 11548, 11396, 11244, 11092, 10940, 10790, 10640, 10492, 10344, 10198,
+ 10052, 9908, 9764, 9622, 9481, 9342, 9203, 9066, 8929, 8793,
+ 8657, 8524, 8391, 8261, 8131, 8003, 7875, 7749, 7624, 7502,
+ 7380, 7260, 7140, 7022, 6904, 6786, 6668, 6551, 6435, 6322,
+ 6209, 6099, 5989, 5881, 5773, 5668, 5563, 5461, 5359, 5260,
+ 5161, 5063, 4965, 4871, 4777, 4686, 4595, 4506, 4417, 4331,
+ 4245, 4162, 4079, 3999, 3919, 3841, 3763, 3685, 3607, 3530,
+ 3454, 3380, 3307, 3236, 3166, 3097, 3029, 2963, 2897, 2834,
+ 2771, 2710, 2650, 2591, 2532, 2475, 2418, 2363, 2309, 2257,
+ 2205, 2155, 2105, 2057, 2009, 1963, 1918, 1873, 1828, 1783,
+ 1738, 1694, 1650, 1607, 1565, 1524, 1484, 1445, 1407, 1369,
+ 1333, 1297, 1263, 1229, 1197, 1165, 1134, 1103, 1073, 1043,
+ 1015, 987, 960, 933, 907, 882, 858, 834, 811, 788,
+ 766, 744, 722, 700, 679, 658, 638, 618, 599, 581,
+ 563, 545, 528, 511, 495, 480, 465, 451, 437, 423,
+ 410, 397, 384, 372, 360, 348, 337, 326, 315, 305,
+ 295, 285, 275, 265, 255, 245, 236, 227, 219, 211,
+ 203, 195, 188, 181, 174, 167, 161, 155, 149, 143,
+ 137, 131, 126, 121, 116, 111, 106, 101, 97, 93,
+ 89, 85, 81, 77, 73, 69, 65, 61, 58, 55,
+ 52, 49, 46, 43, 40, 37, 34, 32, 30, 28,
+ 26, 24, 22, 20, 18, 16, 14, 12, 10, 8,
+ 6, 5, 4, 3, 2, 1, 0
}
};
-static const uint16_t * const cf_table[16] = {
+static const uint16_t *const cf_table[16] = {
cf_tables_1[0], cf_tables_1[1], cf_tables_1[2], cf_tables_2[0],
cf_tables_2[1], cf_tables_2[2], cf_tables_2[3], cf_tables_2[4],
cf_tables_2[5], cf_tables_2[6], cf_tables_2[7], cf_tables_3[0],
@@ -424,10 +421,8 @@ static const uint16_t * const cf_table[16] = {
};
-/** Initialize a given lookup table using a given delta
- */
-static void bgmc_lut_fillp(uint8_t *lut, int *lut_status,
- int delta)
+/** Initialize a given lookup table using a given delta */
+static void bgmc_lut_fillp(uint8_t *lut, int *lut_status, int delta)
{
unsigned int sx, i;
@@ -446,10 +441,8 @@ static void bgmc_lut_fillp(uint8_t *lut, int *lut_status,
}
-/** Retune the index of a suitable lookup table for a given delta
- */
-static uint8_t* bgmc_lut_getp(uint8_t *lut, int *lut_status,
- int delta)
+/** Retune the index of a suitable lookup table for a given delta */
+static uint8_t *bgmc_lut_getp(uint8_t *lut, int *lut_status, int delta)
{
unsigned int i = av_clip(delta, 0, LUT_BUFF - 1);
@@ -462,11 +455,10 @@ static uint8_t* bgmc_lut_getp(uint8_t *lut, int *lut_status,
}
-/** Initialize the lookup table arrays
- */
+/** Initialize the lookup table arrays */
int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status)
{
- *cf_lut = av_malloc(sizeof(*cf_lut ) * LUT_BUFF * 16 * LUT_SIZE);
+ *cf_lut = av_malloc(sizeof(*cf_lut) * LUT_BUFF * 16 * LUT_SIZE);
*cf_lut_status = av_malloc(sizeof(*cf_lut_status) * LUT_BUFF);
if (!cf_lut || !cf_lut_status) {
@@ -474,8 +466,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status)
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
return AVERROR(ENOMEM);
} else {
- // initialize lut_status buffer to a value never used to compare
- // against
+ // initialize lut_status buffer to a value never used to compare against
memset(*cf_lut_status, -1, sizeof(*cf_lut_status) * LUT_BUFF);
}
@@ -483,8 +474,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status)
}
-/** Release the lookup table arrays
- */
+/** Release the lookup table arrays */
void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
{
av_freep(cf_lut);
@@ -492,10 +482,9 @@ void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
}
-/** Initialize decoding and reads the first value
- */
-void ff_bgmc_decode_init(GetBitContext *gb,
- unsigned int *h, unsigned int *l, unsigned int *v)
+/** Initialize decoding and reads the first value */
+void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h, unsigned int *l,
+ unsigned int *v)
{
*h = TOP_VALUE;
*l = 0;
@@ -503,16 +492,14 @@ void ff_bgmc_decode_init(GetBitContext *gb,
}
-/** Finish decoding
- */
+/** Finish decoding */
void ff_bgmc_decode_end(GetBitContext *gb)
{
skip_bits_long(gb, -(VALUE_BITS - 2));
}
-/** Read and decode a block Gilbert-Moore coded symbol
- */
+/** Read and decode a block Gilbert-Moore coded symbol */
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
int delta, unsigned int sx,
unsigned int *h, unsigned int *l, unsigned int *v,
@@ -522,9 +509,9 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta);
// read current state
- unsigned int high = *h;
- unsigned int low = *l;
- unsigned int value = *v;
+ unsigned int high = *h;
+ unsigned int low = *l;
+ unsigned int value = *v;
lut += sx * LUT_SIZE;
@@ -539,12 +526,12 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
symbol = (symbol >> delta) - 1;
- high = low + ((range * cf_table[sx][(symbol ) << delta] - (1 << FREQ_BITS)) >> FREQ_BITS);
- low = low + ((range * cf_table[sx][(symbol + 1) << delta] ) >> FREQ_BITS);
+ high = low + ((range * cf_table[sx][(symbol) << delta] - (1 << FREQ_BITS)) >> FREQ_BITS);
+ low = low + ((range * cf_table[sx][(symbol + 1) << delta]) >> FREQ_BITS);
while (1) {
if (high >= HALF) {
- if (low >= HALF) {
+ if (low >= HALF) {
value -= HALF;
low -= HALF;
high -= HALF;
@@ -552,12 +539,13 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
value -= FIRST_QTR;
low -= FIRST_QTR;
high -= FIRST_QTR;
- } else break;
+ } else
+ break;
}
- low *= 2;
- high = 2 * high + 1;
- value = 2 * value + get_bits1(gb);
+ low *= 2;
+ high = 2 * high + 1;
+ value = 2 * value + get_bits1(gb);
}
*dst++ = symbol;
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index 4031764597..b6bc830662 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -53,6 +53,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
uint8_t *ptr;
int dsize;
const uint8_t *buf0 = buf;
+ GetByteContext gb;
if(buf_size < 14){
av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size);
@@ -269,7 +270,8 @@ static int bmp_decode_frame(AVCodecContext *avctx,
p->data[0] += p->linesize[0] * (avctx->height - 1);
p->linesize[0] = -p->linesize[0];
}
- ff_msrle_decode(avctx, (AVPicture*)p, depth, buf, dsize);
+ bytestream2_init(&gb, buf, dsize);
+ ff_msrle_decode(avctx, (AVPicture*)p, depth, &gb);
if(height < 0){
p->data[0] += p->linesize[0] * (avctx->height - 1);
p->linesize[0] = -p->linesize[0];
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index d18fc86eb8..a9a1ee971d 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -105,10 +105,6 @@ float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){
xvid_plg_data.bquant_offset = 0; // 100 * s->avctx->b_quant_offset;
xvid_plg_data.bquant_ratio = 100; // * s->avctx->b_quant_factor;
-#if 0
- xvid_plg_data.stats.hlength= X
-#endif
-
if(!s->rc_context.dry_run_qscale){
if(s->picture_number){
xvid_plg_data.length=
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 006617687e..37899b1f7a 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -1,3 +1,3 @@
-OBJS-$(HAVE_MMI) += mips/dsputil_mmi.o \
- mips/idct_mmi.o \
- mips/mpegvideo_mmi.o \
+MMI-OBJS += mips/dsputil_mmi.o \
+ mips/idct_mmi.o \
+ mips/mpegvideo_mmi.o \
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index e8406029ee..0c54f9af5e 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -40,6 +40,7 @@ typedef struct MsrleContext {
AVCodecContext *avctx;
AVFrame frame;
+ GetByteContext gb;
const unsigned char *buf;
int size;
@@ -127,7 +128,8 @@ static int msrle_decode_frame(AVCodecContext *avctx,
ptr += s->frame.linesize[0];
}
} else {
- ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, buf, buf_size);
+ bytestream2_init(&s->gb, buf, buf_size);
+ ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, &s->gb);
}
*data_size = sizeof(AVFrame);
diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
index 9ffc3439f9..36a46b5978 100644
--- a/libavcodec/msrledec.c
+++ b/libavcodec/msrledec.c
@@ -30,18 +30,9 @@
#include "avcodec.h"
#include "msrledec.h"
-#define FETCH_NEXT_STREAM_BYTE() \
- if (stream_ptr >= data_size) \
- { \
- av_log(avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (1)\n"); \
- return -1; \
- } \
- stream_byte = data[stream_ptr++];
-
static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
- const uint8_t *data, int data_size)
+ GetByteContext *gb)
{
- int stream_ptr = 0;
unsigned char rle_code;
unsigned char extra_byte, odd_pixel;
unsigned char stream_byte;
@@ -52,11 +43,16 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
int i;
while (row_ptr >= 0) {
- FETCH_NEXT_STREAM_BYTE();
- rle_code = stream_byte;
+ if (bytestream2_get_bytes_left(gb) <= 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "MS RLE: bytestream overrun, %d rows left\n",
+ row_ptr);
+ return AVERROR_INVALIDDATA;
+ }
+ rle_code = stream_byte = bytestream2_get_byteu(gb);
if (rle_code == 0) {
/* fetch the next byte to see how to handle escape code */
- FETCH_NEXT_STREAM_BYTE();
+ stream_byte = bytestream2_get_byte(gb);
if (stream_byte == 0) {
/* line is done, goto the next one */
row_ptr -= row_dec;
@@ -66,24 +62,26 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
return 0;
} else if (stream_byte == 2) {
/* reposition frame decode coordinates */
- FETCH_NEXT_STREAM_BYTE();
+ stream_byte = bytestream2_get_byte(gb);
pixel_ptr += stream_byte;
- FETCH_NEXT_STREAM_BYTE();
+ stream_byte = bytestream2_get_byte(gb);
row_ptr -= stream_byte * row_dec;
} else {
// copy pixels from encoded stream
odd_pixel = stream_byte & 1;
rle_code = (stream_byte + 1) / 2;
extra_byte = rle_code & 0x01;
- if (row_ptr + pixel_ptr + stream_byte > frame_size) {
- av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
- return -1;
+ if (row_ptr + pixel_ptr + stream_byte > frame_size ||
+ bytestream2_get_bytes_left(gb) < rle_code) {
+ av_log(avctx, AV_LOG_ERROR,
+ "MS RLE: frame/stream ptr just went out of bounds (copy)\n");
+ return AVERROR_INVALIDDATA;
}
for (i = 0; i < rle_code; i++) {
if (pixel_ptr >= avctx->width)
break;
- FETCH_NEXT_STREAM_BYTE();
+ stream_byte = bytestream2_get_byteu(gb);
pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
pixel_ptr++;
if (i + 1 == rle_code && odd_pixel)
@@ -96,15 +94,16 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
// if the RLE code is odd, skip a byte in the stream
if (extra_byte)
- stream_ptr++;
+ bytestream2_skip(gb, 1);
}
} else {
// decode a run of data
if (row_ptr + pixel_ptr + stream_byte > frame_size) {
- av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
- return -1;
+ av_log(avctx, AV_LOG_ERROR,
+ "MS RLE: frame ptr just went out of bounds (run)\n");
+ return AVERROR_INVALIDDATA;
}
- FETCH_NEXT_STREAM_BYTE();
+ stream_byte = bytestream2_get_byte(gb);
for (i = 0; i < rle_code; i++) {
if (pixel_ptr >= avctx->width)
break;
@@ -118,21 +117,21 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
}
/* one last sanity check on the way out */
- if (stream_ptr < data_size) {
- av_log(avctx, AV_LOG_ERROR, " MS RLE: ended frame decode with bytes left over (%d < %d)\n",
- stream_ptr, data_size);
- return -1;
+ if (bytestream2_get_bytes_left(gb)) {
+ av_log(avctx, AV_LOG_ERROR,
+ "MS RLE: ended frame decode with %d bytes left over\n",
+ bytestream2_get_bytes_left(gb));
+ return AVERROR_INVALIDDATA;
}
return 0;
}
-static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int depth,
- const uint8_t *data, int srcsize)
+static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
+ int depth, GetByteContext *gb)
{
uint8_t *output, *output_end;
- const uint8_t* src = data;
int p1, p2, line=avctx->height - 1, pos=0, i;
uint16_t pix16;
uint32_t pix32;
@@ -140,23 +139,29 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
output_end = pic->data[0] + avctx->height * pic->linesize[0];
- while(src + 1 < data + srcsize) {
- p1 = *src++;
+ while (bytestream2_get_bytes_left(gb) > 0) {
+ p1 = bytestream2_get_byteu(gb);
if(p1 == 0) { //Escape code
- p2 = *src++;
+ p2 = bytestream2_get_byte(gb);
if(p2 == 0) { //End-of-line
output = pic->data[0] + (--line) * pic->linesize[0];
- if (line < 0 && !(src+1 < data + srcsize && AV_RB16(src) == 1)) {
- av_log(avctx, AV_LOG_ERROR, "Next line is beyond picture bounds\n");
- return -1;
+ if (line < 0) {
+ if (bytestream2_get_be16(gb) == 1) { // end-of-picture
+ return 0;
+ } else {
+ av_log(avctx, AV_LOG_ERROR,
+ "Next line is beyond picture bounds (%d bytes left)\n",
+ bytestream2_get_bytes_left(gb));
+ return AVERROR_INVALIDDATA;
+ }
}
pos = 0;
continue;
} else if(p2 == 1) { //End-of-picture
return 0;
} else if(p2 == 2) { //Skip
- p1 = *src++;
- p2 = *src++;
+ p1 = bytestream2_get_byte(gb);
+ p2 = bytestream2_get_byte(gb);
line -= p2;
pos += p1;
if (line < 0 || pos >= width){
@@ -167,35 +172,31 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
continue;
}
// Copy data
- if ((pic->linesize[0] > 0 && output + p2 * (depth >> 3) > output_end)
- ||(pic->linesize[0] < 0 && output + p2 * (depth >> 3) < output_end)) {
- src += p2 * (depth >> 3);
+ if ((pic->linesize[0] > 0 && output + p2 * (depth >> 3) > output_end) ||
+ (pic->linesize[0] < 0 && output + p2 * (depth >> 3) < output_end)) {
+ bytestream2_skip(gb, 2 * (depth >> 3));
continue;
+ } else if (bytestream2_get_bytes_left(gb) < p2 * (depth >> 3)) {
+ av_log(avctx, AV_LOG_ERROR, "bytestream overrun\n");
+ return AVERROR_INVALIDDATA;
}
- if(data + srcsize - src < p2 * (depth >> 3)){
- av_log(avctx, AV_LOG_ERROR, "Copy beyond input buffer\n");
- return -1;
- }
+
if ((depth == 8) || (depth == 24)) {
for(i = 0; i < p2 * (depth >> 3); i++) {
- *output++ = *src++;
+ *output++ = bytestream2_get_byteu(gb);
}
// RLE8 copy is actually padded - and runs are not!
if(depth == 8 && (p2 & 1)) {
- src++;
+ bytestream2_skip(gb, 1);
}
} else if (depth == 16) {
for(i = 0; i < p2; i++) {
- pix16 = AV_RL16(src);
- src += 2;
- *(uint16_t*)output = pix16;
+ *(uint16_t*)output = bytestream2_get_le16u(gb);
output += 2;
}
} else if (depth == 32) {
for(i = 0; i < p2; i++) {
- pix32 = AV_RL32(src);
- src += 4;
- *(uint32_t*)output = pix32;
+ *(uint32_t*)output = bytestream2_get_le32u(gb);
output += 4;
}
}
@@ -203,21 +204,19 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
} else { //run of pixels
uint8_t pix[3]; //original pixel
switch(depth){
- case 8: pix[0] = *src++;
+ case 8: pix[0] = bytestream2_get_byte(gb);
break;
- case 16: pix16 = AV_RL16(src);
- src += 2;
+ case 16: pix16 = bytestream2_get_le16(gb);
break;
- case 24: pix[0] = *src++;
- pix[1] = *src++;
- pix[2] = *src++;
+ case 24: pix[0] = bytestream2_get_byte(gb);
+ pix[1] = bytestream2_get_byte(gb);
+ pix[2] = bytestream2_get_byte(gb);
break;
- case 32: pix32 = AV_RL32(src);
- src += 4;
+ case 32: pix32 = bytestream2_get_le32(gb);
break;
}
- if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end)
- ||(pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end))
+ if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) ||
+ (pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end))
continue;
for(i = 0; i < p1; i++) {
switch(depth){
@@ -244,17 +243,17 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int de
}
-int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth,
- const uint8_t* data, int data_size)
+int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic,
+ int depth, GetByteContext *gb)
{
switch(depth){
case 4:
- return msrle_decode_pal4(avctx, pic, data, data_size);
+ return msrle_decode_pal4(avctx, pic, gb);
case 8:
case 16:
case 24:
case 32:
- return msrle_decode_8_16_24_32(avctx, pic, depth, data, data_size);
+ return msrle_decode_8_16_24_32(avctx, pic, depth, gb);
default:
av_log(avctx, AV_LOG_ERROR, "Unknown depth %d\n", depth);
return -1;
diff --git a/libavcodec/msrledec.h b/libavcodec/msrledec.h
index b45ea48bc1..3f666360c5 100644
--- a/libavcodec/msrledec.h
+++ b/libavcodec/msrledec.h
@@ -23,6 +23,7 @@
#define AVCODEC_MSRLEDEC_H
#include "avcodec.h"
+#include "bytestream.h"
/**
* Decode stream in MS RLE format into frame.
@@ -30,10 +31,9 @@
* @param avctx codec context
* @param pic destination frame
* @param depth bit depth
- * @param data input stream
- * @param data_size input size
+ * @param gb input bytestream context
*/
-int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth,
- const uint8_t* data, int data_size);
+int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic,
+ int depth, GetByteContext *gb);
#endif /* AVCODEC_MSRLEDEC_H */
diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile
index d15fe2a1c9..31f4fb8ecd 100644
--- a/libavcodec/ppc/Makefile
+++ b/libavcodec/ppc/Makefile
@@ -11,7 +11,7 @@ ALTIVEC-OBJS-$(CONFIG_VP5_DECODER) += ppc/vp3dsp_altivec.o
ALTIVEC-OBJS-$(CONFIG_VP6_DECODER) += ppc/vp3dsp_altivec.o
ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o
-OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \
+ALTIVEC-OBJS += ppc/dsputil_altivec.o \
ppc/fdct_altivec.o \
ppc/float_altivec.o \
ppc/fmtconvert_altivec.o \
@@ -19,4 +19,3 @@ OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \
ppc/idct_altivec.o \
ppc/int_altivec.o \
ppc/mpegvideo_altivec.o \
- $(ALTIVEC-OBJS-yes)
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 7a8fae2611..bfac583973 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -69,8 +69,6 @@ do { \
#define SB_DITHERING_NOISE(sb,noise_idx) (noise_table[(noise_idx)++] * sb_noise_attenuation[(sb)])
-#define BITS_LEFT(length,gb) ((length) - get_bits_count ((gb)))
-
#define SAMPLES_NEEDED \
av_log (NULL,AV_LOG_INFO,"This file triggers some untested code. Please contact the developers.\n");
@@ -202,8 +200,6 @@ typedef struct {
} QDM2Context;
-static uint8_t empty_buffer[FF_INPUT_BUFFER_PADDING_SIZE];
-
static VLC vlc_tab_level;
static VLC vlc_tab_diff;
static VLC vlc_tab_run;
@@ -503,7 +499,7 @@ static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_
int j,k;
int ch;
int run, case_val;
- int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};
+ static const int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};
for (ch = 0; ch < channels; ch++) {
for (j = 0; j < 64; ) {
@@ -793,10 +789,10 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
else if (sb >= 24)
joined_stereo = 1;
else
- joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0;
+ joined_stereo = (get_bits_left(gb) >= 1) ? get_bits1 (gb) : 0;
if (joined_stereo) {
- if (BITS_LEFT(length,gb) >= 16)
+ if (get_bits_left(gb) >= 16)
for (j = 0; j < 16; j++)
sign_bits[j] = get_bits1 (gb);
@@ -809,14 +805,14 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
}
for (ch = 0; ch < channels; ch++) {
- zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0;
+ zero_encoding = (get_bits_left(gb) >= 1) ? get_bits1(gb) : 0;
type34_predictor = 0.0;
type34_first = 1;
for (j = 0; j < 128; ) {
switch (q->coding_method[ch][sb][j / 2]) {
case 8:
- if (BITS_LEFT(length,gb) >= 10) {
+ if (get_bits_left(gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + 2 * k) >= 128)
@@ -838,7 +834,7 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
break;
case 10:
- if (BITS_LEFT(length,gb) >= 1) {
+ if (get_bits_left(gb) >= 1) {
float f = 0.81;
if (get_bits1(gb))
@@ -852,7 +848,7 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
break;
case 16:
- if (BITS_LEFT(length,gb) >= 10) {
+ if (get_bits_left(gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + k) >= 128)
@@ -872,7 +868,7 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
break;
case 24:
- if (BITS_LEFT(length,gb) >= 7) {
+ if (get_bits_left(gb) >= 7) {
n = get_bits(gb, 7);
for (k = 0; k < 3; k++)
samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5;
@@ -884,7 +880,7 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
break;
case 30:
- if (BITS_LEFT(length,gb) >= 4) {
+ if (get_bits_left(gb) >= 4) {
unsigned v = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1);
if (v >= FF_ARRAY_ELEMS(type30_dequant))
return AVERROR_INVALIDDATA;
@@ -896,7 +892,7 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
break;
case 34:
- if (BITS_LEFT(length,gb) >= 7) {
+ if (get_bits_left(gb) >= 7) {
if (type34_first) {
type34_div = (float)(1 << get_bits(gb, 2));
samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0;
@@ -953,27 +949,26 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
*
* @param quantized_coeffs pointer to quantized_coeffs[ch][0]
* @param gb bitreader context
- * @param length packet length in bits
*/
-static int init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext *gb, int length)
+static int init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext *gb)
{
int i, k, run, level, diff;
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
return -1;
level = qdm2_get_vlc(gb, &vlc_tab_level, 0, 2);
quantized_coeffs[0] = level;
for (i = 0; i < 7; ) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
return -1;
run = qdm2_get_vlc(gb, &vlc_tab_run, 0, 1) + 1;
if (i + run >= 8)
return -1;
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
return -1;
diff = qdm2_get_se_vlc(&vlc_tab_diff, gb, 2);
@@ -994,16 +989,15 @@ static int init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext
*
* @param q context
* @param gb bitreader context
- * @param length packet length in bits
*/
-static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length)
+static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb)
{
int sb, j, k, n, ch;
for (ch = 0; ch < q->nb_channels; ch++) {
- init_quantized_coeffs_elem0(q->quantized_coeffs[ch][0], gb, length);
+ init_quantized_coeffs_elem0(q->quantized_coeffs[ch][0], gb);
- if (BITS_LEFT(length,gb) < 16) {
+ if (get_bits_left(gb) < 16) {
memset(q->quantized_coeffs[ch][0], 0, 8);
break;
}
@@ -1014,11 +1008,11 @@ static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, i
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++)
for (j = 0; j < 8; j++) {
- if (BITS_LEFT(length,gb) < 1)
+ if (get_bits_left(gb) < 1)
break;
if (get_bits1(gb)) {
for (k=0; k < 8; k++) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
q->tone_level_idx_hi1[ch][sb][j][k] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi1, 0, 2);
}
@@ -1032,7 +1026,7 @@ static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, i
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
q->tone_level_idx_hi2[ch][sb] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi2, 0, 2);
if (sb > 19)
@@ -1047,7 +1041,7 @@ static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, i
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++)
for (j = 0; j < 8; j++) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
q->tone_level_idx_mid[ch][sb][j] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_mid, 0, 2) - 32;
}
@@ -1103,14 +1097,13 @@ static int process_subpacket_9 (QDM2Context *q, QDM2SubPNode *node)
* @param node pointer to node with packet
* @param length packet length in bits
*/
-static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node, int length)
+static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node)
{
GetBitContext gb;
- init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
-
- if (length != 0) {
- init_tone_level_dequantization(q, &gb, length);
+ if (node) {
+ init_get_bits(&gb, node->packet->data, node->packet->size * 8);
+ init_tone_level_dequantization(q, &gb);
fill_tone_level_array(q, 1);
} else {
fill_tone_level_array(q, 0);
@@ -1123,13 +1116,17 @@ static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node, int length
*
* @param q context
* @param node pointer to node with packet
- * @param length packet length in bit
*/
-static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node, int length)
+static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node)
{
GetBitContext gb;
+ int length = 0;
+
+ if (node) {
+ length = node->packet->size * 8;
+ init_get_bits(&gb, node->packet->data, length);
+ }
- init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
if (length >= 32) {
int c = get_bits (&gb, 13);
@@ -1149,11 +1146,16 @@ static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node, int length
* @param node pointer to node with packet
* @param length packet length in bits
*/
-static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node, int length)
+static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node)
{
GetBitContext gb;
+ int length = 0;
+
+ if (node) {
+ length = node->packet->size * 8;
+ init_get_bits(&gb, node->packet->data, length);
+ }
- init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
synthfilt_build_sb_samples(q, &gb, length, 8, QDM2_SB_USED(q->sub_sampling));
}
@@ -1173,21 +1175,21 @@ static void process_synthesis_subpackets (QDM2Context *q, QDM2SubPNode *list)
nodes[1] = qdm2_search_subpacket_type_in_list(list, 10);
if (nodes[1] != NULL)
- process_subpacket_10(q, nodes[1], nodes[1]->packet->size << 3);
+ process_subpacket_10(q, nodes[1]);
else
- process_subpacket_10(q, NULL, 0);
+ process_subpacket_10(q, NULL);
nodes[2] = qdm2_search_subpacket_type_in_list(list, 11);
if (nodes[0] != NULL && nodes[1] != NULL && nodes[2] != NULL)
- process_subpacket_11(q, nodes[2], (nodes[2]->packet->size << 3));
+ process_subpacket_11(q, nodes[2]);
else
- process_subpacket_11(q, NULL, 0);
+ process_subpacket_11(q, NULL);
nodes[3] = qdm2_search_subpacket_type_in_list(list, 12);
if (nodes[0] != NULL && nodes[1] != NULL && nodes[3] != NULL)
- process_subpacket_12(q, nodes[3], (nodes[3]->packet->size << 3));
+ process_subpacket_12(q, nodes[3]);
else
- process_subpacket_12(q, NULL, 0);
+ process_subpacket_12(q, NULL);
}
@@ -1309,9 +1311,9 @@ static void qdm2_decode_super_block (QDM2Context *q)
process_synthesis_subpackets(q, q->sub_packet_list_D);
q->do_synth_filter = 1;
} else if (q->do_synth_filter) {
- process_subpacket_10(q, NULL, 0);
- process_subpacket_11(q, NULL, 0);
- process_subpacket_12(q, NULL, 0);
+ process_subpacket_10(q, NULL);
+ process_subpacket_11(q, NULL);
+ process_subpacket_12(q, NULL);
}
/* **************************************************************** */
}
diff --git a/libavcodec/sparc/Makefile b/libavcodec/sparc/Makefile
index d42bed0779..1b6ac81ca0 100644
--- a/libavcodec/sparc/Makefile
+++ b/libavcodec/sparc/Makefile
@@ -1,2 +1,2 @@
-OBJS-$(HAVE_VIS) += sparc/dsputil_vis.o \
- sparc/simple_idct_vis.o \
+VIS-OBJS += sparc/dsputil_vis.o \
+ sparc/simple_idct_vis.o \
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index e6c9492edc..476697075e 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -58,6 +58,7 @@ typedef struct TsccContext {
unsigned int decomp_size;
// Decompression buffer
unsigned char* decomp_buf;
+ GetByteContext gb;
int height;
z_stream zstream;
@@ -105,8 +106,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
- if(zret != Z_DATA_ERROR)
- ff_msrle_decode(avctx, (AVPicture*)&c->pic, c->bpp, c->decomp_buf, c->decomp_size - c->zstream.avail_out);
+ if (zret != Z_DATA_ERROR) {
+ bytestream2_init(&c->gb, c->decomp_buf,
+ c->decomp_size - c->zstream.avail_out);
+ ff_msrle_decode(avctx, (AVPicture*)&c->pic, c->bpp, &c->gb);
+ }
/* make the palette available on the way out */
if (c->avctx->pix_fmt == PIX_FMT_PAL8) {
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index b0a1c7ef77..f633cf63e9 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -2,7 +2,7 @@ OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o
OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
-OBJS-$(HAVE_MMX) += x86/dsputil_mmx.o \
+MMX-OBJS += x86/dsputil_mmx.o \
x86/fdct_mmx.o \
x86/fmtconvert_mmx.o \
x86/idct_mmx_xvid.o \
@@ -74,7 +74,6 @@ YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp.o \
x86/vp56dsp.o
YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o
-MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \
+YASM-OBJS += x86/dsputil_yasm.o \
x86/deinterlace.o \
x86/fmtconvert.o \
- $(YASM-OBJS-yes)
diff --git a/libavcodec/x86/diracdsp_yasm.asm b/libavcodec/x86/diracdsp_yasm.asm
index 72f57e6049..5b0f670824 100644
--- a/libavcodec/x86/diracdsp_yasm.asm
+++ b/libavcodec/x86/diracdsp_yasm.asm
@@ -136,10 +136,10 @@ cglobal put_signed_rect_clamped_%1, 5,7,3, dst, dst_stride, src, src_stride, w,
and wd, ~(mmsize-1)
%if ARCH_X86_64
- mov r10d, r5m
- mov r11d, wd
- %define wspill r11d
- %define hd r10d
+ mov r7d, r5m
+ mov r8d, wd
+ %define wspill r8d
+ %define hd r7d
%else
mov r4m, wd
%define wspill r4m
diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm
index 9708e66d3a..568ad29769 100644
--- a/libavcodec/x86/dsputil_yasm.asm
+++ b/libavcodec/x86/dsputil_yasm.asm
@@ -497,9 +497,9 @@ cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset
%macro EMU_EDGE_FUNC 0
%if ARCH_X86_64
-%define w_reg r10
-cglobal emu_edge_core, 6, 7, 1
- mov r11, r5 ; save block_h
+%define w_reg r7
+cglobal emu_edge_core, 6, 9, 1
+ mov r8, r5 ; save block_h
%else
%define w_reg r6
cglobal emu_edge_core, 2, 7, 0
@@ -536,7 +536,7 @@ cglobal emu_edge_core, 2, 7, 0
sub r0, w_reg
%if ARCH_X86_64
mov r3, r0 ; backup of buf+block_h*linesize
- mov r5, r11
+ mov r5, r8
%else
mov r0m, r0 ; backup of buf+block_h*linesize
mov r5, r5m
@@ -550,7 +550,7 @@ cglobal emu_edge_core, 2, 7, 0
; FIXME we can do a if size == 1 here if that makes any speed difference, test me
sar w_reg, 1
sal w_reg, 6
- ; r0=buf+block_h*linesize,r10(64)/r6(32)=start_x offset for funcs
+ ; r0=buf+block_h*linesize,r7(64)/r6(32)=start_x offset for funcs
; r6(rax)/r3(ebx)=val,r2=linesize,r1=start_x,r5=block_h
%ifdef PIC
lea rax, [.emuedge_extend_left_2]
@@ -560,7 +560,7 @@ cglobal emu_edge_core, 2, 7, 0
%endif
call w_reg
- ; now r3(64)/r0(32)=buf,r2=linesize,r11/r5=block_h,r6/r3=val, r10/r6=end_x, r1=block_w
+ ; now r3(64)/r0(32)=buf,r2=linesize,r8/r5=block_h,r6/r3=val, r7/r6=end_x, r1=block_w
.right_extend:
%if ARCH_X86_32
mov r0, r0m
@@ -591,7 +591,7 @@ cglobal emu_edge_core, 2, 7, 0
%define vall al
%define valh ah
%define valw ax
-%define valw2 r10w
+%define valw2 r7w
%define valw3 r3w
%if WIN64
%define valw4 r4w
@@ -618,7 +618,7 @@ cglobal emu_edge_core, 2, 7, 0
; - else if (%2 & 8) fills 8 bytes into mm0
; - if (%2 & 7 == 4) fills the last 4 bytes into rax
; - else if (%2 & 4) fills 4 bytes into mm0-1
-; - if (%2 & 3 == 3) fills 2 bytes into r10/r3, and 1 into eax
+; - if (%2 & 3 == 3) fills 2 bytes into r7/r3, and 1 into eax
; (note that we're using r3 for body/bottom because it's a shorter
; opcode, and then the loop fits in 128 bytes)
; - else fills remaining bytes into rax
@@ -848,7 +848,7 @@ ALIGN 64
%endrep
%endmacro ; LEFT_EXTEND
-; r3/r0=buf+block_h*linesize, r2=linesize, r11/r5=block_h, r0/r6=end_x, r6/r3=val
+; r3/r0=buf+block_h*linesize, r2=linesize, r8/r5=block_h, r0/r6=end_x, r6/r3=val
%macro RIGHT_EXTEND 0
%assign %%n 2
%rep 11
@@ -858,7 +858,7 @@ ALIGN 64
sub r3, r2 ; dst -= linesize
READ_V_PIXEL %%n, [r3+w_reg-1] ; read pixels
WRITE_V_PIXEL %%n, r3+r4-%%n ; write pixels
- dec r11
+ dec r8
%else ; ARCH_X86_32
sub r0, r2 ; dst -= linesize
READ_V_PIXEL %%n, [r0+w_reg-1] ; read pixels
@@ -937,11 +937,11 @@ ALIGN 64
%macro SLOW_V_EXTEND 0
.slow_v_extend_loop:
; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
-; r11(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r10(64)/r6(32)=w=end_x-start_x
+; r8(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r7(64)/r6(32)=w=end_x-start_x
%if ARCH_X86_64
- push r11 ; save old value of block_h
+ push r8 ; save old value of block_h
test r3, r3
-%define cnt_reg r11
+%define cnt_reg r8
jz .do_body_copy ; if (!start_y) goto do_body_copy
V_COPY_ROW top, r3
%else
@@ -955,7 +955,7 @@ ALIGN 64
V_COPY_ROW body, r4
%if ARCH_X86_64
- pop r11 ; restore old value of block_h
+ pop r8 ; restore old value of block_h
%define cnt_reg r3
%endif
test r5, r5
@@ -974,7 +974,7 @@ ALIGN 64
%macro SLOW_LEFT_EXTEND 0
.slow_left_extend_loop:
-; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r10/r6=start_x
+; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r7/r6=start_x
mov r4, 8
sub r0, linesize
READ_V_PIXEL 8, [r0+w_reg]
@@ -1002,11 +1002,11 @@ ALIGN 64
%macro SLOW_RIGHT_EXTEND 0
.slow_right_extend_loop:
-; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r11(64)/r5(32)=block_h,
-; r10(64)/r6(32)=end_x,r6/r3=val,r1=cntr
+; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r8(64)/r5(32)=block_h,
+; r7(64)/r6(32)=end_x,r6/r3=val,r1=cntr
%if ARCH_X86_64
%define buf_reg r3
-%define bh_reg r11
+%define bh_reg r8
%else
%define buf_reg r0
%define bh_reg r5
diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index f8ccd3f5bb..e242d2120a 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -750,14 +750,11 @@ INIT_XMM
%endmacro
%macro DECL_IMDCT 2
-cglobal imdct_half%1, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *input
+cglobal imdct_half%1, 3,12,8; FFTContext *s, FFTSample *output, const FFTSample *input
%if ARCH_X86_64
-%define rrevtab r10
-%define rtcos r11
-%define rtsin r12
- push r12
- push r13
- push r14
+%define rrevtab r7
+%define rtcos r8
+%define rtsin r9
%else
%define rrevtab r6
%define rtsin r6
@@ -799,12 +796,12 @@ cglobal imdct_half%1, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *
%if ARCH_X86_64
movzx r5, word [rrevtab+r4-4]
movzx r6, word [rrevtab+r4-2]
- movzx r13, word [rrevtab+r3]
- movzx r14, word [rrevtab+r3+2]
+ movzx r10, word [rrevtab+r3]
+ movzx r11, word [rrevtab+r3+2]
movlps [r1+r5 *8], xmm0
movhps [r1+r6 *8], xmm0
- movlps [r1+r13*8], xmm1
- movhps [r1+r14*8], xmm1
+ movlps [r1+r10*8], xmm1
+ movhps [r1+r11*8], xmm1
add r4, 4
%else
mov r6, [esp]
@@ -840,11 +837,7 @@ cglobal imdct_half%1, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *
mov r1, -mmsize
sub r1, r0
%2 r0, r1, r6, rtcos, rtsin
-%if ARCH_X86_64
- pop r14
- pop r13
- pop r12
-%else
+%if ARCH_X86_64 == 0
add esp, 12
%endif
%ifidn avx_enabled, 1
diff --git a/libavcodec/x86/fmtconvert.asm b/libavcodec/x86/fmtconvert.asm
index ca39aa30f8..72bee55669 100644
--- a/libavcodec/x86/fmtconvert.asm
+++ b/libavcodec/x86/fmtconvert.asm
@@ -179,9 +179,8 @@ FLOAT_TO_INT16_INTERLEAVE2 sse2
%macro FLOAT_TO_INT16_INTERLEAVE6 1
; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
-cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5
+cglobal float_to_int16_interleave6_%1, 2,8,0, dst, src, src1, src2, src3, src4, src5, len
%if ARCH_X86_64
- %define lend r10d
mov lend, r2d
%else
%define lend dword r2m
@@ -240,9 +239,8 @@ FLOAT_TO_INT16_INTERLEAVE6 3dn2
;-----------------------------------------------------------------------------
%macro FLOAT_INTERLEAVE6 2
-cglobal float_interleave6_%1, 2,7,%2, dst, src, src1, src2, src3, src4, src5
+cglobal float_interleave6_%1, 2,8,%2, dst, src, src1, src2, src3, src4, src5, len
%if ARCH_X86_64
- %define lend r10d
mov lend, r2d
%else
%define lend dword r2m
diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm
index fc615c7bc7..4155947e58 100644
--- a/libavcodec/x86/h264_chromamc.asm
+++ b/libavcodec/x86/h264_chromamc.asm
@@ -91,9 +91,22 @@ SECTION .text
%endmacro
%macro chroma_mc8_mmx_func 3
+%ifidn %2, rv40
+%ifdef PIC
+%define rnd_1d_rv40 r8
+%define rnd_2d_rv40 r8
+%define extra_regs 2
+%else ; no-PIC
+%define rnd_1d_rv40 rnd_rv40_1d_tbl
+%define rnd_2d_rv40 rnd_rv40_2d_tbl
+%define extra_regs 1
+%endif ; PIC
+%else
+%define extra_regs 0
+%endif ; rv40
; put/avg_h264_chroma_mc8_mmx_*(uint8_t *dst /*align 8*/, uint8_t *src /*align 1*/,
; int stride, int h, int mx, int my)
-cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
+cglobal %1_%2_chroma_mc8_%3, 6, 7 + extra_regs, 0
%if ARCH_X86_64
movsxd r2, r2d
%endif
@@ -106,19 +119,12 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
.at_least_one_non_zero
%ifidn %2, rv40
-%ifdef PIC
-%define rnd_1d_rv40 r11
-%define rnd_2d_rv40 r11
-%else ; no-PIC
-%define rnd_1d_rv40 rnd_rv40_1d_tbl
-%define rnd_2d_rv40 rnd_rv40_2d_tbl
-%endif
%if ARCH_X86_64
- mov r10, r5
- and r10, 6 ; &~1 for mx/my=[0,7]
- lea r10, [r10*4+r4]
- sar r10d, 1
-%define rnd_bias r10
+ mov r7, r5
+ and r7, 6 ; &~1 for mx/my=[0,7]
+ lea r7, [r7*4+r4]
+ sar r7d, 1
+%define rnd_bias r7
%define dest_reg r0
%else ; x86-32
mov r0, r5
@@ -145,7 +151,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
%ifidn %2, rv40
%ifdef PIC
- lea r11, [rnd_rv40_1d_tbl]
+ lea r8, [rnd_rv40_1d_tbl]
%endif
%if ARCH_X86_64 == 0
mov r5, r0m
@@ -196,7 +202,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
movd m6, r5d ; y
%ifidn %2, rv40
%ifdef PIC
- lea r11, [rnd_rv40_2d_tbl]
+ lea r8, [rnd_rv40_2d_tbl]
%endif
%if ARCH_X86_64 == 0
mov r5, r0m
@@ -278,7 +284,13 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
%endmacro
%macro chroma_mc4_mmx_func 3
-cglobal %1_%2_chroma_mc4_%3, 6, 6, 0
+%define extra_regs 0
+%ifidn %2, rv40
+%ifdef PIC
+%define extra_regs 1
+%endif ; PIC
+%endif ; rv40
+cglobal %1_%2_chroma_mc4_%3, 6, 6 + extra_regs, 0
%if ARCH_X86_64
movsxd r2, r2d
%endif
@@ -296,8 +308,8 @@ cglobal %1_%2_chroma_mc4_%3, 6, 6, 0
%ifidn %2, rv40
%ifdef PIC
- lea r11, [rnd_rv40_2d_tbl]
-%define rnd_2d_rv40 r11
+ lea r6, [rnd_rv40_2d_tbl]
+%define rnd_2d_rv40 r6
%else
%define rnd_2d_rv40 rnd_rv40_2d_tbl
%endif
diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm
index d2f8d0e3e9..2f33f320a1 100644
--- a/libavcodec/x86/h264_deblock.asm
+++ b/libavcodec/x86/h264_deblock.asm
@@ -328,11 +328,11 @@ cglobal deblock_v_luma_8_%1, 5,5,10
; void deblock_h_luma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
INIT_MMX
-cglobal deblock_h_luma_8_%1, 5,7
- movsxd r10, r1d
- lea r11, [r10+r10*2]
+cglobal deblock_h_luma_8_%1, 5,9
+ movsxd r7, r1d
+ lea r8, [r7+r7*2]
lea r6, [r0-4]
- lea r5, [r0-4+r11]
+ lea r5, [r0-4+r8]
%if WIN64
sub rsp, 0x98
%define pix_tmp rsp+0x30
@@ -342,14 +342,14 @@ cglobal deblock_h_luma_8_%1, 5,7
%endif
; transpose 6x16 -> tmp space
- TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp
- lea r6, [r6+r10*8]
- lea r5, [r5+r10*8]
- TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp+8
+ TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r7, r8), pix_tmp
+ lea r6, [r6+r7*8]
+ lea r5, [r5+r7*8]
+ TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r7, r8), pix_tmp+8
; vertical filter
; alpha, beta, tc0 are still in r2d, r3d, r4
- ; don't backup r6, r5, r10, r11 because deblock_v_luma_sse2 doesn't use them
+ ; don't backup r6, r5, r7, r8 because deblock_v_luma_sse2 doesn't use them
lea r0, [pix_tmp+0x30]
mov r1d, 0x10
%if WIN64
@@ -364,17 +364,17 @@ cglobal deblock_h_luma_8_%1, 5,7
movq m1, [pix_tmp+0x28]
movq m2, [pix_tmp+0x38]
movq m3, [pix_tmp+0x48]
- TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r10, r11)
+ TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r7, r8)
- shl r10, 3
- sub r6, r10
- sub r5, r10
- shr r10, 3
+ shl r7, 3
+ sub r6, r7
+ sub r5, r7
+ shr r7, 3
movq m0, [pix_tmp+0x10]
movq m1, [pix_tmp+0x20]
movq m2, [pix_tmp+0x30]
movq m3, [pix_tmp+0x40]
- TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r10, r11)
+ TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r7, r8)
%if WIN64
add rsp, 0x98
@@ -709,32 +709,32 @@ INIT_MMX
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint8_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_h_luma_intra_8_%1, 4,7
- movsxd r10, r1d
- lea r11, [r10*3]
+cglobal deblock_h_luma_intra_8_%1, 4,9
+ movsxd r7, r1d
+ lea r8, [r7*3]
lea r6, [r0-4]
- lea r5, [r0-4+r11]
+ lea r5, [r0-4+r8]
sub rsp, 0x88
%define pix_tmp rsp
; transpose 8x16 -> tmp space
- TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
- lea r6, [r6+r10*8]
- lea r5, [r5+r10*8]
- TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
+ TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r7, r8), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
+ lea r6, [r6+r7*8]
+ lea r5, [r5+r7*8]
+ TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r7, r8), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
lea r0, [pix_tmp+0x40]
mov r1, 0x10
call deblock_v_luma_intra_8_%1
; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8)
- lea r5, [r6+r11]
- TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11)
- shl r10, 3
- sub r6, r10
- sub r5, r10
- shr r10, 3
- TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11)
+ lea r5, [r6+r8]
+ TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r7, r8)
+ shl r7, 3
+ sub r6, r7
+ sub r5, r7
+ shr r7, 3
+ TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r7, r8)
add rsp, 0x88
RET
%else
diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
index 25f4755fa1..da045f71e2 100644
--- a/libavcodec/x86/h264_idct.asm
+++ b/libavcodec/x86/h264_idct.asm
@@ -45,8 +45,10 @@ scan8_mem: db 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8
db 4+13*8, 5+13*8, 4+14*8, 5+14*8
db 6+13*8, 7+13*8, 6+14*8, 7+14*8
%ifdef PIC
-%define scan8 r11
+%define npicregs 1
+%define scan8 picregq
%else
+%define npicregs 0
%define scan8 scan8_mem
%endif
@@ -301,10 +303,10 @@ cglobal h264_idct8_dc_add_8_mmx2, 3, 3, 0
; ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16_8_mmx, 5, 7, 0
+cglobal h264_idct_add16_8_mmx, 5, 7 + npicregs, 0, dst, block_offset, block, stride, nnzc, cntr, coeff, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -323,13 +325,13 @@ cglobal h264_idct_add16_8_mmx, 5, 7, 0
; ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct8_add4_8_mmx, 5, 7, 0
+cglobal h264_idct8_add4_8_mmx, 5, 7 + npicregs, 0, dst, block_offset, block, stride, nnzc, cntr, coeff, picreg
%assign pad 128+4-(stack_offset&7)
SUB rsp, pad
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -355,10 +357,10 @@ cglobal h264_idct8_add4_8_mmx, 5, 7, 0
; ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16_8_mmx2, 5, 7, 0
+cglobal h264_idct_add16_8_mmx2, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -371,16 +373,13 @@ cglobal h264_idct_add16_8_mmx2, 5, 7, 0
test r6, r6
jz .no_dc
DC_ADD_MMX2_INIT r2, r3, r6
-%if ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
%endif
- mov dst_regd, dword [r1+r5*4]
- lea dst_reg, [r0+dst_reg]
- DC_ADD_MMX2_OP movh, dst_reg, r3, r6
+ mov dst2d, dword [r1+r5*4]
+ lea dst2q, [r0+dst2q]
+ DC_ADD_MMX2_OP movh, dst2q, r3, r6
%if ARCH_X86_64 == 0
mov r1, r1m
%endif
@@ -402,10 +401,10 @@ cglobal h264_idct_add16_8_mmx2, 5, 7, 0
; ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16intra_8_mmx, 5, 7, 0
+cglobal h264_idct_add16intra_8_mmx, 5, 7 + npicregs, 0, dst, block_offset, block, stride, nnzc, cntr, coeff, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -425,10 +424,10 @@ cglobal h264_idct_add16intra_8_mmx, 5, 7, 0
; ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16intra_8_mmx2, 5, 7, 0
+cglobal h264_idct_add16intra_8_mmx2, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -448,16 +447,13 @@ cglobal h264_idct_add16intra_8_mmx2, 5, 7, 0
test r6, r6
jz .skipblock
DC_ADD_MMX2_INIT r2, r3, r6
-%if ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
%endif
- mov dst_regd, dword [r1+r5*4]
- add dst_reg, r0
- DC_ADD_MMX2_OP movh, dst_reg, r3, r6
+ mov dst2d, dword [r1+r5*4]
+ add dst2q, r0
+ DC_ADD_MMX2_OP movh, dst2q, r3, r6
%if ARCH_X86_64 == 0
mov r1, r1m
%endif
@@ -470,13 +466,13 @@ cglobal h264_idct_add16intra_8_mmx2, 5, 7, 0
; ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
+cglobal h264_idct8_add4_8_mmx2, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
%assign pad 128+4-(stack_offset&7)
SUB rsp, pad
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -489,18 +485,15 @@ cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
test r6, r6
jz .no_dc
DC_ADD_MMX2_INIT r2, r3, r6
-%if ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
-%endif
- mov dst_regd, dword [r1+r5*4]
- lea dst_reg, [r0+dst_reg]
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
- lea dst_reg, [dst_reg+r3*4]
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
+%endif
+ mov dst2d, dword [r1+r5*4]
+ lea dst2q, [r0+dst2q]
+ DC_ADD_MMX2_OP mova, dst2q, r3, r6
+ lea dst2q, [dst2q+r3*4]
+ DC_ADD_MMX2_OP mova, dst2q, r3, r6
%if ARCH_X86_64 == 0
mov r1, r1m
%endif
@@ -533,10 +526,10 @@ cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
INIT_XMM
; ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct8_add4_8_sse2, 5, 7, 10
+cglobal h264_idct8_add4_8_sse2, 5, 8 + npicregs, 10, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
.nextblock
movzx r6, byte [scan8+r5]
@@ -550,18 +543,15 @@ cglobal h264_idct8_add4_8_sse2, 5, 7, 10
jz .no_dc
INIT_MMX
DC_ADD_MMX2_INIT r2, r3, r6
-%if ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
-%endif
- mov dst_regd, dword [r1+r5*4]
- add dst_reg, r0
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
- lea dst_reg, [dst_reg+r3*4]
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
+%endif
+ mov dst2d, dword [r1+r5*4]
+ add dst2q, r0
+ DC_ADD_MMX2_OP mova, dst2q, r3, r6
+ lea dst2q, [dst2q+r3*4]
+ DC_ADD_MMX2_OP mova, dst2q, r3, r6
%if ARCH_X86_64 == 0
mov r1, r1m
%endif
@@ -572,9 +562,9 @@ INIT_MMX
REP_RET
.no_dc
INIT_XMM
- mov dst_regd, dword [r1+r5*4]
- add dst_reg, r0
- IDCT8_ADD_SSE dst_reg, r2, r3, r6
+ mov dst2d, dword [r1+r5*4]
+ add dst2q, r0
+ IDCT8_ADD_SSE dst2q, r2, r3, r6
%if ARCH_X86_64 == 0
mov r1, r1m
%endif
@@ -595,7 +585,7 @@ h264_idct_add8_mmx_plane:
jz .skipblock
%if ARCH_X86_64
mov r0d, dword [r1+r5*4]
- add r0, [r10]
+ add r0, [dst2q]
%else
mov r0, r1m ; XXX r1m here is actually r0m of the calling func
mov r0, [r0]
@@ -611,20 +601,20 @@ h264_idct_add8_mmx_plane:
; ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add8_8_mmx, 5, 7, 0
+cglobal h264_idct_add8_8_mmx, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
mov r5, 16
add r2, 512
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
%if ARCH_X86_64
- mov r10, r0
+ mov dst2q, r0
%endif
call h264_idct_add8_mmx_plane
mov r5, 32
add r2, 384
%if ARCH_X86_64
- add r10, gprsize
+ add dst2q, gprsize
%else
add r0mp, gprsize
%endif
@@ -639,7 +629,7 @@ h264_idct_add8_mmx2_plane
jz .try_dc
%if ARCH_X86_64
mov r0d, dword [r1+r5*4]
- add r0, [r10]
+ add r0, [dst2q]
%else
mov r0, r1m ; XXX r1m here is actually r0m of the calling func
mov r0, [r0]
@@ -658,7 +648,7 @@ h264_idct_add8_mmx2_plane
DC_ADD_MMX2_INIT r2, r3, r6
%if ARCH_X86_64
mov r0d, dword [r1+r5*4]
- add r0, [r10]
+ add r0, [dst2q]
%else
mov r0, r1m ; XXX r1m here is actually r0m of the calling func
mov r0, [r0]
@@ -674,20 +664,20 @@ h264_idct_add8_mmx2_plane
; ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add8_8_mmx2, 5, 7, 0
+cglobal h264_idct_add8_8_mmx2, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
mov r5, 16
add r2, 512
%if ARCH_X86_64
- mov r10, r0
+ mov dst2q, r0
%endif
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
call h264_idct_add8_mmx2_plane
mov r5, 32
add r2, 384
%if ARCH_X86_64
- add r10, gprsize
+ add dst2q, gprsize
%else
add r0mp, gprsize
%endif
@@ -739,7 +729,7 @@ x264_add8x4_idct_sse2:
jz .cycle%1end
mov r0d, dword [r1+%1*8]
%if ARCH_X86_64
- add r0, r10
+ add r0, r5
%else
add r0, r0m
%endif
@@ -752,9 +742,9 @@ x264_add8x4_idct_sse2:
; ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16_8_sse2, 5, 5, 8
+cglobal h264_idct_add16_8_sse2, 5, 5 + ARCH_X86_64, 8
%if ARCH_X86_64
- mov r10, r0
+ mov r5, r0
%endif
; unrolling of the loop leads to an average performance gain of
; 20-25%
@@ -774,7 +764,7 @@ cglobal h264_idct_add16_8_sse2, 5, 5, 8
jz .try%1dc
mov r0d, dword [r1+%1*8]
%if ARCH_X86_64
- add r0, r10
+ add r0, r7
%else
add r0, r0m
%endif
@@ -786,7 +776,7 @@ cglobal h264_idct_add16_8_sse2, 5, 5, 8
jz .cycle%1end
mov r0d, dword [r1+%1*8]
%if ARCH_X86_64
- add r0, r10
+ add r0, r7
%else
add r0, r0m
%endif
@@ -799,9 +789,9 @@ cglobal h264_idct_add16_8_sse2, 5, 5, 8
; ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
+cglobal h264_idct_add16intra_8_sse2, 5, 7 + ARCH_X86_64, 8
%if ARCH_X86_64
- mov r10, r0
+ mov r7, r0
%endif
add16intra_sse2_cycle 0, 0xc
add16intra_sse2_cycle 1, 0x14
@@ -819,7 +809,7 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
jz .try%1dc
%if ARCH_X86_64
mov r0d, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
- add r0, [r10]
+ add r0, [r7]
%else
mov r0, r0m
mov r0, [r0]
@@ -833,7 +823,7 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
jz .cycle%1end
%if ARCH_X86_64
mov r0d, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
- add r0, [r10]
+ add r0, [r7]
%else
mov r0, r0m
mov r0, [r0]
@@ -850,15 +840,15 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
; ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add8_8_sse2, 5, 7, 8
+cglobal h264_idct_add8_8_sse2, 5, 7 + ARCH_X86_64, 8
add r2, 512
%if ARCH_X86_64
- mov r10, r0
+ mov r7, r0
%endif
add8_sse2_cycle 0, 0x34
add8_sse2_cycle 1, 0x3c
%if ARCH_X86_64
- add r10, gprsize
+ add r7, gprsize
%else
add r0mp, gprsize
%endif
diff --git a/libavcodec/x86/h264_idct_10bit.asm b/libavcodec/x86/h264_idct_10bit.asm
index 27a18f47da..a126573347 100644
--- a/libavcodec/x86/h264_idct_10bit.asm
+++ b/libavcodec/x86/h264_idct_10bit.asm
@@ -29,24 +29,6 @@ SECTION_RODATA
pw_pixel_max: times 8 dw ((1 << 10)-1)
pd_32: times 4 dd 32
-scan8_mem: db 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8
- db 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8
- db 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8
- db 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8
- db 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8
- db 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8
- db 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8
- db 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8
- db 4+11*8, 5+11*8, 4+12*8, 5+12*8
- db 6+11*8, 7+11*8, 6+12*8, 7+12*8
- db 4+13*8, 5+13*8, 4+14*8, 5+14*8
- db 6+13*8, 7+13*8, 6+14*8, 7+14*8
-
-%ifdef PIC
-%define scan8 r11
-%else
-%define scan8 scan8_mem
-%endif
SECTION .text
@@ -315,9 +297,9 @@ IDCT_ADD16INTRA_10 avx
; h264_idct_add8(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
;-----------------------------------------------------------------------------
%macro IDCT_ADD8 1
-cglobal h264_idct_add8_10_%1,5,7,7
+cglobal h264_idct_add8_10_%1,5,8,7
%if ARCH_X86_64
- mov r10, r0
+ mov r7, r0
%endif
add r2, 1024
mov r0, [r0]
@@ -325,7 +307,7 @@ cglobal h264_idct_add8_10_%1,5,7,7
ADD16_OP_INTRA %1, 18, 4+ 7*8
add r2, 1024-128*2
%if ARCH_X86_64
- mov r0, [r10+gprsize]
+ mov r0, [r7+gprsize]
%else
mov r0, r0m
mov r0, [r0+gprsize]
diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
index f97d051865..b5d45ddf48 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -289,7 +289,7 @@ cglobal pred16x16_tm_vp8_sse2, 2,6,6
;-----------------------------------------------------------------------------
%macro H264_PRED16x16_PLANE 3
-cglobal pred16x16_plane_%3_%1, 2, 7, %2
+cglobal pred16x16_plane_%3_%1, 2, 9, %2
mov r2, r1 ; +stride
neg r1 ; -stride
@@ -349,7 +349,7 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
add r4, r2
%if ARCH_X86_64
-%define e_reg r11
+%define e_reg r8
%else
%define e_reg r0
%endif
@@ -370,8 +370,8 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movzx e_reg, byte [r3 ]
%if ARCH_X86_64
- movzx r10, byte [r4+r2 ]
- sub r10, e_reg
+ movzx r7, byte [r4+r2 ]
+ sub r7, e_reg
%else
movzx r6, byte [r4+r2 ]
sub r6, e_reg
@@ -386,7 +386,7 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movzx r6, byte [r3 ]
sub r6, r4
%if ARCH_X86_64
- lea r6, [r10+r6*2]
+ lea r6, [r7+r6*2]
lea r5, [r5+r6*2]
add r5, r6
%else
@@ -396,9 +396,9 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movzx r4, byte [e_reg ]
%if ARCH_X86_64
- movzx r10, byte [r3 +r2 ]
- sub r10, r4
- sub r5, r10
+ movzx r7, byte [r3 +r2 ]
+ sub r7, r4
+ sub r5, r7
%else
movzx r6, byte [r3 +r2 ]
sub r6, r4
@@ -410,7 +410,7 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movzx r6, byte [r3 +r2*2]
sub r6, r4
%if ARCH_X86_64
- add r6, r10
+ add r6, r7
%endif
lea r5, [r5+r6*8]
@@ -588,7 +588,7 @@ H264_PRED16x16_PLANE ssse3, 8, svq3
;-----------------------------------------------------------------------------
%macro H264_PRED8x8_PLANE 2
-cglobal pred8x8_plane_%1, 2, 7, %2
+cglobal pred8x8_plane_%1, 2, 9, %2
mov r2, r1 ; +stride
neg r1 ; -stride
@@ -642,7 +642,7 @@ cglobal pred8x8_plane_%1, 2, 7, %2
add r4, r2
%if ARCH_X86_64
-%define e_reg r11
+%define e_reg r8
%else
%define e_reg r0
%endif
@@ -653,9 +653,9 @@ cglobal pred8x8_plane_%1, 2, 7, %2
movzx e_reg, byte [r3 ]
%if ARCH_X86_64
- movzx r10, byte [r4+r2 ]
- sub r10, e_reg
- sub r5, r10
+ movzx r7, byte [r4+r2 ]
+ sub r7, e_reg
+ sub r5, r7
%else
movzx r6, byte [r4+r2 ]
sub r6, e_reg
@@ -667,7 +667,7 @@ cglobal pred8x8_plane_%1, 2, 7, %2
movzx r6, byte [r4+r2*2 ]
sub r6, e_reg
%if ARCH_X86_64
- add r6, r10
+ add r6, r7
%endif
lea r5, [r5+r6*4]
diff --git a/libavcodec/x86/h264_qpel_10bit.asm b/libavcodec/x86/h264_qpel_10bit.asm
index bdacf9f472..788d715d61 100644
--- a/libavcodec/x86/h264_qpel_10bit.asm
+++ b/libavcodec/x86/h264_qpel_10bit.asm
@@ -121,8 +121,8 @@ MCAxA_OP %1,%2,%3,%4,%5,%6,%7,%8
%endmacro
%macro MCAxA_OP 8
-cglobal %2_h264_qpel%5_%3_10_%1, %6,%7,%8
%if ARCH_X86_32
+cglobal %2_h264_qpel%5_%3_10_%1, %6,%7,%8
call stub_%2_h264_qpel%4_%3_10_%1
mov r0, r0m
mov r1, r1m
@@ -141,17 +141,19 @@ cglobal %2_h264_qpel%5_%3_10_%1, %6,%7,%8
call stub_%2_h264_qpel%4_%3_10_%1
RET
%else ; ARCH_X86_64
- mov r10, r0
- mov r11, r1
+cglobal %2_h264_qpel%5_%3_10_%1, %6,%7 + 2,%8
+ mov r%7, r0
+%assign p1 %7+1
+ mov r %+ p1, r1
call stub_%2_h264_qpel%4_%3_10_%1
- lea r0, [r10+%4*2]
- lea r1, [r11+%4*2]
+ lea r0, [r%7+%4*2]
+ lea r1, [r %+ p1+%4*2]
call stub_%2_h264_qpel%4_%3_10_%1
- lea r0, [r10+r2*%4]
- lea r1, [r11+r2*%4]
+ lea r0, [r%7+r2*%4]
+ lea r1, [r %+ p1+r2*%4]
call stub_%2_h264_qpel%4_%3_10_%1
- lea r0, [r10+r2*%4+%4*2]
- lea r1, [r11+r2*%4+%4*2]
+ lea r0, [r%7+r2*%4+%4*2]
+ lea r1, [r %+ p1+r2*%4+%4*2]
%if UNIX64 == 0 ; fall through to function
call stub_%2_h264_qpel%4_%3_10_%1
RET
diff --git a/libavcodec/x86/h264_weight.asm b/libavcodec/x86/h264_weight.asm
index b2fb663e4d..26233bf080 100644
--- a/libavcodec/x86/h264_weight.asm
+++ b/libavcodec/x86/h264_weight.asm
@@ -127,7 +127,7 @@ WEIGHT_FUNC_HALF_MM 8, 8, sse2
%macro BIWEIGHT_SETUP 0
%if ARCH_X86_64
-%define off_regd r11d
+%define off_regd r7d
%else
%define off_regd r3d
%endif
@@ -175,7 +175,7 @@ WEIGHT_FUNC_HALF_MM 8, 8, sse2
%endmacro
INIT_MMX
-cglobal h264_biweight_16_mmx2, 7, 7, 0
+cglobal h264_biweight_16_mmx2, 7, 8, 0
BIWEIGHT_SETUP
movifnidn r3d, r3m
.nextrow
@@ -194,7 +194,7 @@ cglobal h264_biweight_16_mmx2, 7, 7, 0
REP_RET
%macro BIWEIGHT_FUNC_MM 3
-cglobal h264_biweight_%1_%3, 7, 7, %2
+cglobal h264_biweight_%1_%3, 7, 8, %2
BIWEIGHT_SETUP
movifnidn r3d, r3m
.nextrow
@@ -215,7 +215,7 @@ INIT_XMM
BIWEIGHT_FUNC_MM 16, 8, sse2
%macro BIWEIGHT_FUNC_HALF_MM 3
-cglobal h264_biweight_%1_%3, 7, 7, %2
+cglobal h264_biweight_%1_%3, 7, 8, %2
BIWEIGHT_SETUP
movifnidn r3d, r3m
sar r3, 1
@@ -245,7 +245,7 @@ BIWEIGHT_FUNC_HALF_MM 8, 8, sse2
%macro BIWEIGHT_SSSE3_SETUP 0
%if ARCH_X86_64
-%define off_regd r11d
+%define off_regd r7d
%else
%define off_regd r3d
%endif
@@ -284,7 +284,7 @@ BIWEIGHT_FUNC_HALF_MM 8, 8, sse2
%endmacro
INIT_XMM
-cglobal h264_biweight_16_ssse3, 7, 7, 8
+cglobal h264_biweight_16_ssse3, 7, 8, 8
BIWEIGHT_SSSE3_SETUP
movifnidn r3d, r3m
@@ -303,7 +303,7 @@ cglobal h264_biweight_16_ssse3, 7, 7, 8
REP_RET
INIT_XMM
-cglobal h264_biweight_8_ssse3, 7, 7, 8
+cglobal h264_biweight_8_ssse3, 7, 8, 8
BIWEIGHT_SSSE3_SETUP
movifnidn r3d, r3m
sar r3, 1
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index cb68014be5..3745620133 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -57,6 +57,18 @@ AVOutputFormat ff_adx_muxer = {
};
#endif
+#if CONFIG_CAVSVIDEO_MUXER
+AVOutputFormat ff_cavsvideo_muxer = {
+ .name = "cavsvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
+ .extensions = "cavs",
+ .audio_codec = CODEC_ID_NONE,
+ .video_codec = CODEC_ID_CAVS,
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
#if CONFIG_DIRAC_MUXER
AVOutputFormat ff_dirac_muxer = {
.name = "dirac",
@@ -171,18 +183,6 @@ AVOutputFormat ff_h264_muxer = {
};
#endif
-#if CONFIG_CAVSVIDEO_MUXER
-AVOutputFormat ff_cavsvideo_muxer = {
- .name = "cavsvideo",
- .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
- .extensions = "cavs",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_CAVS,
- .write_packet = ff_raw_write_packet,
- .flags = AVFMT_NOTIMESTAMPS,
-};
-#endif
-
#if CONFIG_M4V_MUXER
AVOutputFormat ff_m4v_muxer = {
.name = "m4v",
@@ -220,30 +220,6 @@ AVOutputFormat ff_mlp_muxer = {
};
#endif
-#if CONFIG_SRT_MUXER
-AVOutputFormat ff_srt_muxer = {
- .name = "srt",
- .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
- .mime_type = "application/x-subrip",
- .extensions = "srt",
- .write_packet = ff_raw_write_packet,
- .flags = AVFMT_NOTIMESTAMPS,
- .subtitle_codec = CODEC_ID_SRT,
-};
-#endif
-
-#if CONFIG_TRUEHD_MUXER
-AVOutputFormat ff_truehd_muxer = {
- .name = "truehd",
- .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
- .extensions = "thd",
- .audio_codec = CODEC_ID_TRUEHD,
- .video_codec = CODEC_ID_NONE,
- .write_packet = ff_raw_write_packet,
- .flags = AVFMT_NOTIMESTAMPS,
-};
-#endif
-
#if CONFIG_MPEG1VIDEO_MUXER
AVOutputFormat ff_mpeg1video_muxer = {
.name = "mpeg1video",
@@ -280,3 +256,27 @@ AVOutputFormat ff_rawvideo_muxer = {
.flags = AVFMT_NOTIMESTAMPS,
};
#endif
+
+#if CONFIG_SRT_MUXER
+AVOutputFormat ff_srt_muxer = {
+ .name = "srt",
+ .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
+ .mime_type = "application/x-subrip",
+ .extensions = "srt",
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+ .subtitle_codec = CODEC_ID_SRT,
+};
+#endif
+
+#if CONFIG_TRUEHD_MUXER
+AVOutputFormat ff_truehd_muxer = {
+ .name = "truehd",
+ .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
+ .extensions = "thd",
+ .audio_codec = CODEC_ID_TRUEHD,
+ .video_codec = CODEC_ID_NONE,
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index a357e364d3..7e389d0189 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -1,11 +1,12 @@
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
-;* Copyright (C) 2005-2011 x264 project
+;* Copyright (C) 2005-2012 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Anton Mitrofanov <BugMaster@narod.ru>
;* Jason Garrett-Glaser <darkshikari@gmail.com>
+;* Henrik Gramner <hengar-6@student.ltu.se>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
@@ -95,6 +96,9 @@
default rel
%endif
+; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
+CPU amdnop
+
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; into registers at the start, and make no other use of the stack. Luckily that
@@ -128,18 +132,20 @@
; rNm is the original location of arg N (a register or on the stack), dword
; rNmp is native size
-%macro DECLARE_REG 6
+%macro DECLARE_REG 5-6
%define r%1q %2
%define r%1d %3
%define r%1w %4
%define r%1b %5
- %define r%1m %6
- %ifid %6 ; i.e. it's a register
+ %if %0 == 5
+ %define r%1m %3
%define r%1mp %2
%elif ARCH_X86_64 ; memory
- %define r%1mp qword %6
+ %define r%1m [rsp + stack_offset + %6]
+ %define r%1mp qword r %+ %1m
%else
- %define r%1mp dword %6
+ %define r%1m [esp + stack_offset + %6]
+ %define r%1mp dword r %+ %1m
%endif
%define r%1 %2
%endmacro
@@ -187,7 +193,7 @@ DECLARE_REG_SIZE bp, bpl
%endrep
%endmacro
-DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9
+DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%if ARCH_X86_64
%define gprsize 8
@@ -205,6 +211,33 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9
%assign stack_offset stack_offset-gprsize
%endmacro
+%macro PUSH_IF_USED 1-*
+ %rep %0
+ %if %1 < regs_used
+ PUSH r%1
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
+%macro POP_IF_USED 1-*
+ %rep %0
+ %if %1 < regs_used
+ pop r%1
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
+%macro LOAD_IF_USED 1-*
+ %rep %0
+ %if %1 < num_args
+ mov r%1, r %+ %1 %+ mp
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
%macro SUB 2
sub %1, %2
%ifidn %1, rsp
@@ -272,39 +305,34 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9
%if WIN64 ; Windows x64 ;=================================================
-DECLARE_REG 0, rcx, ecx, cx, cl, ecx
-DECLARE_REG 1, rdx, edx, dx, dl, edx
-DECLARE_REG 2, r8, r8d, r8w, r8b, r8d
-DECLARE_REG 3, r9, r9d, r9w, r9b, r9d
-DECLARE_REG 4, rdi, edi, di, dil, [rsp + stack_offset + 40]
-DECLARE_REG 5, rsi, esi, si, sil, [rsp + stack_offset + 48]
-DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
-%define r7m [rsp + stack_offset + 64]
-%define r8m [rsp + stack_offset + 72]
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
- %if %1 < %2
- mov r%1, [rsp + stack_offset + 8 + %1*8]
- %endif
-%endmacro
+DECLARE_REG 0, rcx, ecx, cx, cl
+DECLARE_REG 1, rdx, edx, dx, dl
+DECLARE_REG 2, R8, R8D, R8W, R8B
+DECLARE_REG 3, R9, R9D, R9W, R9B
+DECLARE_REG 4, R10, R10D, R10W, R10B, 40
+DECLARE_REG 5, R11, R11D, R11W, R11B, 48
+DECLARE_REG 6, rax, eax, ax, al, 56
+DECLARE_REG 7, rdi, edi, di, dil, 64
+DECLARE_REG 8, rsi, esi, si, sil, 72
+DECLARE_REG 9, rbx, ebx, bx, bl, 80
+DECLARE_REG 10, rbp, ebp, bp, bpl, 88
+DECLARE_REG 11, R12, R12D, R12W, R12B, 96
+DECLARE_REG 12, R13, R13D, R13W, R13B, 104
+DECLARE_REG 13, R14, R14D, R14W, R14B, 112
+DECLARE_REG 14, R15, R15D, R15W, R15B, 120
%macro PROLOGUE 2-4+ 0 ; #args, #regs, #xmm_regs, arg_names...
- ASSERT %2 >= %1
+ %assign num_args %1
%assign regs_used %2
- ASSERT regs_used <= 7
- %if regs_used > 4
- push r4
- push r5
- %assign stack_offset stack_offset+16
- %endif
+ ASSERT regs_used >= num_args
+ ASSERT regs_used <= 15
+ PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14
%if mmsize == 8
%assign xmm_regs_used 0
%else
WIN64_SPILL_XMM %3
%endif
- LOAD_IF_USED 4, %1
- LOAD_IF_USED 5, %1
- LOAD_IF_USED 6, %1
+ LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS %4
%endmacro
@@ -312,12 +340,11 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
%assign xmm_regs_used %1
ASSERT xmm_regs_used <= 16
%if xmm_regs_used > 6
- sub rsp, (xmm_regs_used-6)*16+16
- %assign stack_offset stack_offset+(xmm_regs_used-6)*16+16
+ SUB rsp, (xmm_regs_used-6)*16+16
%assign %%i xmm_regs_used
%rep (xmm_regs_used-6)
%assign %%i %%i-1
- movdqa [rsp + (%%i-6)*16+8], xmm %+ %%i
+ movdqa [rsp + (%%i-6)*16+(~stack_offset&8)], xmm %+ %%i
%endrep
%endif
%endmacro
@@ -327,7 +354,7 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
%assign %%i xmm_regs_used
%rep (xmm_regs_used-6)
%assign %%i %%i-1
- movdqa xmm %+ %%i, [%1 + (%%i-6)*16+8]
+ movdqa xmm %+ %%i, [%1 + (%%i-6)*16+(~stack_offset&8)]
%endrep
add %1, (xmm_regs_used-6)*16+16
%endif
@@ -341,15 +368,12 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
%macro RET 0
WIN64_RESTORE_XMM_INTERNAL rsp
- %if regs_used > 4
- pop r5
- pop r4
- %endif
+ POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
ret
%endmacro
%macro REP_RET 0
- %if regs_used > 4 || xmm_regs_used > 6
+ %if regs_used > 7 || xmm_regs_used > 6
RET
%else
rep ret
@@ -358,92 +382,80 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
%elif ARCH_X86_64 ; *nix x64 ;=============================================
-DECLARE_REG 0, rdi, edi, di, dil, edi
-DECLARE_REG 1, rsi, esi, si, sil, esi
-DECLARE_REG 2, rdx, edx, dx, dl, edx
-DECLARE_REG 3, rcx, ecx, cx, cl, ecx
-DECLARE_REG 4, r8, r8d, r8w, r8b, r8d
-DECLARE_REG 5, r9, r9d, r9w, r9b, r9d
-DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 8]
-%define r7m [rsp + stack_offset + 16]
-%define r8m [rsp + stack_offset + 24]
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
- %if %1 < %2
- mov r%1, [rsp - 40 + %1*8]
- %endif
-%endmacro
+DECLARE_REG 0, rdi, edi, di, dil
+DECLARE_REG 1, rsi, esi, si, sil
+DECLARE_REG 2, rdx, edx, dx, dl
+DECLARE_REG 3, rcx, ecx, cx, cl
+DECLARE_REG 4, R8, R8D, R8W, R8B
+DECLARE_REG 5, R9, R9D, R9W, R9B
+DECLARE_REG 6, rax, eax, ax, al, 8
+DECLARE_REG 7, R10, R10D, R10W, R10B, 16
+DECLARE_REG 8, R11, R11D, R11W, R11B, 24
+DECLARE_REG 9, rbx, ebx, bx, bl, 32
+DECLARE_REG 10, rbp, ebp, bp, bpl, 40
+DECLARE_REG 11, R12, R12D, R12W, R12B, 48
+DECLARE_REG 12, R13, R13D, R13W, R13B, 56
+DECLARE_REG 13, R14, R14D, R14W, R14B, 64
+DECLARE_REG 14, R15, R15D, R15W, R15B, 72
%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
- ASSERT %2 >= %1
- ASSERT %2 <= 7
- LOAD_IF_USED 6, %1
+ %assign num_args %1
+ %assign regs_used %2
+ ASSERT regs_used >= num_args
+ ASSERT regs_used <= 15
+ PUSH_IF_USED 9, 10, 11, 12, 13, 14
+ LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS %4
%endmacro
%macro RET 0
+ POP_IF_USED 14, 13, 12, 11, 10, 9
ret
%endmacro
%macro REP_RET 0
- rep ret
+ %if regs_used > 9
+ RET
+ %else
+ rep ret
+ %endif
%endmacro
%else ; X86_32 ;==============================================================
-DECLARE_REG 0, eax, eax, ax, al, [esp + stack_offset + 4]
-DECLARE_REG 1, ecx, ecx, cx, cl, [esp + stack_offset + 8]
-DECLARE_REG 2, edx, edx, dx, dl, [esp + stack_offset + 12]
-DECLARE_REG 3, ebx, ebx, bx, bl, [esp + stack_offset + 16]
-DECLARE_REG 4, esi, esi, si, null, [esp + stack_offset + 20]
-DECLARE_REG 5, edi, edi, di, null, [esp + stack_offset + 24]
-DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset + 28]
-%define r7m [esp + stack_offset + 32]
-%define r8m [esp + stack_offset + 36]
+DECLARE_REG 0, eax, eax, ax, al, 4
+DECLARE_REG 1, ecx, ecx, cx, cl, 8
+DECLARE_REG 2, edx, edx, dx, dl, 12
+DECLARE_REG 3, ebx, ebx, bx, bl, 16
+DECLARE_REG 4, esi, esi, si, null, 20
+DECLARE_REG 5, edi, edi, di, null, 24
+DECLARE_REG 6, ebp, ebp, bp, null, 28
%define rsp esp
-%macro PUSH_IF_USED 1 ; reg_id
- %if %1 < regs_used
- push r%1
- %assign stack_offset stack_offset+4
- %endif
-%endmacro
-
-%macro POP_IF_USED 1 ; reg_id
- %if %1 < regs_used
- pop r%1
- %endif
+%macro DECLARE_ARG 1-*
+ %rep %0
+ %define r%1m [esp + stack_offset + 4*%1 + 4]
+ %define r%1mp dword r%1m
+ %rotate 1
+ %endrep
%endmacro
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
- %if %1 < %2
- mov r%1, [esp + stack_offset + 4 + %1*4]
- %endif
-%endmacro
+DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
- ASSERT %2 >= %1
+ %assign num_args %1
%assign regs_used %2
- ASSERT regs_used <= 7
- PUSH_IF_USED 3
- PUSH_IF_USED 4
- PUSH_IF_USED 5
- PUSH_IF_USED 6
- LOAD_IF_USED 0, %1
- LOAD_IF_USED 1, %1
- LOAD_IF_USED 2, %1
- LOAD_IF_USED 3, %1
- LOAD_IF_USED 4, %1
- LOAD_IF_USED 5, %1
- LOAD_IF_USED 6, %1
+ %if regs_used > 7
+ %assign regs_used 7
+ %endif
+ ASSERT regs_used >= num_args
+ PUSH_IF_USED 3, 4, 5, 6
+ LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
DEFINE_ARGS %4
%endmacro
%macro RET 0
- POP_IF_USED 6
- POP_IF_USED 5
- POP_IF_USED 4
- POP_IF_USED 3
+ POP_IF_USED 6, 5, 4, 3
ret
%endmacro
@@ -464,8 +476,6 @@ DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset + 28]
%endmacro
%endif
-
-
;=============================================================================
; arch-independent part
;=============================================================================
diff --git a/libswscale/Makefile b/libswscale/Makefile
index 1586a7a6f3..507c448636 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -17,14 +17,14 @@ OBJS = input.o \
OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \
bfin/swscale_bfin.o \
bfin/yuv2rgb_bfin.o
-OBJS-$(HAVE_ALTIVEC) += ppc/swscale_altivec.o \
+ALTIVEC-OBJS += ppc/swscale_altivec.o \
ppc/yuv2rgb_altivec.o \
ppc/yuv2yuv_altivec.o
-OBJS-$(HAVE_MMX) += x86/rgb2rgb.o \
+MMX-OBJS += x86/rgb2rgb.o \
x86/swscale_mmx.o \
x86/yuv2rgb_mmx.o
-OBJS-$(HAVE_VIS) += sparc/yuv2rgb_vis.o
-MMX-OBJS-$(HAVE_YASM) += x86/input.o \
+VIS-OBJS += sparc/yuv2rgb_vis.o
+YASM-OBJS += x86/input.o \
x86/output.o \
x86/scale.o
diff --git a/libswscale/x86/output.asm b/libswscale/x86/output.asm
index 874fac21af..01a946f7b3 100644
--- a/libswscale/x86/output.asm
+++ b/libswscale/x86/output.asm
@@ -62,11 +62,11 @@ SECTION .text
%define cntr_reg fltsizeq
%define movsx mov
%else
-%define cntr_reg r11
+%define cntr_reg r7
%define movsx movsxd
%endif
-cglobal yuv2planeX_%1, %3, 7, %2, filter, fltsize, src, dst, w, dither, offset
+cglobal yuv2planeX_%1, %3, 8, %2, filter, fltsize, src, dst, w, dither, offset
%if %1 == 8 || %1 == 9 || %1 == 10
pxor m6, m6
%endif ; %1 == 8/9/10
diff --git a/libswscale/x86/scale.asm b/libswscale/x86/scale.asm
index 068a144c51..a3cb0b1bd6 100644
--- a/libswscale/x86/scale.asm
+++ b/libswscale/x86/scale.asm
@@ -53,7 +53,7 @@ SECTION .text
%ifnidn %3, X
cglobal hscale%1to%2_%4, %5, 7, %6, pos0, dst, w, src, filter, fltpos, pos1
%else
-cglobal hscale%1to%2_%4, %5, 7, %6, pos0, dst, w, srcmem, filter, fltpos, fltsize
+cglobal hscale%1to%2_%4, %5, 10, %6, pos0, dst, w, srcmem, filter, fltpos, fltsize
%endif
%if ARCH_X86_64
movsxd wq, wd
@@ -245,10 +245,9 @@ cglobal hscale%1to%2_%4, %5, 7, %6, pos0, dst, w, srcmem, filter, fltpos, fltsiz
%define dlt 0
%endif ; %4 ==/!= X4
%if ARCH_X86_64
- push r12
-%define srcq r11
-%define pos1q r10
-%define srcendq r12
+%define srcq r8
+%define pos1q r7
+%define srcendq r9
movsxd fltsizeq, fltsized ; filterSize
lea srcendq, [srcmemq+(fltsizeq-dlt)*srcmul] ; &src[filterSize&~4]
%else ; x86-32
@@ -388,16 +387,7 @@ cglobal hscale%1to%2_%4, %5, 7, %6, pos0, dst, w, srcmem, filter, fltpos, fltsiz
add wq, 2
%endif ; %3 ==/!= X
jl .loop
-%ifnidn %3, X
REP_RET
-%else ; %3 == X
-%if ARCH_X86_64
- pop r12
- RET
-%else ; x86-32
- REP_RET
-%endif ; x86-32/64
-%endif ; %3 ==/!= X
%endmacro
; SCALE_FUNCS source_width, intermediate_nbits, n_xmm