BSMOD -- tools for modifying the bit stream of ADV601.


Synopsis

bsmod -i string -o string -soft integer -sharp integer -edge integer -gray -fl2 -fdecim integer -nframes integer -prog integer -sf string -ber float -berh float -bseed integer -repl integer -erf string -pal -bwrepstring -crep string -rbsrep string -blue float -red float -fade int

Description

This tool allows various transformations of files containing video clips compressed by ADV601. It uses raw files coming out in a "PC" format. Note that some of the options below do not mix well, in particular the reported bit rates of the new clip can be incorrect.

Options

-i string -- Input file. The standard input can not be used, only named files.

-o string -- Output file. Similarly, only named files, no standard output.

-soft integer -- Soften images by zeroing N high-frequency levels. For example, "soft 3" will get rid of blocks at levels 1, 2 and 3 (see the diagram), i.e. blocks from 0 to 20.

-sharp integer -- Sharpen images by doubling N high-frequency levels. Doubling the values is done by simply doubling the bin widths. Note that more control can be exersized by using the -sf option Example: "sharp 2" will double the values in blocks of level 1 and 2, i.e. blocks from 0 to 11.

-edge integer -- Edge detection by preserving N levels of high-frequency luminance blocks. Example: "edge 3" will zero all blocks except luminance blocks at levels 1, 2 and 3, i.e. blocks 0,3,6 and 9. At the same, the subbands which remain are amplified by the factor of 2.

-gray -- Convert to gray scale (kill colors). This will zero all chrominance blocks.

-fl2 -- Double the fields. In each frame field 2 (upper field) is thrown away, and field 1 with modified header is placed in the bitstream instead.

-fdecim integer -- Decimate frames (implies field doubling). Example: "fdecim 3" means that instead of frames 1,2,3,4,5,6,7,8,9,... the sequence will be 1,1,1,4,4,4,7,7,7,...., i.e. out of each 3 frames, the first one will be repeated 3 times, while the other two will be thrown away.

-nframes integer -- Number of frames to use. If this argument is not specified, all complete frames are processed. The tool assumes that the last frame is always incomplete since it doesn't verify the consistency of data, only the headers.

-prog integer -- Progressive transmission, N frames per update. In this mode each frame is transmitted in 14 updates, 3 blocks -- one for each component -- per update. Each update happens after the specified number of frames. Note that "prog N" implies the frame decimation with the factor of 14*N.
Example: "prog 5" means that only one out of each 70 frames will be displayed, and it will be modified every 5 frames, i.e. each 1/6 of a second. First only level 6 blocks of frame 1 will be displayed for 1/6 of a second, then levels 6 and 5 for the next 1/6 of a second, etc. After 7/3 seconds, when the whole frame 1 is displayed in full, the video will switch to level 6 blocks of frame 71, and so on.

-sf string -- Scale the bin widths by scales from named file. The file must contain 42 floating point number, one for each block starting with block 0. The tool ignores the rest of the file, so it can filled with comments or other information. There is no formatting: blanks, tabs and new lines are all treated as white space. A file containt 42 1's will cause no change in the bistream. As an example, one can implement "edge 2" using "sf foo" where file "foo" contains "1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 ...." (the rest are all zeroes).

-ber float -- Flip random bits (bits per million). The tool simply determines the blocks in which errors would happen. It then zeroes corresponding blocks as would happen in a system with simple error detection.

-berh float -- Same as "ber", but preserve 3 low-pass blocks. This simulates systems where extra care is take to recover from errors in those small blocks.

-bseed integer -- Random number generator's seed. The tool uses the same seed (for reproducibility of the results) when generating random bit errors, but this option can be used to try different seeds.

-repl integer -- Replicate file for better viewing. Some clips (usually one second long or shorter) are too short for convenient viewing. The tool creates a longer clip in which the original clip is simply repetead the specified number of times.

-erf string -- File name for error log. In badly corrupted bit streams there might be too many errors to be readable on a computer screen. Using the "erf" option, one can put them all in a log file for later viewing.

-pal -- PAL format (default NTSC). This only effects the bit rate reporting.

-bwrep string -- Bin Width Report File. If this file is specifed, the tool will print the binwidth of each block into the file.

-crep string -- Compression Report File. If this file is specifed, the tool will log the compression ratios and bit rates for each of the fields in the clip.

-rbsrep string -- Relative Block Size REPort. File name to which the report about block size (as percent of the total fields size) is written.

-blue float -- scale blue (Cb) component by the factor specified.

-red float -- scale red (Cr) component by the factor specified. Note: Specifying "-blue 0 -red -0" is equivalent to "gray"

-fade int -- gradually dissolve the picture into solid gray. The numeric argument must specify the number of frames during which the fading is done. The frames after that number are discarded, i.e. "-fade 120" implies "-nframes 120".


Block level designation in the stylized Mallat diagram: