[MPlayer-users] deinterlace_bottom_field()

Shoji Tokunaga toku at mac.com
Wed May 15 09:49:02 CEST 2002


Hello,

I found a little bug in deinterlace_bottom_field() of imgconvert.c.
Line-shaped noise mixes at the top and the bottom of the screen in the 
scene that a movement is drastic.

For example, in case of height = 480,

When y = 0, src is pointing at line -1, dst is pointing at line 1,
y1 is changed from -2 to 2,

  buf line: 0  = src line: 0
  buf line: 1  = src line: 0
  buf line: 2  = src line: 0
  buf line: 3  = src line: 1
  buf line: 4  = src line: 2

And when y = 478, src is pointing at line 477, dst is pointing at line 479,
y1 is changed from 476 to 480,

  buf line: 0  = src line: 476
  buf line: 1  = src line: 477
  buf line: 2  = src line: 478
  buf line: 3  = src line: 479
  buf line: 4  = src line: 479


Correctly, each should become the following,

  buf line: 0  = src line: 1
  buf line: 1  = src line: 0
  buf line: 2  = src line: 1
  buf line: 3  = src line: 2
  buf line: 4  = src line: 3

  buf line: 0  = src line: 477
  buf line: 1  = src line: 478
  buf line: 2  = src line: 479
  buf line: 3  = src line: 478
  buf line: 4  = src line: 479

So, would you change the source like this?

*** imgconvert.c.orig	Mon May 13 20:53:52 2002
--- imgconvert.c	Wed May 15 15:44:55 2002
***************
*** 497,508 ****
              /* in order to use the same function, we use an intermediate buffer */
              ptr = buf;
              for(i=0;i<5;i++) {
!                 if (y1 < 0)
!                     memcpy(ptr, src1, width);
!                 else if (y1 >= height) 
!                     memcpy(ptr, src1 + (height - 1) * src_wrap, width);
                  else
!                     memcpy(ptr, src1 + y1 * src_wrap, width);
                  y1++;
                  ptr += width;
              }
--- 497,508 ----
              /* in order to use the same function, we use an intermediate buffer */
              ptr = buf;
              for(i=0;i<5;i++) {
!                 if (y1 < -1)
!                     memcpy(ptr, src1 + src_wrap , width);
!                 else if (y1 >= height - 1)
!                     memcpy(ptr, src1 + (y1 - 1) * src_wrap, width);
                  else
!                     memcpy(ptr, src1 + (y1 + 1) * src_wrap, width);
                  y1++;
                  ptr += width;
              }


I prepared for the page that a sample image could be seen.
  http://homepage1.nifty.com/~toku/deinterlace.html

Sincerely,

-- 
Shoji Tokunaga <toku at mac.com>




More information about the MPlayer-users mailing list