From 3a0b72dee0d92470cd8bd986dd419e387c7cf5ec Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 22 Nov 2011 16:53:18 +0000 Subject: ARM: remove needless .text/.align directives The 'function' macro already includes the appropriate directives. Signed-off-by: Mans Rullgard --- libavcodec/arm/dsputil_armv6.S | 2 -- libavcodec/arm/dsputil_neon.S | 1 - libavcodec/arm/fft_neon.S | 1 - libavcodec/arm/fmtconvert_neon.S | 1 - libavcodec/arm/h264dsp_neon.S | 3 --- libavcodec/arm/h264idct_neon.S | 1 - libavcodec/arm/int_neon.S | 1 - libavcodec/arm/mdct_neon.S | 2 -- libavcodec/arm/simple_idct_arm.S | 2 -- 9 files changed, 14 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/arm/dsputil_armv6.S b/libavcodec/arm/dsputil_armv6.S index b8461059d9..becf85182d 100644 --- a/libavcodec/arm/dsputil_armv6.S +++ b/libavcodec/arm/dsputil_armv6.S @@ -22,8 +22,6 @@ preserve8 - .text - .macro call_2x_pixels type, subp function ff_\type\()_pixels16\subp\()_armv6, export=1 push {r0-r3, lr} diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S index 13f0699eb2..33969134d7 100644 --- a/libavcodec/arm/dsputil_neon.S +++ b/libavcodec/arm/dsputil_neon.S @@ -23,7 +23,6 @@ #include "asm.S" preserve8 - .text function ff_clear_block_neon, export=1 vmov.i16 q0, #0 diff --git a/libavcodec/arm/fft_neon.S b/libavcodec/arm/fft_neon.S index b79a2dc265..a45898592e 100644 --- a/libavcodec/arm/fft_neon.S +++ b/libavcodec/arm/fft_neon.S @@ -28,7 +28,6 @@ #define M_SQRT1_2 0.70710678118654752440 - .text function fft4_neon vld1.32 {d0-d3}, [r0,:128] diff --git a/libavcodec/arm/fmtconvert_neon.S b/libavcodec/arm/fmtconvert_neon.S index 45cc84b7ec..ad1c15d0fa 100644 --- a/libavcodec/arm/fmtconvert_neon.S +++ b/libavcodec/arm/fmtconvert_neon.S @@ -23,7 +23,6 @@ #include "asm.S" preserve8 - .text function ff_float_to_int16_neon, export=1 subs r2, r2, #8 diff --git a/libavcodec/arm/h264dsp_neon.S b/libavcodec/arm/h264dsp_neon.S index 3d2c6746ae..5156538ed2 100644 --- a/libavcodec/arm/h264dsp_neon.S +++ b/libavcodec/arm/h264dsp_neon.S @@ -392,9 +392,6 @@ function ff_\type\()_h264_chroma_mc2_neon, export=1 endfunc .endm - .text - .align - h264_chroma_mc8 put h264_chroma_mc8 avg h264_chroma_mc4 put diff --git a/libavcodec/arm/h264idct_neon.S b/libavcodec/arm/h264idct_neon.S index 6c62e0f7cb..edb2ae5270 100644 --- a/libavcodec/arm/h264idct_neon.S +++ b/libavcodec/arm/h264idct_neon.S @@ -21,7 +21,6 @@ #include "asm.S" preserve8 - .text function ff_h264_idct_add_neon, export=1 vld1.64 {d0-d3}, [r1,:128] diff --git a/libavcodec/arm/int_neon.S b/libavcodec/arm/int_neon.S index 5a149912f4..8bb58afb18 100644 --- a/libavcodec/arm/int_neon.S +++ b/libavcodec/arm/int_neon.S @@ -23,7 +23,6 @@ preserve8 .fpu neon - .text function ff_scalarproduct_int16_neon, export=1 vmov.i16 q0, #0 diff --git a/libavcodec/arm/mdct_neon.S b/libavcodec/arm/mdct_neon.S index 1ba3067c4e..5669075521 100644 --- a/libavcodec/arm/mdct_neon.S +++ b/libavcodec/arm/mdct_neon.S @@ -23,8 +23,6 @@ preserve8 - .text - #define ff_fft_calc_neon X(ff_fft_calc_neon) function ff_imdct_half_neon, export=1 diff --git a/libavcodec/arm/simple_idct_arm.S b/libavcodec/arm/simple_idct_arm.S index fce40b7d8c..1490f539df 100644 --- a/libavcodec/arm/simple_idct_arm.S +++ b/libavcodec/arm/simple_idct_arm.S @@ -53,8 +53,6 @@ #define COL_SHIFTED_1 524288 /* 1<< (COL_SHIFT-1) */ - .text - function ff_simple_idct_arm, export=1 @@ void simple_idct_arm(int16_t *block) @@ save stack for reg needed (take all of them), -- cgit v1.2.3 From a94c769dad502e2b782a09ece0ba490276239252 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 23 Nov 2011 19:45:39 +0100 Subject: tiffenc: add a private option for selecting compression algorithm --- libavcodec/tiffenc.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index d486b3fd4b..7b71481a74 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -25,6 +25,9 @@ * @author Bartlomiej Wolowiec */ +#include "libavutil/log.h" +#include "libavutil/opt.h" + #include "avcodec.h" #if CONFIG_ZLIB #include @@ -43,6 +46,7 @@ static const uint8_t type_sizes2[6] = { }; typedef struct TiffEncoderContext { + AVClass *class; ///< for private options AVCodecContext *avctx; AVFrame picture; @@ -227,7 +231,6 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf, p->key_frame = 1; avctx->coded_frame= &s->picture; - s->compr = TIFF_PACKBITS; if (avctx->compression_level == 0) { s->compr = TIFF_RAW; } else if(avctx->compression_level == 2) { @@ -444,6 +447,26 @@ fail: return ret; } +#define OFFSET(x) offsetof(TiffEncoderContext, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM +static const AVOption options[] = { + { "compression_algo", NULL, OFFSET(compr), AV_OPT_TYPE_INT, {TIFF_PACKBITS}, TIFF_RAW, TIFF_DEFLATE, VE, "compression_algo" }, + { "packbits", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_PACKBITS}, 0, 0, VE, "compression_algo" }, + { "raw", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_RAW}, 0, 0, VE, "compression_algo" }, + { "lzw", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_LZW}, 0, 0, VE, "compression_algo" }, +#if CONFIG_ZLIB + { "deflate", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_DEFLATE}, 0, 0, VE, "compression_algo" }, +#endif + { NULL }, +}; + +static const AVClass tiffenc_class = { + .class_name = "TIFF encoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVCodec ff_tiff_encoder = { .name = "tiff", .type = AVMEDIA_TYPE_VIDEO, @@ -458,4 +481,5 @@ AVCodec ff_tiff_encoder = { PIX_FMT_YUV411P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("TIFF image"), + .priv_class = &tiffenc_class, }; -- cgit v1.2.3 From 3eedd29bd7df6f21a79e1a67a6d905049996d2ec Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 21 Nov 2011 21:22:44 +0100 Subject: bethsoftvideo: return proper consumed size for palette packets. Also check for sufficient packet size. --- libavcodec/bethsoftvideo.c | 10 +++- tests/ref/fate/bethsoft-vid | 141 ++++++++++++++++++++++---------------------- 2 files changed, 78 insertions(+), 73 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c index bd21dbff63..f4020d6ee5 100644 --- a/libavcodec/bethsoftvideo.c +++ b/libavcodec/bethsoftvideo.c @@ -46,14 +46,19 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx) return 0; } -static void set_palette(AVFrame * frame, const uint8_t * palette_buffer) +static int set_palette(AVFrame * frame, const uint8_t * palette_buffer, int buf_size) { uint32_t * palette = (uint32_t *)frame->data[1]; int a; + + if (buf_size < 256*3) + return AVERROR_INVALIDDATA; + for(a = 0; a < 256; a++){ palette[a] = AV_RB24(&palette_buffer[a * 3]) * 4; } frame->palette_has_changed = 1; + return 256*3; } static int bethsoftvid_decode_frame(AVCodecContext *avctx, @@ -80,8 +85,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx, switch(block_type = *buf++){ case PALETTE_BLOCK: - set_palette(&vid->frame, buf); - return 0; + return set_palette(&vid->frame, buf, buf_size); case VIDEO_YOFF_P_FRAME: yoffset = bytestream_get_le16(&buf); if(yoffset >= avctx->height) diff --git a/tests/ref/fate/bethsoft-vid b/tests/ref/fate/bethsoft-vid index 92c694b19e..0886bfcf48 100644 --- a/tests/ref/fate/bethsoft-vid +++ b/tests/ref/fate/bethsoft-vid @@ -1,90 +1,91 @@ -0, 0, 192000, 0x00000000 +0, 0, 192000, 0xdecc683b 1, 0, 1480, 0x00000000 -0, 1500, 192000, 0x01a6cf45 -0, 3000, 192000, 0xd07d57e9 -0, 4500, 192000, 0x3cb1dff5 +0, 1500, 192000, 0x00000000 +0, 3000, 192000, 0x01a6cf45 +0, 4500, 192000, 0xd07d57e9 1, 5994, 1480, 0x20a92bd4 -0, 6000, 192000, 0xd1aaa8fb -0, 7500, 192000, 0x75f526cd -0, 9000, 192000, 0x0f673577 -0, 10500, 192000, 0x897b6781 +0, 6000, 192000, 0x3cb1dff5 +0, 7500, 192000, 0xd1aaa8fb +0, 9000, 192000, 0x75f526cd +0, 10500, 192000, 0x0f673577 1, 11988, 1850, 0xa9e48a74 -0, 12000, 192000, 0x81e6b7f7 -0, 13500, 192000, 0x1f45ce61 -0, 15000, 192000, 0x5a0772a6 -0, 16500, 192000, 0xf78732b3 -0, 18000, 192000, 0x8427f9e5 +0, 12000, 192000, 0x897b6781 +0, 13500, 192000, 0x81e6b7f7 +0, 15000, 192000, 0x1f45ce61 +0, 16500, 192000, 0x5a0772a6 +0, 18000, 192000, 0xf78732b3 1, 19481, 1480, 0x23ecd018 -0, 19500, 192000, 0x40473f11 -0, 21000, 192000, 0x173ceebe -0, 22500, 192000, 0x136b9516 -0, 24000, 192000, 0x138d11ae +0, 19500, 192000, 0x8427f9e5 +0, 21000, 192000, 0x40473f11 +0, 22500, 192000, 0x173ceebe +0, 24000, 192000, 0x136b9516 1, 25475, 1480, 0x206bb915 -0, 25500, 192000, 0x063dbff3 -0, 27000, 192000, 0x5280852f -0, 28500, 192000, 0x99943a8f -0, 30000, 192000, 0x0330a728 +0, 25500, 192000, 0x138d11ae +0, 27000, 192000, 0x063dbff3 +0, 28500, 192000, 0x5280852f +0, 30000, 192000, 0x99943a8f 1, 31469, 1850, 0xb0e10e75 -0, 31500, 192000, 0x5d35467d -0, 33000, 192000, 0xfd436343 -0, 34500, 192000, 0xc323fcfe -0, 36000, 192000, 0x2a1530a0 -0, 37500, 192000, 0xbd43bb60 +0, 31500, 192000, 0x0330a728 +0, 33000, 192000, 0x5d35467d +0, 34500, 192000, 0xfd436343 +0, 36000, 192000, 0xc323fcfe +0, 37500, 192000, 0x2a1530a0 1, 38961, 1480, 0x8d9baedd -0, 39000, 192000, 0xa47f5eab -0, 40500, 192000, 0xff17f5f7 -0, 42000, 192000, 0xb4140b55 -0, 43500, 192000, 0xb8782cc4 +0, 39000, 192000, 0xbd43bb60 +0, 40500, 192000, 0xa47f5eab +0, 42000, 192000, 0xff17f5f7 +0, 43500, 192000, 0xb4140b55 1, 44955, 1480, 0xb802aae1 -0, 45000, 192000, 0x92975b8b -0, 46500, 192000, 0xf42a64d6 -0, 48000, 192000, 0x2cc7077d -0, 49500, 192000, 0x00080cc8 +0, 45000, 192000, 0xb8782cc4 +0, 46500, 192000, 0x92975b8b +0, 48000, 192000, 0xf42a64d6 +0, 49500, 192000, 0x2cc7077d 1, 50950, 1480, 0xecd7b5cc -0, 51000, 192000, 0x584b48f3 -0, 52500, 192000, 0xd68f57da -0, 54000, 192000, 0x60158422 -0, 55500, 192000, 0xd7fb89e6 +0, 51000, 192000, 0x00080cc8 +0, 52500, 192000, 0x584b48f3 +0, 54000, 192000, 0xd68f57da +0, 55500, 192000, 0x60158422 1, 56944, 1850, 0x16861355 -0, 57000, 192000, 0x97f1c76a -0, 58500, 192000, 0x46c4bb9e -0, 60000, 192000, 0xd32f9b66 -0, 61500, 192000, 0x74f43886 -0, 63000, 192000, 0x3c4e47df +0, 57000, 192000, 0xd7fb89e6 +0, 58500, 192000, 0x97f1c76a +0, 60000, 192000, 0x46c4bb9e +0, 61500, 192000, 0xd32f9b66 +0, 63000, 192000, 0x74f43886 1, 64436, 1480, 0xa51690bd -0, 64500, 192000, 0xb5ac0a58 -0, 66000, 192000, 0xcc572b31 -0, 67500, 192000, 0xb1739d26 -0, 69000, 192000, 0x73da5473 +0, 64500, 192000, 0x3c4e47df +0, 66000, 192000, 0xb5ac0a58 +0, 67500, 192000, 0xcc572b31 +0, 69000, 192000, 0xb1739d26 1, 70430, 1480, 0xdd0b90d1 -0, 70500, 192000, 0x5f79f5bc -0, 72000, 192000, 0x0affc0a0 -0, 73500, 192000, 0x2b4d5c1c -0, 75000, 192000, 0x309b41bc +0, 70500, 192000, 0x73da5473 +0, 72000, 192000, 0x5f79f5bc +0, 73500, 192000, 0x0affc0a0 +0, 75000, 192000, 0x2b4d5c1c 1, 76424, 1850, 0x3ce6e333 -0, 76500, 192000, 0xd42b6424 -0, 78000, 192000, 0x4795c948 -0, 79500, 192000, 0xbc1a3a8b -0, 81000, 192000, 0x16529c5b -0, 82500, 192000, 0x6b1b31ba +0, 76500, 192000, 0x309b41bc +0, 78000, 192000, 0xd42b6424 +0, 79500, 192000, 0x4795c948 +0, 81000, 192000, 0xbc1a3a8b +0, 82500, 192000, 0x16529c5b 1, 83917, 1480, 0xf8ce8ea3 -0, 84000, 192000, 0x569182ce -0, 85500, 192000, 0xe6ea9866 -0, 87000, 192000, 0x102c6076 -0, 88500, 192000, 0xb29f527a +0, 84000, 192000, 0x6b1b31ba +0, 85500, 192000, 0x569182ce +0, 87000, 192000, 0xe6ea9866 +0, 88500, 192000, 0x102c6076 1, 89911, 1480, 0xda4597af -0, 90000, 192000, 0x040b4eee -0, 91500, 192000, 0x92574f4a -0, 93000, 192000, 0x1e8acdce -0, 94500, 192000, 0x1becf516 +0, 90000, 192000, 0xb29f527a +0, 91500, 192000, 0x040b4eee +0, 93000, 192000, 0x92574f4a +0, 94500, 192000, 0x1e8acdce 1, 95905, 1480, 0x918f7cb3 -0, 96000, 192000, 0xb62e9776 -0, 97500, 192000, 0xed37a08e -0, 99000, 192000, 0xc0719912 -0, 100500, 192000, 0x24cf7a7e +0, 96000, 192000, 0x1becf516 +0, 97500, 192000, 0xb62e9776 +0, 99000, 192000, 0xed37a08e +0, 100500, 192000, 0xc0719912 1, 101899, 1850, 0xca6edb15 -0, 102000, 192000, 0x0307f62f -0, 103500, 192000, 0x79b7417b +0, 102000, 192000, 0x24cf7a7e +0, 103500, 192000, 0x0307f62f +0, 105000, 192000, 0x79b7417b 1, 109392, 1480, 0xba279597 1, 115386, 1480, 0xc5a38a9e 1, 121380, 1850, 0x8147eef5 -- cgit v1.2.3 From c1848c4b26fda0c5060dceef6c45666e31345032 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 23 Nov 2011 15:32:50 -0500 Subject: pcmdec: remove unneeded resetting of samples pointer --- libavcodec/pcm.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index c9eb543e92..0e9e685989 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -382,7 +382,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, #endif /* HAVE_BIGENDIAN */ case CODEC_ID_PCM_U8: memcpy(samples, src, n*sample_size); - samples += n * sample_size; break; case CODEC_ID_PCM_ZORK: for (; n > 0; n--) { @@ -428,7 +427,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, } break; } - samples = (uint8_t *) dst_int32_t; break; } case CODEC_ID_PCM_LXF: @@ -451,7 +449,6 @@ static int pcm_decode_frame(AVCodecContext *avctx, ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4); } } - samples = (uint8_t *) dst_int32_t; break; } default: -- cgit v1.2.3