Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions doc/reST/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,7 @@ VUI fields must be manually specified.
.. option:: --nalu-file <filename>

Text file containing userSEI in POC order : <POC><space><PREFIX><space><NAL UNIT TYPE>/<SEI TYPE><space><SEI Payload>
Parse the input file specified and inserts SEI messages into the bitstream.
Parse the input file specified and inserts SEI messages into the bitstream.
Currently, we support only PREFIX SEI messages. This is an "application-only" feature.

.. option:: --atc-sei <integer>
Expand All @@ -2535,8 +2535,19 @@ VUI fields must be manually specified.
.. option:: --pic-struct <integer>

Set the picture structure and emits it in the picture timing SEI message.
Values in the range 0..12. See D.3.3 of the HEVC spec. for a detailed explanation.
Required for HLG (Hybrid Log Gamma) signaling. Not signaled by default.
Values in the range 0..12. See Table D.2 and D.3.3 of the HEVC spec. for a detailed explanation.

.. option:: --psfile <filename>

Specify a text file which contains the picture structure for some or all frames.
Allows for dynamic pulldown (VFR in CFR containers). The format of each line is

framenumber framefieldcoding picstruct

Framefieldcoding shall be 0, 1, 2 (progressive, bottom-first or top-first, resp.),
It shall not change for an encoded sequence and match the encoder configuration.

Picstruct is the picture structure to use in the framenumber's Picture Timing SEI.

.. option:: --video-signal-type-preset <string>

Expand Down
13 changes: 12 additions & 1 deletion source/abrEncApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ namespace X265_NS {
int analysisWrite = m_parent->m_analysisWriteCnt[analysisQId].get();
int written = analysisWrite * m_parent->m_passEnc[analysisQId]->m_cliopt.numRefs;
int analysisRead = m_parent->m_analysisReadCnt[analysisQId].get();

while (m_threadActive && written == analysisRead)
{
analysisWrite = m_parent->m_analysisWriteCnt[analysisQId].waitForChange(analysisWrite);
Expand Down Expand Up @@ -763,6 +763,17 @@ namespace X265_NS {
}
}

if (m_cliopt.psfile)
{
if (!m_cliopt.parsePSFile(pic_orig[view], m_param->interlaceMode, m_param->bField))
{
x265_log(NULL, X265_LOG_ERROR, "can't parse psfile for frame %d in %s\n",
pic_in[view]->poc, profileName);
fclose(m_cliopt.psfile);
m_cliopt.psfile = NULL;
}
}

if (m_cliopt.framesToBeEncoded && inFrameCount >= m_cliopt.framesToBeEncoded)
pic_in[view] = NULL;
else if (readPicture(pic_in[view], view)){
Expand Down
3 changes: 2 additions & 1 deletion source/abrEncApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Authors: Pooja Venkatesan <[email protected]>
* Aruna Matheswaran <[email protected]>
*
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -91,6 +91,7 @@ namespace X265_NS {
CLIOptions m_cliopt;
InputFile* m_input[MAX_VIEWS];
const char* m_reconPlayCmd;
FILE* m_psfile;
FILE* m_qpfile;
FILE* m_zoneFile;
FILE* m_dolbyVisionRpu;/* File containing Dolby Vision BL RPU metadata */
Expand Down
6 changes: 6 additions & 0 deletions source/common/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ Frame::Frame()
m_targetBitrate = 0;
m_targetCrf = 0;
m_targetQp = 0;

// HRD management
m_duration = 0;
m_cpbDelay = 0;
m_dpbOutputDelay = 0;
m_cpbDuration = 0;
}

bool Frame::create(x265_param *param, float* quantOffsets)
Expand Down
9 changes: 9 additions & 0 deletions source/common/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ class Frame
/* target QP for this picture.*/
int m_targetQp;

/*HRD delays for this frame*/
unsigned int m_duration; // display duration of picture in ticks (VUI timebase)
unsigned int m_cpbDuration; // lifetime in the CPB (VUI timebase)
unsigned int m_cpbDelay; // removal delay of the picture (VUI timebase)
unsigned int m_dpbOutputDelay; // output delay of the picture (VUI timebase)
uint64_t m_displayPicCount; // display picture count (counted in decoder ticks)
uint64_t m_codedPicCount; // coded picture count (counted in decoder ticks)
double m_timebase; // the timebase for this picture [seconds]

Frame();

bool create(x265_param *param, float* quantOffsets);
Expand Down
5 changes: 4 additions & 1 deletion source/common/lowres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ void Lowres::init(PicYuv* origPic, int poc, bool bEnableTemporalFilter)
filterThisGOP = false;
noiseScore = -1;
frameNum = poc;
cpbDurationSecs = 0.;
dispDurationSecs = 0.;
dispPicCount = durationPicCount = 0;
leadingBframes = 0;
indB = 0;
memset(costEst, -1, sizeof(costEst));
Expand Down Expand Up @@ -386,7 +389,7 @@ void Lowres::init(PicYuv* origPic, int poc, bool bEnableTemporalFilter)
extendPicBorder(lowresPlane[1], lumaStride, width, lines, origPic->m_lumaMarginX, origPic->m_lumaMarginY);
extendPicBorder(lowresPlane[2], lumaStride, width, lines, origPic->m_lumaMarginX, origPic->m_lumaMarginY);
extendPicBorder(lowresPlane[3], lumaStride, width, lines, origPic->m_lumaMarginX, origPic->m_lumaMarginY);

if (origPic->m_param->bEnableHME || origPic->m_param->bEnableTemporalFilter)
{
if (bEnableTemporalFilter)
Expand Down
7 changes: 7 additions & 0 deletions source/common/lowres.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ struct Lowres : public ReferencePlanes

double ipCostRatio;

/* Vbv Lookahead & cuTree durations */
double cpbDurationSecs;
double dispDurationSecs;
int64_t dispPicCount;
int64_t durationPicCount;

/* lookahead output data */
int64_t costEst[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
int64_t costEstAq[X265_BFRAME_MAX + 2][X265_BFRAME_MAX + 2];
Expand All @@ -207,6 +213,7 @@ struct Lowres : public ReferencePlanes
/* used for vbvLookahead */
int plannedType[X265_LOOKAHEAD_MAX + 1];
int64_t plannedSatd[X265_LOOKAHEAD_MAX + 1];
double plannedCpbDuration[X265_LOOKAHEAD_MAX + 1]; /* durations of frames ahead for VBV */
int indB;
int bframes;

Expand Down
2 changes: 1 addition & 1 deletion source/encoder/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ void x265_picture_init(x265_param *param, x265_picture *pic)
pic->userSEI.numPayloads = 0;
pic->rpu.payloadSize = 0;
pic->rpu.payload = NULL;
pic->picStruct = 0;
pic->picStruct = PIC_STRUCT_AUTO;
pic->vbvEndFlag = 0;

if ((strlen(param->analysisSave) || strlen(param->analysisLoad)) || (param->bAnalysisType == AVC_INFO))
Expand Down
Loading
Loading