[FFmpeg-devel] [PATCH 2/2] avcodec: Change uses of RSHIFT to ROUNDED_RSHIFT
FeRD (Frank Dana)
ferdnyc at gmail.com
Mon Jan 21 19:39:00 EET 2019
Three files in libavcodec/ use the RSHIFT macro from libavutil:
- mpeg4videodec.c
- vp3.c
- vp56.c
All instances of RSHIFT are updated to follow the name-change
in libavutil/common.h (previous commit).
Signed-off-by: FeRD (Frank Dana) <ferdnyc at gmail.com>
---
libavcodec/mpeg4videodec.c | 4 ++--
libavcodec/vp3.c | 16 ++++++++--------
libavcodec/vp56.c | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index f44ee76bd4..5d63ba12ba 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -601,7 +601,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
if (ctx->divx_version == 500 && ctx->divx_build == 413 && a >= s->quarter_sample)
sum = s->sprite_offset[0][n] / (1 << (a - s->quarter_sample));
else
- sum = RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a);
+ sum = ROUNDED_RSHIFT(s->sprite_offset[0][n] * (1 << s->quarter_sample), a);
} else {
dx = s->sprite_delta[n][0];
dy = s->sprite_delta[n][1];
@@ -623,7 +623,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
v += dx;
}
}
- sum = RSHIFT(sum, a + 8 - s->quarter_sample);
+ sum = ROUNDED_RSHIFT(sum, a + 8 - s->quarter_sample);
}
if (sum < -len)
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index a5d8c2ed0b..13b3d6e22a 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -861,10 +861,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
if (s->chroma_y_shift) {
if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
- motion_x[0] = RSHIFT(motion_x[0] + motion_x[1] +
- motion_x[2] + motion_x[3], 2);
- motion_y[0] = RSHIFT(motion_y[0] + motion_y[1] +
- motion_y[2] + motion_y[3], 2);
+ motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + motion_x[1] +
+ motion_x[2] + motion_x[3], 2);
+ motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + motion_y[1] +
+ motion_y[2] + motion_y[3], 2);
}
motion_x[0] = (motion_x[0] >> 1) | (motion_x[0] & 1);
motion_y[0] = (motion_y[0] >> 1) | (motion_y[0] & 1);
@@ -873,10 +873,10 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
s->motion_val[1][frag][1] = motion_y[0];
} else if (s->chroma_x_shift) {
if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
- motion_x[0] = RSHIFT(motion_x[0] + motion_x[1], 1);
- motion_y[0] = RSHIFT(motion_y[0] + motion_y[1], 1);
- motion_x[1] = RSHIFT(motion_x[2] + motion_x[3], 1);
- motion_y[1] = RSHIFT(motion_y[2] + motion_y[3], 1);
+ motion_x[0] = ROUNDED_RSHIFT(motion_x[0] + motion_x[1], 1);
+ motion_y[0] = ROUNDED_RSHIFT(motion_y[0] + motion_y[1], 1);
+ motion_x[1] = ROUNDED_RSHIFT(motion_x[2] + motion_x[3], 1);
+ motion_y[1] = ROUNDED_RSHIFT(motion_y[2] + motion_y[3], 1);
} else {
motion_x[1] = motion_x[0];
motion_y[1] = motion_y[0];
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
index b69fe6c176..9359b48bc6 100644
--- a/libavcodec/vp56.c
+++ b/libavcodec/vp56.c
@@ -197,8 +197,8 @@ static void vp56_decode_4mv(VP56Context *s, int row, int col)
/* chroma vectors are average luma vectors */
if (s->avctx->codec->id == AV_CODEC_ID_VP5) {
- s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2);
- s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2);
+ s->mv[4].x = s->mv[5].x = ROUNDED_RSHIFT(mv.x,2);
+ s->mv[4].y = s->mv[5].y = ROUNDED_RSHIFT(mv.y,2);
} else {
s->mv[4] = s->mv[5] = (VP56mv) {mv.x/4, mv.y/4};
}
--
2.20.1
More information about the ffmpeg-devel
mailing list