Open totaam opened 10 months ago
With the ROI stub above, and add adding some debug logging to the x264 code:
if( h->fdec->mb_info && (h->fdec->mb_info[h->mb.i_mb_xy]&X264_MBINFO_CONSTANT) )
{
d = h->fdec->i_frame - h->fref[0][0]->i_frame;
qp = h->fref[0][0]->effective_qp[h->mb.i_mb_xy];
maxqp = h->mb.i_qp;
printf("xy=%d, d=%d, weighted_pred=%d, qp=%d - max=%d\n", h->mb.i_mb_xy, d, h->sh.b_weighted_pred, qp, maxqp);
if( !SLICE_MBAFF && d == 1 && !h->sh.b_weighted_pred && qp <= maxqp )
{
Not all odd macroblocks are being skipped as I would have expected - ie:
xy=3219, d=1, weighted_pred=0, qp=255 - max=19
Useful link for x264 defaults: https://github.com/cybertk/x264/blob/cf71aa426ac07a47b41f754b1d6b5d9e8fc39f5d/files/x264/common/common.c#L45
Findings:
mb
s is not enough, we have to ensure their contents really have not changed - failure to do so results in crashes! can we always guarantee that this is the case?mb
s: probably best to add a rectangle.intersects(*rects)
call and test for all mb
s? is this expensive? or add a rects_intersect(*mb_rects1, *rects2) -> list[int]
(list of mb indices)?
Make the
--encoding=stream
mode (#3872) more appropriate for xpra by specifying unchanged screen regions.ffmpeg
added support for this here: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/418c954e318a79f77eae1b4d6b29d40daee4284a Original x264 commit is here (from 2012!): https://mailman.videolan.org/pipermail/x264-devel/2012-April/009327.htmlSeems to involve:
b_fast_pskip = 1
: https://github.com/mirror/x264/blob/eaa68fad9e5d201d42fde51665f2d137ae96baf0/x264.h#L414mb_info
: https://github.com/mirror/x264/blob/eaa68fad9e5d201d42fde51665f2d137ae96baf0/x264.h#L819-L839When scaling server-side, the module will need to scale the ROI coordinates too.
Something similar should be possible with NVENC, unfortunately the documentation is seriously lacking.
libvpx: https://github.com/webmproject/libvpx/blob/main/examples/set_maps.c