[FFmpeg-devel] Rename RSHIFT macro to ROUNDED_RSHIFT

FeRD (Frank Dana) ferdnyc at gmail.com
Mon Jan 21 19:38:58 EET 2019

Patches to follow:

[PATCH 1/2] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT
[PATCH 2/2] avcodec: Change uses of RSHIFT to ROUNDED_RSHIFT

This is my first patch submission to ffmpeg (and at a tense
moment, it seems, but soldiering on...), please bear with me.

The RSHIFT macro in libavutil/common.h does not actually perform
a bitwise right-shift, but rather a rounded version of the same
operation, as is noted by a comment above the macro. The rounded
divsion macro on the very next line is named ROUNDED_DIV, which
seems far more clear.

So, the first of these two patches renames RSHIFT to ROUNDED_RSHIFT
for clarity. The second updates all uses of the macro which are
internal to the ffmpeg source tree (which occur in only three
codecs under libavcodec/). After applying both patches, 'make fate'
succeeds and ffmpeg is still functional.

An example of the name causing issues (due to a conflict with
the RSHIFT macro in the Ruby source, which does perform a
standard bitwise right-shift) can be found at [1].

[1]: https://github.com/OpenShot/libopenshot/issues/164

Signed-off-by: FeRD (Frank Dana) <ferdnyc at gmail.com>

More information about the ffmpeg-devel mailing list