Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 90c389dc authored by Elian Dib's avatar Elian Dib
Browse files

Separate encode and encodedecode behaviour

parent 0dfa4690
Branches
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ perm = 1:numel(p.Parameters);
indconf = find(strcmp('ConfigFile',p.Parameters));
perm(1) = indconf; perm(indconf) = 1;
results = orderfields(p.Results,perm);
results = orderfields(p.Results,perm); results = rmfield(results,'ReconFile');
unmatched = p.Unmatched;
parameters = fieldnames (results);
......@@ -40,11 +40,11 @@ values = struct2cell(results);
extraParameters = fieldnames (unmatched);
extraValues = struct2cell(unmatched);
ReconFile = p.Results.ReconFile;
BitstreamFile = p.Results.BitstreamFile;
LogFile = p.Results.LogFile;
for file={ReconFile,BitstreamFile,LogFile}
for file={BitstreamFile,LogFile}
[folder,~,~] = fileparts(file{:});
if ~(7==exist(folder,'dir'))
mkdir(folder);
......
function p = encodedecode(varargin)
%ENCODE Summary of this function goes here
% Detailed explanation goes here
[HEVCDir,~,~] = fileparts(mfilename('fullpath'));
TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
defaultCfg = fullfile(HEVCDir,'cfg','intra.cfg');
p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
p.addParameter('ConfigFile' ,defaultCfg,@ischar);
p.addParameter('InputFile' ,'ref.yuv' ,@ischar);
p.addParameter('BitstreamFile' ,'bit.hevc',@ischar);
p.addParameter('ReconFile' ,'rec.yuv' ,@ischar);
p.addParameter('LogFile' ,'log.rtf' ,@ischar);
p.addParameter('SourceWidth' ,'512' ,@ischar);
p.addParameter('SourceHeight' ,'512' ,@ischar);
p.addParameter('InputBitDepth' ,'8' ,@ischar);
p.addParameter('InternalBitDepth' ,'8' ,@ischar);
p.addParameter('InputChromaFormat' ,'420' ,@ischar);
p.addParameter('FrameRate' ,'60' ,@ischar);
p.addParameter('FrameSkip' ,'0' ,@ischar);
p.addParameter('FramesToBeEncoded' ,'1' ,@ischar);
p.addParameter('QP' ,'30' ,@ischar);
p.addParameter('WarnUnknowParameter','1' ,@ischar);
% Add additional default parameters here
p.parse(varargin{:});
perm = 1:numel(p.Parameters);
indconf = find(strcmp('ConfigFile',p.Parameters));
perm(1) = indconf; perm(indconf) = 1;
results = orderfields(p.Results,perm);
unmatched = p.Unmatched;
parameters = fieldnames (results);
values = struct2cell(results);
extraParameters = fieldnames (unmatched);
extraValues = struct2cell(unmatched);
ReconFile = p.Results.ReconFile;
BitstreamFile = p.Results.BitstreamFile;
LogFile = p.Results.LogFile;
for file={ReconFile,BitstreamFile,LogFile}
[folder,~,~] = fileparts(file{:});
if ~(7==exist(folder,'dir'))
mkdir(folder);
end
end
argList = paramToArg([parameters;extraParameters],[values;extraValues]);
command = [TAppEncoder,' ',argList];
disp(command)
status = system(command);
if status, error('HEVC Error'); end
end
function argList = paramToArg(parameters,values)
indLog = strcmp(parameters,'LogFile'); ind = indLog;
argLog = strjoin(['>' ,values(indLog) ]);
argList = cellfun(@(param,val) ['--',param,'=',val],...
parameters(~ind),values(~ind),'UniformOutput',false);
argList = [argList;argLog];
argList = strjoin(argList(:));
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