[x264-devel] x264 bug: interlaced video missing grain/detail in top 32 lines

Måns Rullgård mans at mansr.com
Fri Mar 12 15:44:57 CET 2010


Jason Garrett-Glaser <darkshikari at gmail.com> writes:

> On Fri, Mar 12, 2010 at 6:33 AM, Adam Warner <lists at consulting.net.nz> wrote:
>> On Fri, 2010-03-12 at 05:42 -0800, Jason Garrett-Glaser wrote:
>>> On Fri, Mar 12, 2010 at 5:27 AM, Adam Warner <lists at consulting.net.nz> wrote:
>>> > Hi all,
>>> >
>>> > I have found a bug in x264's interlacing.
>>>
>>> This is not a bug.  This is intentional, and part of how adaptive
>>> quantization works.  If you want to avoid it, don't stick gigantic
>>> black bars on the top of your videos.
>>
>> This explains why I was unable to reproduce the missing grain/detail in
>> the top 32 lines of other (borderless) grainy video clips.
>>
>> It's good to learn about this limitation of the adaptive quantization
>> algorithm. Since interlaced fields are expanded into full height frames
>> the missing grain/detail is, unfortunately, twice as pronounced.
>>
>> Thanks for all your great work on x264. I've recently enjoyed reading
>> your blogging about the complexities of film grain optimization and
>> wavelets. Since you have a big Blu-Ray compatibility release coming up
>> soon I wanted to ensure no bugs crept in. Sorry I was mistaken about
>> x264's output in this instance being a bug.
>
> Indeed, while "not a bug", it is a weakness.  The problem is that I
> don't know of any particularly good method of avoiding the problem.
>
> We could special-case the top and bottom rows, but that would cause
> problems if the padding was larger than one row.  The core problem is
> a general one of sharp edges between non-complex areas, but whenever I
> try to make adaptive quantization ignore such edges, it hurts other
> cases in the progress of helping those.
>
> It's hard.

Perhaps you could add an option to tell the encoder about the bars, or
even have them added by x264 itself.  It is quite common to have black
bars, e.g. when fitting full cinema-width content into a restricted
aspect ratio mandated by some spec.  Automatic bar detection might be
another option.

Either of these solutions would of course be less versatile than a
generic edge detection.  They should, however, take care of a common
case that isn't currently handled optimally.

-- 
Måns Rullgård
mans at mansr.com


More information about the x264-devel mailing list