[Ffmpeg-devel] few remarks for h264 decoder
Sat Dec 31 02:55:47 CET 2005
On Fri, Dec 30, 2005 at 04:00:14PM -0800, Loren Merritt wrote:
> On Fri, 30 Dec 2005, G?bor Kov?cs wrote:
> >I didn't check it throughly but mmx h264_qpel4_hv_lowpass macro uses
> >approximation (comment sais ((a-b)/4-b)/4). I know a proper solution
> >needs 32bit range, but this is why God created "pmaddwd" :) I think the
> >performance loss needed for accurate calculation would be minimal.
> >input: abccba
> >what it does: (((a-b)/4-b)/4+c+32)>>6
> >reformulated (not bothering for a moment with 16bit limit)
> >what it should be:
> >So there are two problems. One is the factor of c (16 vs 20). Other is
> >the loss of precision (lower bits) using the /4 right shifts.
> The code is right, the comment was wrong.
> I have not performed a detailed error analysis of the loss in precision,
> but since it does not appear to introduce any deviation from JM, I have
> to assume that those lsbs don't actually matter.
they dont matter, the trick is that (4*x + y)>>2 == x + (y>>2) and
(20*c - 5*b + a + 512)>>10
(4*(5*c - b + 128) + a - b)>>10
(5*c - b + 128 + ((a - b)>>2))>>8
(4*c + c - b + 128 + ((a - b)>>2))>>8
(c + ((c - b + 128 + ((a - b)>>2)))>>2))>>6
More information about the ffmpeg-devel