Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VVCSoftware_VTM
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
jvet
VVCSoftware_VTM
Commits
9b93350c
Commit
9b93350c
authored
5 years ago
by
Vadim Seregin
Browse files
Options
Downloads
Patches
Plain Diff
move to class members
parent
7f9227b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1044
Fix for #615 independent layer implementation
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
source/App/EncoderApp/EncApp.cpp
+71
-68
71 additions, 68 deletions
source/App/EncoderApp/EncApp.cpp
source/App/EncoderApp/EncApp.h
+11
-1
11 additions, 1 deletion
source/App/EncoderApp/EncApp.h
source/App/EncoderApp/encmain.cpp
+22
-15
22 additions, 15 deletions
source/App/EncoderApp/encmain.cpp
with
104 additions
and
84 deletions
source/App/EncoderApp/EncApp.cpp
+
71
−
68
View file @
9b93350c
...
...
@@ -65,6 +65,9 @@ EncApp::EncApp()
#if JVET_O0756_CALCULATE_HDRMETRICS
m_metricTime
=
std
::
chrono
::
milliseconds
(
0
);
#endif
#if JVET_N0278_FIXES
m_numEncoded
=
0
;
#endif
}
EncApp
::~
EncApp
()
...
...
@@ -701,10 +704,19 @@ void EncApp::xInitLib(bool isFieldCoding)
// ====================================================================================================================
#if JVET_N0278_FIXES
std
::
list
<
PelUnitBuf
*>
recBufList
;
void
EncApp
::
createLib
()
{
const
int
sourceHeight
=
m_isField
?
m_iSourceHeightOrg
:
m_iSourceHeight
;
UnitArea
unitArea
(
m_chromaFormatIDC
,
Area
(
0
,
0
,
m_iSourceWidth
,
sourceHeight
)
);
m_orgPic
=
new
PelStorage
;
m_trueOrgPic
=
new
PelStorage
;
m_orgPic
->
create
(
unitArea
);
m_trueOrgPic
->
create
(
unitArea
);
#if EXTENSION_360_VIDEO
m_ext360
=
new
TExt360AppEncTop
(
*
this
,
m_cEncLib
.
getGOPEncoder
()
->
getExt360Data
(),
*
(
m_cEncLib
.
getGOPEncoder
()
),
orgPic
);
#endif
m_bitstream
.
open
(
m_bitstreamFileName
.
c_str
(),
fstream
::
binary
|
fstream
::
out
);
if
(
!
m_bitstream
)
{
...
...
@@ -713,8 +725,7 @@ void EncApp::createLib()
// initialize internal class & member variables
xInitLibCfg
();
xCreateLib
(
recBufList
);
xCreateLib
(
m_recBufList
);
xInitLib
(
m_isField
);
printChromaFormat
();
...
...
@@ -727,104 +738,96 @@ void EncApp::destroyLib()
// delete used buffers in encoder class
m_cEncLib
.
deletePicBuffer
();
for
(
auto
&
p
:
recBufList
)
for
(
auto
&
p
:
m_
recBufList
)
{
delete
p
;
}
recBufList
.
clear
();
m_
recBufList
.
clear
();
xDestroyLib
();
m_bitstream
.
close
();
m_orgPic
->
destroy
();
m_trueOrgPic
->
destroy
();
delete
m_trueOrgPic
;
delete
m_orgPic
;
#if EXTENSION_360_VIDEO
m_ext360
->
destroy
();
delete
m_ext360
;
#endif
printRateSummary
();
}
void
EncApp
::
encode
()
bool
EncApp
::
encode
()
{
// main encoder loop
int
iNumEncoded
=
0
;
bool
bEos
=
false
;
const
InputColourSpaceConversion
ipCSC
=
m_inputColourSpaceConvert
;
const
InputColourSpaceConversion
snrCSC
=
(
!
m_snrInternalColourSpace
)
?
m_inputColourSpaceConvert
:
IPCOLOURSPACE_UNCHANGED
;
PelStorage
trueOrgPic
;
PelStorage
orgPic
;
const
int
sourceHeight
=
m_isField
?
m_iSourceHeightOrg
:
m_iSourceHeight
;
UnitArea
unitArea
(
m_chromaFormatIDC
,
Area
(
0
,
0
,
m_iSourceWidth
,
sourceHeight
)
);
orgPic
.
create
(
unitArea
);
trueOrgPic
.
create
(
unitArea
);
// read input YUV file
#if EXTENSION_360_VIDEO
TExt360AppEncTop
ext360
(
*
this
,
m_cEncLib
.
getGOPEncoder
()
->
getExt360Data
(),
*
(
m_cEncLib
.
getGOPEncoder
()
),
orgPic
);
#endif
while
(
!
bEos
)
if
(
m_ext360
->
isEnabled
()
)
{
// read input YUV file
#if EXTENSION_360_VIDEO
if
(
ext360
.
isEnabled
()
)
{
ext360
.
read
(
m_cVideoIOYuvInputFile
,
orgPic
,
trueOrgPic
,
ipCSC
);
}
else
{
m_cVideoIOYuvInputFile
.
read
(
orgPic
,
trueOrgPic
,
ipCSC
,
m_aiPad
,
m_InputChromaFormatIDC
,
m_bClipInputVideoToRec709Range
);
}
m_ext360
->
read
(
m_cVideoIOYuvInputFile
,
orgPic
,
trueOrgPic
,
ipCSC
);
}
else
{
m_cVideoIOYuvInputFile
.
read
(
*
m_orgPic
,
*
m_trueOrgPic
,
ipCSC
,
m_aiPad
,
m_InputChromaFormatIDC
,
m_bClipInputVideoToRec709Range
);
}
#else
m_cVideoIOYuvInputFile
.
read
(
orgPic
,
trueOrgPic
,
ipCSC
,
m_aiPad
,
m_InputChromaFormatIDC
,
m_bClipInputVideoToRec709Range
);
m_cVideoIOYuvInputFile
.
read
(
*
m_
orgPic
,
*
m_
trueOrgPic
,
ipCSC
,
m_aiPad
,
m_InputChromaFormatIDC
,
m_bClipInputVideoToRec709Range
);
#endif
// increase number of received frames
m_iFrameRcvd
++
;
// increase number of received frames
m_iFrameRcvd
++
;
bEos
=
(
m_isField
&&
(
m_iFrameRcvd
==
(
m_framesToBeEncoded
>>
1
)
)
)
||
(
!
m_isField
&&
(
m_iFrameRcvd
==
m_framesToBeEncoded
)
);
bEos
=
(
m_isField
&&
(
m_iFrameRcvd
==
(
m_framesToBeEncoded
>>
1
)
)
)
||
(
!
m_isField
&&
(
m_iFrameRcvd
==
m_framesToBeEncoded
)
);
bool
flush
=
0
;
// if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
if
(
m_cVideoIOYuvInputFile
.
isEof
()
)
{
flush
=
true
;
bEos
=
true
;
m_iFrameRcvd
--
;
m_cEncLib
.
setFramesToBeEncoded
(
m_iFrameRcvd
);
}
bool
flush
=
0
;
// if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
if
(
m_cVideoIOYuvInputFile
.
isEof
()
)
{
flush
=
true
;
bEos
=
true
;
m_iFrameRcvd
--
;
m_cEncLib
.
setFramesToBeEncoded
(
m_iFrameRcvd
);
}
// call encoding function for one frame
if
(
m_isField
)
{
m_cEncLib
.
encode
(
bEos
,
flush
?
0
:
&
orgPic
,
flush
?
0
:
&
trueOrgPic
,
snrCSC
,
recBufList
,
iNumEncoded
,
m_isTopFieldFirst
);
// call encoding function for one frame
if
(
m_isField
)
{
m_cEncLib
.
encode
(
bEos
,
flush
?
0
:
m_orgPic
,
flush
?
0
:
m_trueOrgPic
,
snrCSC
,
m_recBufList
,
m_numEncoded
,
m_isTopFieldFirst
);
#if JVET_O0756_CALCULATE_HDRMETRICS
m_metricTime
=
m_cEncLib
.
getMetricTime
();
m_metricTime
=
m_cEncLib
.
getMetricTime
();
#endif
}
else
{
m_cEncLib
.
encode
(
bEos
,
flush
?
0
:
&
orgPic
,
flush
?
0
:
&
trueOrgPic
,
snrCSC
,
recBufList
,
iNumEncoded
);
}
else
{
m_cEncLib
.
encode
(
bEos
,
flush
?
0
:
m_orgPic
,
flush
?
0
:
m_trueOrgPic
,
snrCSC
,
m_recBufList
,
m_numEncoded
);
#if JVET_O0756_CALCULATE_HDRMETRICS
m_metricTime
=
m_cEncLib
.
getMetricTime
();
m_metricTime
=
m_cEncLib
.
getMetricTime
();
#endif
}
}
// write bistream to file if necessary
if
(
iNumEncoded
>
0
)
{
xWriteOutput
(
iNumEncoded
,
recBufList
);
}
// temporally skip frames
if
(
m_temporalSubsampleRatio
>
1
)
{
// write bistream to file if necessary
if
(
m_numEncoded
>
0
)
{
xWriteOutput
(
m_numEncoded
,
m_recBufList
);
}
// temporally skip frames
if
(
m_temporalSubsampleRatio
>
1
)
{
#if EXTENSION_360_VIDEO
m_cVideoIOYuvInputFile
.
skipFrames
(
m_temporalSubsampleRatio
-
1
,
m_inputFileWidth
,
m_inputFileHeight
,
m_InputChromaFormatIDC
);
m_cVideoIOYuvInputFile
.
skipFrames
(
m_temporalSubsampleRatio
-
1
,
m_inputFileWidth
,
m_inputFileHeight
,
m_InputChromaFormatIDC
);
#else
m_cVideoIOYuvInputFile
.
skipFrames
(
m_temporalSubsampleRatio
-
1
,
m_iSourceWidth
-
m_aiPad
[
0
],
m_iSourceHeight
-
m_aiPad
[
1
],
m_InputChromaFormatIDC
);
m_cVideoIOYuvInputFile
.
skipFrames
(
m_temporalSubsampleRatio
-
1
,
m_iSourceWidth
-
m_aiPad
[
0
],
m_iSourceHeight
-
m_aiPad
[
1
],
m_InputChromaFormatIDC
);
#endif
}
}
return
bEos
;
}
#else
/**
...
...
This diff is collapsed.
Click to expand it.
source/App/EncoderApp/EncApp.h
+
11
−
1
View file @
9b93350c
...
...
@@ -88,6 +88,16 @@ private:
void
printRateSummary
();
void
printChromaFormat
();
#if JVET_N0278_FIXES
std
::
list
<
PelUnitBuf
*>
m_recBufList
;
int
m_numEncoded
;
PelStorage
*
m_trueOrgPic
;
PelStorage
*
m_orgPic
;
#if EXTENSION_360_VIDEO
TExt360AppEncTop
*
m_ext360
;
#endif
#endif
public:
EncApp
();
virtual
~
EncApp
();
...
...
@@ -96,7 +106,7 @@ public:
int
getMaxLayers
()
const
{
return
m_maxLayers
;
}
void
createLib
();
///< main encoding function
void
destroyLib
();
///< main encoding function
void
encode
();
///< main encoding function
bool
encode
();
///< main encoding function
#else
void
encode
();
///< main encoding function
#endif
...
...
This diff is collapsed.
Click to expand it.
source/App/EncoderApp/encmain.cpp
+
22
−
15
View file @
9b93350c
...
...
@@ -185,26 +185,31 @@ int main(int argc, char* argv[])
// call encoding function
#if JVET_N0278_FIXES
for
(
auto
&
encApp
:
pcEncApp
)
bool
eos
=
false
;
while
(
!
eos
)
{
#ifndef _DEBUG
try
for
(
auto
&
encApp
:
pcEncApp
)
{
#ifndef _DEBUG
try
{
#endif
encApp
->
encode
();
eos
=
encApp
->
encode
();
#ifndef _DEBUG
}
catch
(
Exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
catch
(
const
std
::
bad_alloc
&
e
)
{
std
::
cout
<<
"Memory allocation failed: "
<<
e
.
what
()
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
}
catch
(
Exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
catch
(
const
std
::
bad_alloc
&
e
)
{
std
::
cout
<<
"Memory allocation failed: "
<<
e
.
what
()
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
#endif
}
}
#else
#ifndef _DEBUG
...
...
@@ -252,6 +257,8 @@ int main(int argc, char* argv[])
// destroy ROM
destroyROM
();
pcEncApp
.
clear
();
#else
// destroy application encoder class
pcEncApp
->
destroy
();
...
...
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