[FFmpeg-devel] H.261 chroma motion vector rounding.

Hendrik Leppkes h.leppkes at gmail.com
Mon Apr 3 09:30:50 EEST 2017


On Sun, Apr 2, 2017 at 11:14 PM, Christina Brien
<christina.brien at polygonindustrial.com> wrote:
>
>> On 2 Apr 2017, at 22:03, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>>
>> C integer divison truncates, that equals rounding towards zero.
>
> For positive numbers, yes.
> 3 (0b00000000 00000000 00000000 00000011) is right shifted with sign-insertion to 1.
> -3 (0b11111111 111111111 111111111 111111101) is right shifted with sign-insertion to -2.
>

For both positive and negative numbers.

3 / 2 = 1
-3 / 2 = -1

https://ideone.com/WoC5sA

- Hendrik


More information about the ffmpeg-devel mailing list