vp9enc: Add basic SVCT support (part of GSOC 2018)#123
vp9enc: Add basic SVCT support (part of GSOC 2018)#123ottingerg wants to merge 4 commits intointel:masterfrom
Conversation
|
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.
| 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); |
There was a problem hiding this comment.
As this is a bug fix perhaps it would better to handle it in a different patch, and the timestamp handling in another patch
There was a problem hiding this comment.
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
| *(tmp + 6) = (value >> 48) & 0XFF; | ||
| *(tmp + 7) = (value >> 56) & 0XFF; | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()
| static | ||
| void vp9enc_set_refreshparameter_for_svct_2layers(VAEncPictureParameterBufferVP9 *pic_param, int current_frame, int *is_golden_refreshed) | ||
| { | ||
| //Pattern taken from libyami |
There was a problem hiding this comment.
Though // is valid for comments in modern C, for sake of coherence, perhaps would be better to stick to the old /* */
There was a problem hiding this comment.
I fixed this for my part of the code, but there are other occurrences of // as well in vp9enc.c
| } | ||
|
|
||
| } | ||
|
|
There was a problem hiding this comment.
Both functions are quite similar, perhaps their merge worth, with a parameter with the number of layers
There was a problem hiding this comment.
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.
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