Mentions légales du service

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

Added WarnUnknowParameter to HEVC interface

Also made sure the ConfigFile argument is the first in the argument list sent to the HEVCEncoder executable
parent 100e2b20
Branches
No related tags found
No related merge requests found
......@@ -7,25 +7,25 @@ TAppDecoder = fullfile(HEVCDir,'bin','TAppDecoder.exe');
p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
p.addParameter('BitstreamFile','bit.hevc',@ischar);
p.addParameter('ReconFile' ,'rec.yuv' ,@ischar);
p.addParameter('SkipFrames' ,'0' ,@ischar);
p.addParameter('BitstreamFile' ,'bit.hevc',@ischar);
p.addParameter('ReconFile' ,'rec.yuv' ,@ischar);
p.addParameter('SkipFrames' ,'0' ,@ischar);
p.addParameter('WarnUnknowParameter','1' ,@ischar);
%p.addParameter('LogFile' ,'log.rtf' ,@ischar);
% Add additional default parameters here
p.parse(varargin{:});
parameters = fieldnames (p.Results);
values = struct2cell(p.Results);
% extraParameters = fieldnames (p.Unmatched);
% extraValues = struct2cell(p.Unmatched);
% argList = paramToArg([parameters;extraParameters],[values;extraValues]);
results = p.Results;
parameters = fieldnames (results);
values = struct2cell(results);
argList = paramToArg(parameters,values);
command = [TAppDecoder,' ',argList];
system(command);
disp(command)
status = system(command);
if status, error('HEVC Error'); end
end
......
......@@ -8,29 +8,37 @@ 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('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{:});
parameters = fieldnames (p.Results);
values = struct2cell(p.Results);
perm = 1:numel(p.Parameters);
indconf = find(strcmp('ConfigFile',p.Parameters));
perm(1) = indconf; perm(indconf) = 1;
extraParameters = fieldnames (p.Unmatched);
extraValues = struct2cell(p.Unmatched);
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;
......@@ -43,31 +51,21 @@ for file={ReconFile,BitstreamFile,LogFile}
end
end
try
argList = paramToArg([parameters;extraParameters],[values;extraValues]);
command = [TAppEncoder,' ',argList];
disp(command)
status = system(command);
if status
error('Execution with extra parameters failed, trying execution without');
end
catch
argList = paramToArg(parameters,values);
system([TAppEncoder,' ',argList]);
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)
indConf = cellfun(@(str) strcmp(str,'ConfigFile'),parameters);
indLog = cellfun(@(str) strcmp(str,'LogFile' ),parameters);
ind = indConf|indLog;
indLog = strcmp(parameters,'LogFile'); ind = indLog;
argConf = strjoin(['-c',values(indConf)]);
argLog = strjoin(['>' ,values(indLog) ]);
argList = cellfun(@(param,val) ['--',param,'=',val],...
parameters(~ind),values(~ind),'UniformOutput',false);
argList = [argConf;argList;argLog];
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