Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/inferno/module/ppm_dv.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



# ppm_dv.b

PPM_dv : module {
	PATH : con "/dis/lib/ppm_dv.dis";
	init: fn(nil: ref Draw->Context, nil: list of string);

	Pixel : adt { 
		frame : big;
		x, y, v, channel : int;
	};

	write_to_pixel : fn(s : ref Sequence, c : chan of ref Pixel);

	Sequence : adt {
		headersize : int;
		directory : string;
		framecount : big;
		width, height, maxvalue, bpp : int;
		
		info : fn(s : self ref Sequence) : string;
		scan : fn(s : self ref Sequence);
		sample : fn(s : self ref Sequence, frame, offset : big) : int;
		frame_pixel : fn(s : self ref Sequence, startframe : big, samplesize, x, y, channel : int) : array of int; 
		# one int per frame specified for pixel at coords x,y - rgb is the extra pixel offset into the actual data i.e. data[i+rgb]
		offset : fn(s : self ref Sequence, x, y, channel : int) : big;

		sample_set : fn(s : self ref Sequence, startframe, endframe : big, x, y, channel : int) : ref Samples;

	};

	Samples : adt {
		frame : big;   # last frame read
		firstr : int;  # start of ring buffer
		r : array of real;  # ring buffer
		offset : big; # housekeeping pointer into ppm data y * width + x

		print : fn(s : self ref Samples);
		readnext : fn(s : self ref Samples, seq : ref Sequence) : int; # read next sample into ring
		advance_to : fn(s : self ref Samples, seq : ref Sequence, frame:big) : int;
		in_sequence: fn(s : self ref Samples) : array of real;
	};

	new_sequence : fn(directory : string) : ref Sequence;

};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].