Skip to content

vp9enc: Add basic SVCT support (part of GSOC 2018)#123

Open
ottingerg wants to merge 4 commits intointel:masterfrom
ottingerg:4merge
Open

vp9enc: Add basic SVCT support (part of GSOC 2018)#123
ottingerg wants to merge 4 commits intointel:masterfrom
ottingerg:4merge

Conversation

@ottingerg
Copy link
Copy Markdown
Contributor

The application was tested against following example videos:
taken from https://media.xiph.org/video/derf/ and converted to yuv420p with ffmpeg

akiyo_w352_h288_f300_fps30.yuv
crosswalk_w4096_h2160_f300_fps60.yuv
football_w720_h486_f360_fps30.yuv
stockholm_w1280_h720_f604_fps60.yuv
tractor_w1920_h1080_f690_fps25.yuv

CQP, CBR, VBR modes in combination with 1,2,3 temporal layers were tested.
Videos with 2 or 3 temporal layer were reduced to 1 and 2 temporal layers. (with vp8halfrate)

The scripts for running the test can be found here:
https://github.com/ottingerg/libva-utils/tree/master/encode/test

Encoded videos were manually visually checked. The encoded videos look OK.
Note: For some reason it was necessary to turn on the pic_param->pic_flags.bits.error_resilient_mode in order to get artefact-free videos

@ottingerg
Copy link
Copy Markdown
Contributor Author

one reason why the error_resilient_mode might be necessary is to remove dependencies between frames from probability updates I guess ..

the long_opts numbering was missing the case 5
The original vp9enc_update_reference_list() was basically supporting
only one Reference (Last Frame Reference) - it was only updating
vp9_ref_list[0] - and left the other references untouched.
Now vp9enc_update_reference_list() updates the references according to
the refresh_frame_flags flag.
vp9enc_get_free_slot() was replaced with a more simple and robust
version.

Both changes represent a prerequisit for the VP9 SVCT feature.
The Numerator and Denominator for the frame rate infomation in the ivf
header were interchanged (vp9enc_write_ivf_header()).
The timestamp in the ivf frame header (vp9enc_write_frame_header())
was added in order to produce IVFs that are decodeable by standard
mediaplayers like VLC or MPV.
Comment thread encode/vp9enc.c
vp9enc_write_dword(header + 16, 1);
vp9enc_write_dword(header + 20, frame_rate);
vp9enc_write_dword(header + 16, frame_rate);
vp9enc_write_dword(header + 20, 1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a bug fix perhaps it would better to handle it in a different patch, and the timestamp handling in another patch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that patches should be atomic - but I already had to rewrite the reference management in order to get SVCT working - and for testing purpose it was really handy to have video decodable by the media player ... thats why I included this patch here - if it is a problem I can also export this in a new PR

Comment thread encode/vp9enc.c
*(tmp + 6) = (value >> 48) & 0XFF;
*(tmp + 7) = (value >> 56) & 0XFF;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is test app, but perhaps it is a good idea to merge vp9enc_write_qword(), vp9enc_write_word() and vp9enc_write_dword() in a single function, with a loop and a defined halt condition as parameter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added vp9enc_write_qword(), I didn't want to touch the rest of the code using vp9enc_write_word() and vp9enc_write_dword()

Comment thread encode/vp9enc.c Outdated
static
void vp9enc_set_refreshparameter_for_svct_2layers(VAEncPictureParameterBufferVP9 *pic_param, int current_frame, int *is_golden_refreshed)
{
//Pattern taken from libyami
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though // is valid for comments in modern C, for sake of coherence, perhaps would be better to stick to the old /* */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this for my part of the code, but there are other occurrences of // as well in vp9enc.c

Comment thread encode/vp9enc.c
}

}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both functions are quite similar, perhaps their merge worth, with a parameter with the number of layers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats true - but for vp8enc I also used 2 functions (for 2 and 3 Layers), which is already merged. So I'd like to keep it this way for consistency reasons

This patch adds supports 2 or 3 temporal layers, which can be activated
by using the '--temp_svc X' command line.
Note that the alternate reference frame is not used - this design
decission was carried on from libyami - in order to allow single
Layer 2 frames to be dropped independently.

This work is part of a GSOC 2018 project, mentored by Intel Media And
Audio For Linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants