[FFmpeg-devel] Patch: remove useless SHIFT_TEMPS definition

Michael Niedermayer michaelni
Tue Oct 20 10:24:28 CEST 2009


On Tue, Oct 20, 2009 at 02:29:05PM +0800, avcoder wrote:
> Dear:
> SHIFT_TEMPS marco definition in jfdctfst.c and jfdctint.c is useless
> 
> The following patches remove them

ok, but id like to say that such patches are normally unacceptable without
the patch submitter explaining more elaborately what the removed code was
good for and why this no longer applies.

Your patch here is the kind of "remove it because i dont understand it
and it makes no immedeate differenece"

Ill fill in the needed explaination here, i wont do it again though.

the files in question are from IJG libjpeg originally, and there 
SHIFT_TEMPS is used to work around issues with signed right shift,
the problem does not exist for us as ffmpeg require signed right shift
to behave sanely, which it does on all architectures i know of, the
rest we dont support.

code from libjpeg:

/* We assume that right shift corresponds to signed division by 2 with
 * rounding towards minus infinity.  This is correct for typical "arithmetic
 * shift" instructions that shift in copies of the sign bit.  But some
 * C compilers implement >> with an unsigned shift.  For these machines you
 * must define RIGHT_SHIFT_IS_UNSIGNED.
 * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
 * It is only applied with constant shift counts.  SHIFT_TEMPS must be
 * included in the variables of any routine using RIGHT_SHIFT.
 */

#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define SHIFT_TEMPS     INT32 shift_temp;
#define RIGHT_SHIFT(x,shft)  \
        ((shift_temp = (x)) < 0 ? \
         (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
         (shift_temp >> (shft)))
#else
#define SHIFT_TEMPS
#define RIGHT_SHIFT(x,shft)     ((x) >> (shft))
#endif


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I wish the Xiph folks would stop pretending they've got something they
do not.  Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091020/e5893a46/attachment.pgp>



More information about the ffmpeg-devel mailing list