Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New adaptive mode for ntsc3d decoder #522

Merged
merged 16 commits into from
Aug 4, 2020

Commits on Aug 3, 2020

  1. Fix a typo in the split2D heuristic.

    This survives from the original version of this code; it looks like the
    intent was to use the current and previous lines, not the current line
    twice.
    
    Because they're usually very similar, the difference to the result is
    tiny -- the cross-colour in the S&W zoneplate is slightly better in a
    couple of pixels.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    560617b View commit details
    Browse the repository at this point in the history
  2. Use double rather than qreal in Comb and its supporting code.

    This matches the other decoders -- qreal isn't intended as a general
    floating point type; it's Qt's internal type for coordinates (and
    doesn't even have to be a floating point type depending on how Qt is
    configured).
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    b8bc9dd View commit details
    Browse the repository at this point in the history
  3. Further improvements to the comments in Comb.

    - The 1D filter actually has negative gain.
    - Explain why split2D uses split1D's result.
    - Explain how split2D's heuristic works more clearly.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    31b8649 View commit details
    Browse the repository at this point in the history
  4. Move Comb::adjustY's definition.

    The order of declarations now matches the order in which the functions
    are called.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    9d77958 View commit details
    Browse the repository at this point in the history
  5. Move most of Comb's methods into Comb::FrameBuffer.

    Nearly all of the decoding steps are operating on a single frame, so
    they can be a method of FrameBuffer, rather than a method of Comb that
    takes a FrameBuffer as a parameter. This simplifies the code quite a bit
    because it doesn't need to say currentFrameBuffer->... all over the
    place.
    
    The code to load two fields into the framebuffer is also made into a
    method, and the Get* helpers are renamed to get*.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    ee43c76 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4665a59 View commit details
    Browse the repository at this point in the history
  7. Fix the unexplained two-pixel offset in adjustY.

    Previously the filter delay was also hardcoded as 2, so perhaps the + 2
    was originally intended to compensate for the chroma filter (now
    disabled).
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    5b5398c View commit details
    Browse the repository at this point in the history
  8. Make the 1D filter have gain 1, not gain -2.

    This simplifies the code a bit later -- e.g. you can subtract the chroma
    from the composite signal to get the luma, rather than adding them.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    f10e7b1 View commit details
    Browse the repository at this point in the history
  9. Use QScopedPointer for current/previousFrameBuffer.

    This means we can just create two buffers upfront then cycle between
    them, which is marginally more efficient than copying the object.
    For 3D decoding in both directions in the future, we can do exactly the
    same thing with three buffers.
    
    Since the object isn't being copied any more, there's no need for its
    members to be (efficiently) copyable -- so videoParameters and
    configuration can be const references, and clpbuffer can be a regular
    array.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    ff5f991 View commit details
    Browse the repository at this point in the history
  10. Add MAX_WIDTH and MAX_HEIGHT constants in Comb.

    The maximum size was 910x525 or 911x526 in different places before.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    ce87c11 View commit details
    Browse the repository at this point in the history
  11. Inline all of YIQ's methods.

    The constructor is the real win here (because it's just
    zero-initialisation), but the operators are short enough to benefit too.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    cee5b4a View commit details
    Browse the repository at this point in the history
  12. Remove YiqBuffer.

    There's no need for a wrapper to make this heap-allocated now, so the
    buffer can just be an array in Comb::FrameBuffer, and we no longer have
    the frame size hardcoded anywhere.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    2efef88 View commit details
    Browse the repository at this point in the history
  13. Rename showOpticalFlowMap to showMap.

    It's not necessarily optical flow now.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    5ed8b9f View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    9b5478a View commit details
    Browse the repository at this point in the history
  15. Add UI for NTSC 1D/2D/3D and adaptive mode on/off.

    1D isn't very useful for real decoding, but it's handy when debugging
    the 2D/3D decoders because it's used as the basis for both of them.
    atsampson committed Aug 3, 2020
    Configuration menu
    Copy the full SHA
    036f5d8 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2020

  1. Implement a new ntsc3d adaptive filter.

    3D decoding looks for candidates in the current frame and two fields in
    either direction, using a similarity heuristic based on the output of
    the existing 2D decoder.
    
    The heuristic is a quality tradeoff: it can produce worse results than
    the non-adaptive 3D decoder for absolutely still images (because of
    spurious chroma returned by the 2D decoder, and content that's similar
    enough to fool the 3D heuristic), but overall the results are much
    better, particularly for animation and other material with repeated
    fields/frames.
    atsampson committed Aug 4, 2020
    Configuration menu
    Copy the full SHA
    5c6406e View commit details
    Browse the repository at this point in the history