From e2d77a6786c14fd9209f0345b1618d5e9e3b320d Mon Sep 17 00:00:00 2001 From: Unknown <elian.di@laposte.net> Date: Wed, 18 Oct 2017 10:47:12 +0200 Subject: [PATCH] Create folders before executing HEVC --- encode.m | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/encode.m b/encode.m index 6c6b5c9..f1a8448 100644 --- a/encode.m +++ b/encode.m @@ -16,6 +16,7 @@ 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); @@ -31,6 +32,17 @@ values = struct2cell(p.Results); extraParameters = fieldnames (p.Unmatched); extraValues = struct2cell(p.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 + try argList = paramToArg([parameters;extraParameters],[values;extraValues]); status = system([TAppEncoder,' ',argList]); @@ -42,19 +54,18 @@ catch system([TAppEncoder,' ',argList]); end - function argList = paramToArg(parameters,values) - indConf = cellfun(@(str) strcmp(str,'ConfigFile'),parameters); - indLog = cellfun(@(str) strcmp(str,'LogFile' ),parameters); - ind = indConf|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 = strjoin(argList(:)); - end - end +function argList = paramToArg(parameters,values) +indConf = cellfun(@(str) strcmp(str,'ConfigFile'),parameters); +indLog = cellfun(@(str) strcmp(str,'LogFile' ),parameters); +ind = indConf|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 = strjoin(argList(:)); +end \ No newline at end of file -- GitLab