On Sun, Apr 02, 2017 at 09:48:12PM +0100, Christina Brien wrote: > > wouldn't > > ROUNDED_DIV() macro be more appropriate? > > ROUNDED_DIV rounds to nearest. The specification states to round towards zero. > > > the Changelog is not supposed to include these kind of changes. > > I assumed Changelog was for incompatible changes, of which this would be. I > have removed the change. > > Thanks, > Christina >
> mpegvideo_motion.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > f301a70a49498419b0d5cde4c5939fbd328e8546 > 0001-H.261-chroma-motion-vectors-round-towards-zero.patch > From 12bca148ff4f9860ad32dd2887603f13185b9e68 Mon Sep 17 00:00:00 2001 > From: Christina Brien <christina.br...@polygonindustrial.com> > Date: Thu, 30 Mar 2017 23:38:03 +0100 > Subject: [PATCH] H.261 chroma motion vectors round towards zero. > > ITU-T H.261 (03/93) Section 3.2.2 states "The motion vector for both colour > difference blocks is derived by halving the component values of the macroblock > vector and truncating the magnitude parts towards zero to yield integer > components." > > Simple integer division rounds towards negative infinity, not towards zero. This is not correct ISO C: 5 The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined. 6 When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded.90) If the quotient a/b is representable, the expression (a/b)*b + a%b shall equal a. > Negative numbers need to be rounded up, by adding (divisor/2) before division. > --- > libavcodec/mpegvideo_motion.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) breaks make fate If you are still unsure what is correct, it would probably be best if you used a reference h261 files or a reference implementation that originates from the ITU committe and compare agaist that [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel