Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEVC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
LightFieldCodingLibrary
HEVC
Commits
4a89bd5a
Commit
4a89bd5a
authored
7 years ago
by
DIB Elian
Browse files
Options
Downloads
Patches
Plain Diff
Deal with HEVC "-c" parameter
parent
0f798f3f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
codec.m
+24
-13
24 additions, 13 deletions
codec.m
with
24 additions
and
13 deletions
codec.m
+
24
−
13
View file @
4a89bd5a
...
...
@@ -55,7 +55,7 @@ if encode
HEVCp
.
addParameter
(
'QP'
,
'30'
,
@
ischar
);
HEVCp
.
addParameter
(
'WarnUnknowParameter'
,
'0'
,
@
ischar
);
if
decode
HEVCp
.
addParameter
(
'ReconFile'
,
'rec.yuv'
,
@
ischar
);
HEVCp
.
addParameter
(
'ReconFile'
,
'rec.yuv'
,
@
ischar
);
end
elseif
decode
HEVCp
.
addParameter
(
'BitstreamFile'
,
'bit.hevc'
,
@
ischar
);
...
...
@@ -70,27 +70,19 @@ HEVCp.parse(codecp.Unmatched);
HEVCParams
=
HEVCp
.
Results
;
extraHEVCParams
=
HEVCp
.
Unmatched
;
% Make sure ConfigFile is the first parameter to set default values
if
encode
perm
=
1
:
numel
(
HEVCp
.
Parameters
);
indconf
=
find
(
strcmp
(
'ConfigFile'
,
HEVCp
.
Parameters
));
perm
(
1
)
=
indconf
;
perm
(
indconf
)
=
1
;
HEVCParams
=
orderfields
(
HEVCParams
,
perm
);
end
% Make sure to create output folders before running executable
[
folder
,
~
,
~
]
=
fileparts
(
HEVC
p
.
Result
s
.
BitstreamFile
);
[
folder
,
~
,
~
]
=
fileparts
(
HEVC
Param
s
.
BitstreamFile
);
if
~
exist
(
folder
,
'dir'
)
mkdir
(
folder
);
end
if
decode
[
folder
,
~
,
~
]
=
fileparts
(
HEVC
p
.
Result
s
.
ReconFile
);
[
folder
,
~
,
~
]
=
fileparts
(
HEVC
Param
s
.
ReconFile
);
if
~
exist
(
folder
,
'dir'
)
mkdir
(
folder
);
end
end
[
LogFolder
,
LogName
,
~
]
=
fileparts
(
HEVC
p
.
Result
s
.
BitstreamFile
);
[
LogFolder
,
LogName
,
~
]
=
fileparts
(
HEVC
Param
s
.
BitstreamFile
);
LogFileEnc
=
fullfile
(
LogFolder
,[
LogName
,
'_enc.rtf'
]);
LogFileDec
=
fullfile
(
LogFolder
,[
LogName
,
'_dec.rtf'
]);
...
...
@@ -98,12 +90,14 @@ LogFileDec = fullfile(LogFolder,[LogName,'_dec.rtf']);
HEVCArgList
=
paramToArgList
(
HEVCParams
);
extraHEVCArgList
=
paramToArgList
(
extraHEVCParams
);
% Prompt in terminal and write in log file
if
ispc
redirect
=
@
(
logfile
)
[
'> "'
,
logfile
,
'" | type "'
logfile
,
'"'
];
elseif
isunix
redirect
=
@
(
logfile
)
[
'| tee '
,
LogFile
];
end
% Execute command
if
encode
command
=
[
'"'
TApp
,
'" '
,
HEVCArgList
,
' '
,
extraHEVCArgList
,
' '
,
redirect
(
LogFileEnc
)];
elseif
decode
...
...
@@ -113,6 +107,7 @@ end
disp
(
command
)
status
=
system
(
command
);
% Try without extra HEVC parameters if HEVC error
if
status
if
encode
command
=
[
'"'
TApp
,
'" '
,
HEVCArgList
,
' '
,
redirect
(
LogFileEnc
)];
...
...
@@ -126,6 +121,7 @@ if status
end
end
% Read compression statistics from log file
try
[
nbBits
,
peaksnr
]
=
HEVC
.
parseLog
(
LogFileEnc
);
catch
...
...
@@ -135,10 +131,25 @@ end
end
function
argList
=
paramToArgList
(
Params
)
% Get parameters and arguments
parameters
=
fieldnames
(
Params
);
values
=
struct2cell
(
Params
);
% Deal with '-c' being the single command line parameter for configuration file
indcfg
=
strcmp
(
parameters
,
'ConfigFile'
);
if
any
(
indcfg
)
argcfg
=
[
'-c "'
,
values
{
indcfg
},
'"'
];
else
argcfg
=
''
;
end
parameters
=
parameters
(
~
indcfg
);
values
=
values
(
~
indcfg
);
% Build command line argument list
argList
=
cellfun
(
@
(
param
,
val
)
[
'--'
,
param
,
'="'
,
val
,
'"'
],
parameters
,
values
,
'UniformOutput'
,
false
);
argList
=
strjoin
(
argList
(:));
argList
=
strjoin
(
[
argcfg
;
argList
(:)
]
);
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment