-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Library: add overview column #13638
base: main
Are you sure you want to change the base?
Library: add overview column #13638
Conversation
IIUC Each thread needs its own database connection, we cannot share/reuse them. Actually, I'm currently experimenting with using a dedicated thread to render overviews. I'll comment back when I get it working. |
I will def review this when you think it's ready for a look |
2fe92b6
to
132976a
Compare
In case you refer to this PR (thanks!), I think it's better to wait for @ninomp's update. |
132976a
to
4cf2f4d
Compare
4cf2f4d
to
5b84f24
Compare
5b84f24
to
be96671
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this needs a bunch of work before I trust it...
if (row == -1) { | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed here but not in slotOverviewChanged
?
column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_WAVESUMMARYHEX) || | ||
// column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_WAVESUMMARYHEX) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove completely, right?
QString pixmapCacheKey(TrackId trackId, QSize size, WOverview::Type type) { | ||
return QString("Overview_%1_%2_%3_%4") | ||
.arg(static_cast<int>(type)) | ||
.arg(trackId.toString()) | ||
.arg(size.width()) | ||
.arg(size.height()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a string as a cache key is not particularly efficient. a struct with a qHash
implementation would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I think most of this is adopted from CoverArtCache)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
https://doc.qt.io/qt-6/qpixmapcache-key.html#details
Use QPixmapCache::insert() to receive an instance of Key generated by the pixmap cache. You can store the key in your own objects for a very efficient one-to-one object-to-pixmap mapping.
Does such a one-to-one map QString <--> Key map/hash make sense performance wise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, you're right. I didn't see that this was using QPixmapCache internally. The only improvement then is
QString pixmapCacheKey(TrackId trackId, QSize size, WOverview::Type type) { | |
return QString("Overview_%1_%2_%3_%4") | |
.arg(static_cast<int>(type)) | |
.arg(trackId.toString()) | |
.arg(size.width()) | |
.arg(size.height()); | |
} | |
QString pixmapCacheKey(TrackId trackId, QSize size, WOverview::Type type) { | |
return QStringLiteral("Overview_%1_%2_%3_%4") | |
.arg(static_cast<int>(type), | |
trackId.toString(), | |
size.width(), | |
size.height()); | |
} |
// The transformation mode when scaling images | ||
const Qt::TransformationMode kTransformationMode = Qt::SmoothTransformation; | ||
|
||
inline QImage resizeImageSize(const QImage& image, QSize size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline QImage resizeImageSize(const QImage& image, QSize size) { | |
QImage resizeImageSize(const QImage& image, QSize size) { |
class WaveformOverviewRenderer : public Singleton<WaveformOverviewRenderer> { | ||
public: | ||
QImage render(ConstWaveformPointer, WOverview::Type type); | ||
void drawWaveformPartRGB( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't have internal state, nor does it need to be a singleton. Consider making this free functions instead and removing the static data. Pass it instead when calling the functions.
FYI I'll keep pushing fixups to hopefully make this safer and maybe a bit faster for my own builds. |
I just created a PR that contains the work I've done in the past week or so: #13644 |
This is based on @ninomp's initial POC commit 9932cfc
https://github.com/ninomp/mixxx/tree/overviewsinlibrary
I removed the disabled parts and added some TODOs/concerns.
(I'll split up some of the commits so it's a bit easier to review)
(I adopted the RGB simplifications made by @Nino MP, and simplified the others, too)
Peforms nicely, though I bet some parts can be optimized.
For example, why pass a
mixxx::DbConnectionPoolPtr
tostatic FutureResult OverviewCache::prepareOverview
to create a AnyalysisDAO for each request, and not a AnyalysisDAO pointer (probably in TrackCollection)?