Open spillerrec opened 9 years ago
The following code needs to be looked at:
Any code which matches this pattern: scan_line(...).begin()
needs to be reviewed and see if it is possible to avoid using the pointer access. Most of those cases should be in the list above though.
Furthermore I also observed that sometimes scan_line()
is used against a std::vector
instead of another scan_line()
, so RowIt<T>
should be made more general so it can be used with std::vector
(and similar) as well.
There is also quite a bit of code which accesses adjacent rows using pointer access, so some solution to this is quite important...
Data structures:
MultiPlaneIterator
(a complete rewrite is needed anyway though)ImgRow
in ImageEx-pngWeightedSumLine
Para
in Plane-diffColorRow
SubRanges:
FourierPlane::remove()
New issue: ZipRowIt
doesn't work if one of the rows need to be offset.
DctPlane::initialize()
sign()
in EstimatorRenderIdeas:
plane.scan_line()
with operator[]
, should be pretty sweet, but right now scan_line
is convenient to search for.output_plane = someFunction( input_plane1, input_plane2 )
AContainer is also one we constantly iterate over, and we also iterate over planes. And we constantly assume a lot of the content of a container, like all images have consistent amount of planes...
Bjarne Stroustrup talk at CppCon 2015 made me reconsider all the pointer array code which Overmix have in a lot of places, especially the huge Plane implementation. The main points being that it is hard to ensure proper bound safety when you cannot ensure you pass the pointer and size information separately.
I have already started with modifying the interface so
scan_line()
returns aRowIt<T>
instead of aT*
, but this is far from enough, as the value is passed into other structures a lot of the time and needs to be considered in relation to other rows most of the time.Containers/iterators:
Bound checking There really needs to be a lot more bounds-checking in the code. A lot of it depends on two input planes being compatible, but does not check if this is the case. Implementing it in the containers might make it easy to do, with very little overhead.
List of functions needing a paired row-iterator:
Plane::is_interlaced()
Plane::replace_line()
Plane::combine_line()
Plane::maxPlane()
Plane::minPlane()
Plane::mean_value
List of functions needing to access adjacent rows:
prepare_weighted_sum
parallel_edge_line
Data structures:
MultiPlaneIterator
(a complete rewrite is needed anyway though)ImgRow
in ImageEx-pngWeightedSumLine
Para
in Plane-diffSimplePixel + functions
ColorRow
SubRanges:
FourierPlane::remove()
Zipped SubRanges
DctPlane::initialize()
sign()
in EstimatorRenderOther
ImageEx::from_qimage
diffAlpha