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

Use QVector<quint16> rather than QByteArray for TBC fields and RGB output #418

Merged
merged 4 commits into from
Jan 21, 2020

Conversation

atsampson
Copy link
Collaborator

This is a respin of a patch I started last year...

The general idea is to use (named typedefs of) QVector rather than QByteArray for 16-bit TBC and RGB samples. This substantially reduces the number of places where the tools need to use reinterpret_cast, and generally simplifies the code working with fields and decoded frames - the only remaining unsafe casts in the video tools are when doing file IO. ld-chroma-decoder gets the most benefit from this, but most of the tools are affected to some degree.

I'm reasonably confident in the chroma-decoder/dropout-correct/process-vbi changes, but my testsuite doesn't do anything much with diffdod/discmap yet - please check those changes look OK!

See the commit messages for a couple of other minor improvements rolled into this.

One more thing I spotted but haven't changed: several functions in ld-process-vbi compute the zero crossing point as videoParameters.white16bIre - videoParameters.black16bIre - should that actually be (videoParameters.white16bIre + videoParameters.black16bIre) / 2 (the midpoint)?

This avoids needing to reinterpret_cast to quint16 in all the places
that work with field data; the only unsafe casts are now when the data
is being read from or written to a file. It also avoids a few
unnecessary copies of the data (e.g. several places where a non-const
pointer was taken).

It also fixes a few minor problems:

- A couple of functions explicitly treated the TBC data as
  little-endian; it's now native-endian throughout.

- In ld-dropout-correct, statistics could be reported for the wrong
  frame, because they were read from the new OutputFrame rather than the
  one being written out.

- In ld-process-vbi, WhiteFlag was stepping by bytes rather than words
  through the samples (but since the samples should be either black or
  white, this shouldn't really make much difference).
This avoids several reinterpret_casts in the decoders, and simplifies
the display code in ld-analyse.
Since SourceVideo is now non-copyable, the file and cache don't need to
be allocated with new.
@atsampson atsampson added enhancement ld-decode-tools An issue only affecting the ld-decode-tools labels Jan 21, 2020
Copy link
Collaborator

@simoninns simoninns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me; I pulled the changes and gave it some quick tests. ld-diffdod and ld-discmap are the two I'm actively working on, so I will commit your changes and then update my own branch to test. Don't think they will get any end-user use in the meantime.

@simoninns simoninns merged commit 9d5988b into happycube:master Jan 21, 2020
@atsampson atsampson deleted the fieldvector branch January 21, 2020 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ld-decode-tools An issue only affecting the ld-decode-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants