Imolib

This is a set of functions for octave. I developed those functions for my personal research, so some of them may be kind of ad-hoc. Anyway, you might find some of them useful.

At the time of writing these lines, Imolib ships with next functions:

imolib_block_dct
Performs the (integer) DCT and inverse DCT transform for a matrix M in NxN blocks. M dimensions must be multiple of N. If N is 8, this function performs reasonably fast. Otherwise, it would probably be too slow for you. 

octave:2> imolib_block_dct([1,2,4,5;3,4,5,6;4,5,6,7;6,7,8,9],2)
ans =

    5   -1   10   -1
   -2   -0   -1    0
   11   -1   15   -1
   -2   -0   -2    0

octave:3> imolib_block_dct(ans, 2, true),
ans =

  1.00000  2.00000  4.00000  5.00000
  3.00000  4.00000  5.00000  6.00000
  4.00000  5.00000  6.00000  7.00000
  6.00000  7.00000  8.00000  9.00000
imolib_block_quantise
Block-wise direct or inverse matrix quantisation. A quant matrix may be used as in MPEG-2 compression. 

octave:9> imolib_block_quantise([1,2,4,5;3,4,5,6;4,5,6,7;6,7,8,9], 2, 1, false, [1,2;3,4])
ans =

  1  1  4  3
  1  1  2  2
  4  3  6  4
  2  2  3  2

octave:10> imolib_block_quantise(ans, 2, 1, true, [1,2;3,4])
ans =

  1  2  4  6
  3  4  6  8
  4  6  6  8
  6  8  9  8
imolib_dct
Extremely slow integer DCT for square matrices.
imolib_fdct
Optimised implementation for DCT and inverse DCT transforms for 8×8 matrices.
imolib_idct
Inverse of imolib_dct.
imolib_load_pgm
Loads pgm images.
imolib_load_ppm
Loads ppm images as three matrices (red, green, and blue).
imolib_mpeg2_chroma_quant
Returns the quantisation matrix for chroma blocks in MPEG-2 compression.
imolib_quantise
Direct or inverse matrix quantisation. Additionally to a global quantisation factor, you can use a per-coefficient quantisation matrix.
imolib_upsample
Naïve image upsampling. 

octave:22> imolib_upsample([1 2 3; 4 5 6], 2)
ans =

  1  1  2  2  3  3
  1  1  2  2  3  3
  4  4  5  5  6  6
  4  4  5  5  6  6
imolib_yuv2rgb
YUV to RGB (and vice versa) conversion.

You can download it from my github, or clone the repository git clone git://github.com/samuelrivas/imolib.git