function [ PDF_RLE_matrix, range, RLE_total, RLE_coefficient_list ] = ComputeRLEPDF( coefficients, step_size, M ); if ( M == 8 ) coefficients = round( coefficients./step_size ); [ row_max, col_max ] = size( coefficients ); RLE_coefficient_list = []; RLE_total = 0; for row = 1:M:row_max for col = 1:M:col_max RLE = mCompute8x8RLE( coefficients( row:row+7, col:col+7 ) ); RLE_coefficient_list = [ RLE_coefficient_list RLE ]; end end RLE_total = size( RLE_coefficient_list, 2 ); RLE_real_min = min( real( RLE_coefficient_list ) ); RLE_real_max = max( real( RLE_coefficient_list ) ); RLE_imag_min = min( imag( RLE_coefficient_list ) ); RLE_imag_max = max( imag( RLE_coefficient_list ) ); PDF_RLE_matrix = zeros( RLE_real_max - RLE_real_min + 1, RLE_imag_max - RLE_imag_min + 1 ); for index = 1:RLE_total PDF_row = real( RLE_coefficient_list( index ) ) - RLE_real_min + 1; PDF_col = imag( RLE_coefficient_list( index ) ) - RLE_imag_min + 1; PDF_RLE_matrix( PDF_row, PDF_col ) = PDF_RLE_matrix( PDF_row, PDF_col ) + 1; end PDF_RLE_matrix = PDF_RLE_matrix/RLE_total; range = [ RLE_real_min, RLE_real_max RLE_imag_min, RLE_imag_max ]; else fprintf( 2, 'Computation aborted! Can only work with block size 8x8. Press any key to continue...' ); pause PDF_MxM_matrix = NaN; range = NaN; RLE_total = NaN; end