Re: [FFmpeg-devel] [PATCH] avcodec/wmalossless: use av_clip_intp2
On Mon, Mar 09, 2015 at 10:05:03PM +0100, Clément Bœsch wrote: > On Mon, Mar 09, 2015 at 10:01:20PM +0100, Reimar Döffinger wrote: > > On Sun, Mar 08, 2015 at 10:32:03PM +0100, Michael Niedermayer wrote: > > > On Sat, Mar 07, 2015 at 11:44:10PM +0800, zhaoxiu.zeng wrote: > > > > From 47c997fa0623ab94a7a93b2d2e4cc4fa64c85d5f Mon Sep 17 00:00:00 2001 > > > > From: Zeng Zhaoxiu > > > > Date: Sat, 7 Mar 2015 23:26:42 +0800 > > > > Subject: [PATCH 1/1] avcodec/wmalossless: use av_clip_intp2 > > > > > > this breaks build on ARM > > > > > > ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably > > > doesn’t match constraints > > > ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably > > > doesn’t match constraints > > > ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ > > > ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ > > > > ARM uses asm code based on the ssat instruction. > > That one requires the number of bits to be a constant. > > This means that for ARM this function may only be used with constant > > p argument. > > I guess whether this is ok depends on whether there are other > > cases/architectures where av_clip_intp2 is actually faster than a > > normal clip even when p is not constant. > > The C code doesn't look particularly faster to me in that case, > > but I haven't tested it. > > maybe we should make use of av_builtin_constant_p()? Assuming we want av_clip_intp2 to work for non-constant that would be an option, but note that it will basically break the optimization on non-gcc. However if we don't I am not so sure what to do about it, or can we use av_builtin_constant_p to error out compile-time? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/wmalossless: use av_clip_intp2
On Mon, Mar 09, 2015 at 10:01:20PM +0100, Reimar Döffinger wrote: > On Sun, Mar 08, 2015 at 10:32:03PM +0100, Michael Niedermayer wrote: > > On Sat, Mar 07, 2015 at 11:44:10PM +0800, zhaoxiu.zeng wrote: > > > From 47c997fa0623ab94a7a93b2d2e4cc4fa64c85d5f Mon Sep 17 00:00:00 2001 > > > From: Zeng Zhaoxiu > > > Date: Sat, 7 Mar 2015 23:26:42 +0800 > > > Subject: [PATCH 1/1] avcodec/wmalossless: use av_clip_intp2 > > > > this breaks build on ARM > > > > ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably > > doesn’t match constraints > > ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably > > doesn’t match constraints > > ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ > > ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ > > ARM uses asm code based on the ssat instruction. > That one requires the number of bits to be a constant. > This means that for ARM this function may only be used with constant > p argument. > I guess whether this is ok depends on whether there are other > cases/architectures where av_clip_intp2 is actually faster than a > normal clip even when p is not constant. > The C code doesn't look particularly faster to me in that case, > but I haven't tested it. maybe we should make use of av_builtin_constant_p()? -- Clément B. pgpjPLnuQM8Mp.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/wmalossless: use av_clip_intp2
On Sun, Mar 08, 2015 at 10:32:03PM +0100, Michael Niedermayer wrote: > On Sat, Mar 07, 2015 at 11:44:10PM +0800, zhaoxiu.zeng wrote: > > From 47c997fa0623ab94a7a93b2d2e4cc4fa64c85d5f Mon Sep 17 00:00:00 2001 > > From: Zeng Zhaoxiu > > Date: Sat, 7 Mar 2015 23:26:42 +0800 > > Subject: [PATCH 1/1] avcodec/wmalossless: use av_clip_intp2 > > this breaks build on ARM > > ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn’t > match constraints > ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn’t > match constraints > ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ > ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ ARM uses asm code based on the ssat instruction. That one requires the number of bits to be a constant. This means that for ARM this function may only be used with constant p argument. I guess whether this is ok depends on whether there are other cases/architectures where av_clip_intp2 is actually faster than a normal clip even when p is not constant. The C code doesn't look particularly faster to me in that case, but I haven't tested it. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/wmalossless: use av_clip_intp2
On Sat, Mar 07, 2015 at 11:44:10PM +0800, zhaoxiu.zeng wrote: > From 47c997fa0623ab94a7a93b2d2e4cc4fa64c85d5f Mon Sep 17 00:00:00 2001 > From: Zeng Zhaoxiu > Date: Sat, 7 Mar 2015 23:26:42 +0800 > Subject: [PATCH 1/1] avcodec/wmalossless: use av_clip_intp2 this breaks build on ARM ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn’t match constraints ffmpeg/libavutil/arm/intmath.h:69:5: warning: asm operand 2 probably doesn’t match constraints ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ ffmpeg/libavutil/arm/intmath.h:69:5: error: impossible constraint in ‘asm’ [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/wmalossless: use av_clip_intp2
>From 47c997fa0623ab94a7a93b2d2e4cc4fa64c85d5f Mon Sep 17 00:00:00 2001 From: Zeng Zhaoxiu Date: Sat, 7 Mar 2015 23:26:42 +0800 Subject: [PATCH 1/1] avcodec/wmalossless: use av_clip_intp2 Signed-off-by: Zeng Zhaoxiu --- libavcodec/wmalosslessdec.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index fcadbc0..afe82a9 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -622,7 +622,6 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int *pred) int i, j, ich, pred_error; int order= s->mclms_order; int num_channels = s->num_channels; -int range= 1 << (s->bits_per_sample - 1); for (ich = 0; ich < num_channels; ich++) { pred_error = s->channel_residues[ich][icoef] - pred[ich]; @@ -643,8 +642,8 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int *pred) for (ich = num_channels - 1; ich >= 0; ich--) { s->mclms_recent--; -s->mclms_prevvalues[s->mclms_recent] = av_clip(s->channel_residues[ich][icoef], --range, range - 1); +s->mclms_prevvalues[s->mclms_recent] = av_clip_intp2(s->channel_residues[ich][icoef], +s->bits_per_sample - 1); s->mclms_updates[s->mclms_recent] = WMASIGN(s->channel_residues[ich][icoef]); } @@ -693,7 +692,6 @@ static void revert_mclms(WmallDecodeCtx *s, int tile_size) static void lms_update(WmallDecodeCtx *s, int ich, int ilms, int input) { int recent = s->cdlms[ich][ilms].recent; -int range = 1 << s->bits_per_sample - 1; int order = s->cdlms[ich][ilms].order; if (recent) @@ -706,7 +704,7 @@ static void lms_update(WmallDecodeCtx *s, int ich, int ilms, int input) recent = order - 1; } -s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip(input, -range, range - 1); +s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip_intp2(input, s->bits_per_sample - 1); s->cdlms[ich][ilms].lms_updates[recent] = WMASIGN(input) * s->update_speed[ich]; s->cdlms[ich][ilms].lms_updates[recent + (order >> 4)] >>= 2; -- 2.1.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel