Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 35eb56e6 authored by DIB Elian's avatar DIB Elian
Browse files

Added functions to compute and plot convex envelope

parent 0d8382ab
Branches
No related tags found
No related merge requests found
function [bitrate,peaksnr] = convexEnvelope(bitrate,peaksnr)
%CONVEX_ENVELOPE Compute and plot upper convex hull of 2D
%points
% Detailed explanation goes here
assert(isequal(size(bitrate),size(peaksnr)));
if isscalar(bitrate)
else
conv_ind = convhull(bitrate(:),peaksnr(:));
bitrate = bitrate(conv_ind); peaksnr = peaksnr(conv_ind); % Convex Hull
min_bit_ind = find(bitrate==min(bitrate)); % Min Bitrate Indices
max_bit_ind = find(bitrate==max(bitrate)); % Max Bitrate Indices
[~,min_psnr_ind] = max(peaksnr(min_bit_ind)); % Max PSNR Index
[~,max_psnr_ind] = max(peaksnr(max_bit_ind)); % Max PSNR Index
min_ind = min_bit_ind(min_psnr_ind); % Min Bitrate Max PSNR Index
max_ind = max_bit_ind(max_psnr_ind); % Max Bitrate Max PSNR Index
shift_ind = circshift(1:numel(conv_ind),1-max_ind); % Shift hull indices so max bitrate is the first entry
[~,shift_max_ind] = find(shift_ind==max_ind); % Shift Max Bitrate
[~,shift_min_ind] = find(shift_ind==min_ind); % Shift Min Bitrate
inds = shift_ind(shift_max_ind:shift_min_ind);% Indices corresponding to upper convex hull
bitrate = flip(bitrate(inds));
peaksnr = flip(peaksnr(inds));
end
end
\ No newline at end of file
function [bitrate,peaksnr] = convexPlot(bitrate,peaksnr,varargin)
%CONVEX_BITRATE_PSNR Compute and plot upper convex hull of 2D
%points
% Detailed explanation goes here
[bitrate,peaksnr] = utils.convexEnvelope(bitrate,peaksnr);
plot(bitrate,peaksnr,varargin{:});
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment