From 204697c857e272241220c1a303a3ab3a3061b5a6 Mon Sep 17 00:00:00 2001 From: Osamu WATANABE Date: Thu, 23 Jul 2020 16:14:42 +0900 Subject: [PATCH] remove some files --- source/utils/compare_P1_P15.m | 108 --------------- source/utils/conformance_testing_htj2k.m | 162 ----------------------- source/utils/conformance_testing_j2k.m | 101 -------------- source/utils/read_conformance_data.m | 16 --- 4 files changed, 387 deletions(-) delete mode 100644 source/utils/compare_P1_P15.m delete mode 100644 source/utils/conformance_testing_htj2k.m delete mode 100644 source/utils/conformance_testing_j2k.m delete mode 100644 source/utils/read_conformance_data.m diff --git a/source/utils/compare_P1_P15.m b/source/utils/compare_P1_P15.m deleted file mode 100644 index b0c1ea6..0000000 --- a/source/utils/compare_P1_P15.m +++ /dev/null @@ -1,108 +0,0 @@ -clear; -clc; -load barbara; -%P = imread('kodim23.png'); -base_stepsize = [1, 1 / 2, 1 / 4, 1 / 8, 1 / 16, 1 / 32, 1 / 64, 1 / 128, 1 / 256]; -time_eP1 = zeros(length(base_stepsize) + 1, 2); -time_eP15 = zeros(length(base_stepsize) + 1, 2); -time_dP1 = zeros(length(base_stepsize) + 1, 2); -time_dP15 = zeros(length(base_stepsize) + 1, 2); - -PSNR_P1 = zeros(length(base_stepsize) + 1, 1); -PSNR_P15 = zeros(length(base_stepsize) + 1, 1); - -target_rate = 24; % -test_image = imresize(img_barbara, 1); - -P1_cmodes = ''; -P15_cmodes = 'HT'; - -N_trial = 10; - -fprintf('================ Encoding ====\n'); - -for n = 1:N_trial - fprintf('Trial number = %d/%d\n', n, N_trial); - fprintf('==== Part 1 ====\n'); - for i = 1:length(base_stepsize) - fname = sprintf('p1_%f.j2c', base_stepsize(i)); - [time_eP1(i, 1, n), time_eP1(i, 2, n)] = encode_HTJ2K(fname, test_image, 'levels', 5, 'reversible', 'no', 'cmodes', P1_cmodes, 'qstep', base_stepsize(i), 'blk', [64, 64], 'guard', 1); - end - [time_eP1(i + 1, 1, n), time_eP1(i + 1, 2, n)] = encode_HTJ2K('p1_lossless.j2c', test_image, 'levels', 5, 'reversible', 'yes', 'cmodes', P1_cmodes, 'qstep', base_stepsize(i), 'blk', [64, 64], 'guard', 1); - is_HT = true; - fprintf('==== Part 15 ====\n'); - for i = 1:length(base_stepsize) - fname = sprintf('p15_%f.j2c', base_stepsize(i)); - [time_eP15(i, 1, n), time_eP15(i, 2, n)] = encode_HTJ2K(fname, test_image, 'levels', 5, 'reversible', 'no', 'cmodes', P15_cmodes, 'qstep', base_stepsize(i), 'blk', [64, 64], 'guard', 1); - end - [time_eP15(i + 1, 1, n), time_eP15(i + 1, 2, n)] = encode_HTJ2K('p15_lossless.j2c', test_image, 'levels', 5, 'reversible', 'yes', 'cmodes', P15_cmodes, 'qstep', base_stepsize(i), 'blk', [64, 64], 'guard', 1); -end -time_enc_P1_ave = mean(time_eP1, 3); -time_enc_P15_ave = mean(time_eP15, 3); - -hold off; -figure(1); -plot([1:10], time_enc_P1_ave(:, 2) ./ time_enc_P15_ave(:, 2), 'Color', [0.85, 0.33, 0.10], 'LineStyle', '--', 'LineWidth', 2, 'Marker', '*', 'MarkerSize', 8); -%pbaspect([2 1 1]); -% ax = gca; -% outerpos = ax.OuterPosition; -% ti = ax.TightInset; -% left = outerpos(1) + ti(1); -% bottom = outerpos(2) + ti(2); -% ax_width = outerpos(3) - ti(1) - ti(3); -% ax_height = outerpos(4) - ti(2) - ti(4); -% ax.Position = [left bottom ax_width ax_height]; -hold on; -plot([1:10], time_enc_P1_ave(:, 1) ./ time_enc_P15_ave(:, 1), 'Color', [0.00, 0.45, 0.74], 'LineStyle', '-.', 'LineWidth', 2, 'Marker', 'o', 'MarkerSize', 8); -xlabel('Base step size (\Delta_b is multiplied by this value)', 'FontName', 'Helvetica', 'FontWeight', 'bold'); -ylabel('Speedup factor', 'FontName', 'Helvetica', 'FontWeight', 'bold'); -xticks([1:10]); -xticklabels({'1', '1/2', '1/4', '1/8', '1/16', '1/32', '1/64', '1/128', '1/256', 'Lossless'}); -legend('Block encoder only', 'Whole encoding', 'Location', 'best'); - - -for n = 1:N_trial - fprintf('Trial number = %d/%d\n', n, N_trial); - fprintf('================ Decoding ====\n'); - fprintf('==== Part 1 ====\n'); - for i = 1:length(base_stepsize) - fname = sprintf('p1_%f.j2c', base_stepsize(i)); - [~, p1_output{i}, time_dP1(i, 1), time_dP1(i, 2)] = decode_HTJ2K(fname, true); - end - [~, p1_output{i + 1}, time_dP1(i + 1, 1), time_dP1(i + 1, 2)] = decode_HTJ2K('p1_lossless.j2c', true); - - fprintf('==== Part 15 ====\n'); - for i = 1:length(base_stepsize) - fname = sprintf('p15_%f.j2c', base_stepsize(i)); - [~, p15_output{i}, time_dP15(i, 1), time_dP15(i, 2)] = decode_HTJ2K(fname, true); - end - [~, p15_output{i + 1}, time_dP15(i + 1, 1), time_dP15(i + 1, 2)] = decode_HTJ2K('p15_lossless.j2c', true); - - -end - -time_dec_P1_ave = mean(time_dP1, 3); -time_dec_P15_ave = mean(time_dP15, 3); - -for i = 1:length(base_stepsize) + 1 - PSNR_P1(i) = psnr(uint8(p1_output{i}), test_image); - PSNR_P15(i) = psnr(uint8(p15_output{i}), test_image); -end -hold off; -figure(2); -plot([1:10], time_dec_P1_ave(:, 2) ./ time_dec_P15_ave(:, 2), 'Color', [0.85, 0.33, 0.10], 'LineStyle', '--', 'LineWidth', 2, 'Marker', '*', 'MarkerSize', 8); -hold on; -plot([1:10], time_dec_P1_ave(:, 1) ./ time_dec_P15_ave(:, 1), 'Color', [0.00, 0.45, 0.74], 'LineStyle', '-.', 'LineWidth', 2, 'Marker', 'o', 'MarkerSize', 8); -hold off; -xlabel('Base step size (\Delta_b is multiplied by this value)', 'FontName', 'Helvetica', 'FontWeight', 'bold'); -ylabel('Speedup factor', 'FontName', 'Helvetica', 'FontWeight', 'bold'); -xticks([1:10]); -xticklabels({'1', '1/2', '1/4', '1/8', '1/16', '1/32', '1/64', '1/128', '1/256', 'Lossless'}); -legend('Block decoder only', 'Whole decoding', 'Location', 'best'); - -% -% plot([1:5], 100*(bpp_p15./bpp_p1-1), 'Color', [0.00 0.45 0.74], 'LineStyle', '-.', 'LineWidth', 2, 'Marker', 'o', 'MarkerSize', 8); -% xlabel('Bit-rate of J2K codestreams (bit/pixel)', 'FontName', 'Helvetica', 'FontWeight', 'bold'); -% ylabel('Efficiency loss in HTJ2K codestreams(%)', 'FontName', 'Helvetica', 'FontWeight', 'bold'); -% xticks([1:10]); -% xticklabels({'0.25', '0.5', '1.0', '2.0', 'Lossless'}); diff --git a/source/utils/conformance_testing_htj2k.m b/source/utils/conformance_testing_htj2k.m deleted file mode 100644 index 5a87664..0000000 --- a/source/utils/conformance_testing_htj2k.m +++ /dev/null @@ -1,162 +0,0 @@ -function [out_dec, out_ref] = conformance_testing_htj2k(p, n_codestream, ht_or_hm, fid) -if nargin < 4 - fid = 1; %stdout -end -reduce = 0; -if n_codestream == 8 && p == 0 - reduce = 1; -end - -magb = {; ... - {; ... - [11], ... - [11, 12], ... - [11, 14], ... - [11, 12], ... - [11, 12], ... - [11, 15, 18], ... - [11, 15, 16], ... - [11, 15, 16], ... - [11], ... - [11], ... - [10], ... - [11], ... - [11], ... - [11], ... - [11, 14], ... - [11]}, ... - {; ... - [11, 12], ... - [11, 12], ... - [11, 12], ... - [9], ... - [11], ... - [11], ... - [11]; ... - }; ... - }; - -nimg = [16, 7]; -if strcmp(ht_or_hm, 'ht') == true - for i = 1:length(magb{p + 1}{n_codestream}) - if p == 1 && n_codestream == 2 - spath = sprintf('~/Documents/Clone/WG1/htj2k-codestreams/htj2k_bsets_profile%d/p%d_%02d_bset/', p, p, n_codestream); - fname{i} = sprintf('ds%d_ht_%02d_b%d_mod.j2k', p, n_codestream, magb{p + 1}{n_codestream}(i)); - else - spath = sprintf('~/Documents/Clone/WG1/htj2k-codestreams/htj2k_bsets_profile%d/p%d_%02d_bset/', p, p, n_codestream); - fname{i} = sprintf('ds%d_ht_%02d_b%d.j2k', p, n_codestream, magb{p + 1}{n_codestream}(i)); - end - fprintf('File: %s\n', fname{i}); - [ht_out{p + 1, n_codestream, i}, ht_c_out{p + 1, n_codestream, i}] = decode_HTJ2K(sprintf('%s%s', spath, fname{i}), true, reduce); - end -else - assert(p == 0 && n_codestream == 6 || n_codestream == 15); - if n_codestream == 6 - mixed_magb = {[11, 18]}; - else - mixed_magb = {[8]}; - end - for i = 1:length(mixed_magb{1}) - spath = sprintf('~/Documents/Clone/WG1/htj2k-codestreams/htj2k_bsets_profile%d/p%d_%02d_bset/', p, p, n_codestream); - fname{i} = sprintf('ds%d_hm_%02d_b%d.j2k', p, n_codestream, mixed_magb{1}(i)); - fprintf('File: %s\n', fname{i}); - [ht_out{p + 1, n_codestream, i}, ht_c_out{p + 1, n_codestream, i}] = decode_HTJ2K(sprintf('%s%s', spath, fname{i}), true, reduce); - end -end - -read_conformance_data; - -n_magb = {[1, 2, 2, 2, 2, 3, 3, 3, 1, 1, 1, 1, 1, 1, 2, 1], [2, 2, 2, 1, 1, 1, 1]}; -nc = {[0, 0, 0, 2, 3, 3, 2, 2, 0, 2, 0, 0, 3, 2, 0, 0], [0, 2, 3, 0, 2, 2, 1]}; -rev = {[1, 1, 1, 0, 2, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], [2, 0, 2, 0, 0, 0, 1]}; -ycc = {[0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0]}; -% 0: uint8, 1:4bit signed, 2:12 bit unsigned, 3:12bit signed -img_type = {[0, 0, 1, 0, 0, 2, 3, 3, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 2, 0, 0, 0]}; -fprintf(fid, 'Profile %d\n', p); - -if strcmp(ht_or_hm, 'ht') == true - m_stop = n_magb{p+1}(n_codestream); -else - m_stop = length(mixed_magb{1}); -end -for m = 1:m_stop - fprintf(fid, '\tcodestream # %2d MAGB = %2d\n', n_codestream, magb{p + 1}{n_codestream}(m)); - for c = 0:nc{p+1}(n_codestream) - if img_type{p+1}(n_codestream) == 0 - fun = @uint8; - mul = 1; - offset = 0; - dc_offset = 2^7; - MAXVAL = 255; - MINVAL = 0; - elseif img_type{p+1}(n_codestream) == 1 - fun = @uint8; - mul = 16; - offset = 2^7; - dc_offset = 0; - MAXVAL = 7; - MINVAL = -8; - elseif img_type{p+1}(n_codestream) == 2 - fun = @uint16; - mul = 1; - offset = 0; - dc_offset = 2^11; - MAXVAL = 4095; - MINVAL = 0; - else - fun = @uint16; - mul = 1; - offset = 2^11; - dc_offset = 0; - MAXVAL = 2047; - MINVAL = -2048; - end - - tmp_ref{c+1} = test_imgs{p+1, n_codestream, c+1}; - end - - if ycc{p+1}(n_codestream) == 1 - for i = 0:nc{p+1}(n_codestream) - tmp_d(:, :, i + 1) = ht_out{p+1, n_codestream, m}{i + 1}; - tmp_r(:, :, i + 1) = tmp_ref{i+1}; - end - if rev{p+1}(n_codestream) == 1 - tmp_d(:, :, 1:3) = myycbcr2rgb(tmp_d(:, :, 1:3), 1); - else - tmp_d(:, :, 1:3) = myycbcr2rgb(tmp_d(:, :, 1:3), 0); - end - for i = 0:nc{p+1}(n_codestream) - dec{i+1} = tmp_d(:, :, i + 1); - ref{i+1} = tmp_r(:, :, i + 1); - end - else - for i = 0:nc{p+1}(n_codestream) - dec{i+1} = ht_out{p+1, n_codestream, m}{i + 1}; - ref{i+1} = tmp_ref{i+1}; - end - end - - - for i = 0:nc{p+1}(n_codestream) - tmp = dec{i+1}; - tmp = round(tmp); - tmp = tmp + dc_offset; - tmp(tmp > MAXVAL) = MAXVAL; - tmp(tmp < MINVAL) = MINVAL; - dec{i+1} = tmp; - % dec{i+1} = fun(dec{i+1}*mul+offset); - % ref{i+1} = fun(ref{i+1}*mul+offset); - end - - for i = 0:nc{p+1}(n_codestream) - d = ref{i+1} - dec{i+1}; - MSE = mean2(d.^2); %/length(ref{i+1}(:)); - PEAK = max(max(abs(d))); - fprintf(fid, '\t\tc#%d, PEAK = %-4d, MSE = %-9.4f\n', i, PEAK, MSE); - out_ref{m, i+1} = ref{i+1}; - out_dec{m, i+1} = dec{i+1}; - end - - fprintf('\n'); - clear ref dec tmp_d tmp_r; -end diff --git a/source/utils/conformance_testing_j2k.m b/source/utils/conformance_testing_j2k.m deleted file mode 100644 index 72965e6..0000000 --- a/source/utils/conformance_testing_j2k.m +++ /dev/null @@ -1,101 +0,0 @@ -function [out_dec, out_ref] = conformance_testing_j2k(p, n_codestream) - -reduce = 0; -if n_codestream == 8 && p == 0 - reduce = 1; -end - - -nimg = [16, 7]; - -fname = sprintf('~/Documents/Clone/WG1/htj2k-codestreams/codestreams_profile%d/p%d_%02d.j2k', p, p, n_codestream); -[ht_out{p + 1, n_codestream}, ht_c_out{p + 1, n_codestream}] = decode_HTJ2K(fname, true, reduce); - - -read_conformance_data; - -nc = {[0, 0, 0, 2, 3, 3, 2, 2, 0, 2, 0, 0, 3, 2, 0, 0], [0, 2, 3, 0, 2, 2, 1]}; -rev = {[1, 1, 1, 0, 2, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], [2, 0, 2, 0, 0, 0, 1]}; -ycc = {[0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0]}; -% 0: uint8, 1:4bit signed, 2:12 bit unsigned, 3:12bit signed -img_type = {[0, 0, 1, 0, 0, 2, 3, 3, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 2, 0, 0, 0]}; -fprintf('Profile %d\n', p); - -fprintf('\tcodestream # %2d\n', n_codestream); -for c = 0:nc{p+1}(n_codestream) - if img_type{p+1}(n_codestream) == 0 - fun = @uint8; - mul = 1; - offset = 0; - dc_offset = 2^7; - MAXVAL = 255; - MINVAL = 0; - elseif img_type{p+1}(n_codestream) == 1 - fun = @uint8; - mul = 16; - offset = 2^7; - dc_offset = 0; - MAXVAL = 7; - MINVAL = -8; - elseif img_type{p+1}(n_codestream) == 2 - fun = @uint16; - mul = 1; - offset = 0; - dc_offset = 2^11; - MAXVAL = 4095; - MINVAL = 0; - else - fun = @uint16; - mul = 1; - offset = 2^11; - dc_offset = 0; - MAXVAL = 2047; - MINVAL = -2048; - end - - tmp_ref{c+1} = test_imgs{p+1, n_codestream, c+1}; -end - -if ycc{p+1}(n_codestream) == 1 - for i = 0:nc{p+1}(n_codestream) - tmp_d(:, :, i + 1) = ht_out{p+1, n_codestream}{i + 1}; - tmp_r(:, :, i + 1) = tmp_ref{i+1}; - end - if rev{p+1}(n_codestream) == 1 - tmp_d(:, :, 1:3) = myycbcr2rgb(tmp_d(:, :, 1:3), 1); - else - tmp_d(:, :, 1:3) = myycbcr2rgb(tmp_d(:, :, 1:3), 0); - end - for i = 0:nc{p+1}(n_codestream) - dec{i+1} = tmp_d(:, :, i + 1); - ref{i+1} = tmp_r(:, :, i + 1); - end -else - for i = 0:nc{p+1}(n_codestream) - dec{i+1} = ht_out{p+1, n_codestream}{i + 1}; - ref{i+1} = tmp_ref{i+1}; - end -end - - -for i = 0:nc{p+1}(n_codestream) - tmp = dec{i+1}; - tmp = round(tmp); - tmp = tmp + dc_offset; - tmp(tmp > MAXVAL) = MAXVAL; - tmp(tmp < MINVAL) = MINVAL; - dec{i+1} = tmp; - % dec{i+1} = fun(dec{i+1}*mul+offset); - % ref{i+1} = fun(ref{i+1}*mul+offset); -end - -for i = 0:nc{p+1}(n_codestream) - d = ref{i+1} - dec{i+1}; - MSE = mean2(d.^2); %/length(ref{i+1}(:)); - PEAK = max(max(abs(d))); - fprintf('\t\tc#%d, PEAK = %-4d, MSE = %-9.4f\n', i, PEAK, MSE); - out_ref{i+1} = ref{i+1}; - out_dec{i+1} = dec{i+1}; -end -fprintf('\n'); -clear ref dec tmp_d tmp_r; diff --git a/source/utils/read_conformance_data.m b/source/utils/read_conformance_data.m deleted file mode 100644 index 28b6cc9..0000000 --- a/source/utils/read_conformance_data.m +++ /dev/null @@ -1,16 +0,0 @@ -%test_imgs = cell(16,4); -cn = [0, 0, 0, 2, 3, 3, 2, 2, 0, 2, 0, 0, 3, 2, 0, 0]; -for n = 1:16 - for c = 0:cn(n) - fbase = sprintf('~/Documents/Clone/WG1/htj2k-codestreams/reference_class1_profile0/c1p0_%02d-%d.pgx', n, c); - test_imgs{1, n, c+1} = read_pgx(fbase); - end -end - -cn = [0, 2, 3, 0, 2, 2, 1]; -for n = 1:7 - for c = 0:cn(n) - fbase = sprintf('~/Documents/Clone/WG1/htj2k-codestreams/reference_class1_profile1/c1p1_%02d-%d.pgx', n, c); - test_imgs{2, n, c+1} = read_pgx(fbase); - end -end