sairus7
September 30, 2019, 10:25am
#1
https://github.com/sairus7/OffsetBuffers.jl
Buffer counts items pushed to the end and uses counted value as index for last buffered items.
It may be useful for stream processing, when you have long arrays / signals streaming in chunks or single points, and to process them you need to store some previous buffered history and preserve point position relative to the start of the stream.
6 Likes
yakir12
September 30, 2019, 11:27am
#2
Very cool! I might want to use it with VideoIO.jl to explore video that are larger than memory, ultimately to be used in a Julian video player…
2 Likes
Not to take away from OffsetBuffers ( ), but for AVI purposes you can already do that (and more) with StreamingContainer
:
"""
A = StreamingContainer{T}(f!, parent, streamingaxes::Axis...)
An array-like object possessing one or more axes for which changing "slices" may
be expensive or subject to restrictions. A canonical example would be
an AVI stream, where addressing pixels within the same frame is fast
but jumping between frames might be slow.
Here's a simple example of dividing by the mean of each slice of an image before returning values.
A = AxisArrays.AxisArray(reshape(1:36, 3, 3, 4))
function f!(buffer, slice)
meanslice = mean(slice)
buffer .= slice./meanslice
end
B = StreamingContainer{Float64}(f!, A, AxisArrays.axes(A)[3])
julia> A[:,:,1]
This file has been truncated. show original
2 Likes
Wow. Wish I knew this earlier. OK, I’ll try to use that. Thanks Tim.