mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-07 11:13:41 +02:00
Merge commit '325aa63dd1a3abc2453914d0bc111d297833d725'
* commit '325aa63dd1a3abc2453914d0bc111d297833d725': qsv: enforcing continuous memory layout Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
commit
14fe81b3a8
@ -1012,7 +1012,6 @@ static void clear_unused_frames(QSVEncContext *q)
|
|||||||
while (cur) {
|
while (cur) {
|
||||||
if (cur->used && !cur->surface.Data.Locked) {
|
if (cur->used && !cur->surface.Data.Locked) {
|
||||||
free_encoder_ctrl_payloads(&cur->enc_ctrl);
|
free_encoder_ctrl_payloads(&cur->enc_ctrl);
|
||||||
av_frame_unref(cur->frame);
|
|
||||||
cur->used = 0;
|
cur->used = 0;
|
||||||
}
|
}
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
@ -1085,16 +1084,23 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* make a copy if the input is not padded as libmfx requires */
|
/* make a copy if the input is not padded as libmfx requires */
|
||||||
if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) {
|
/* and to make allocation continious for data[0]/data[1] */
|
||||||
|
if ((frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) ||
|
||||||
|
(frame->data[1] - frame->data[0] != frame->linesize[0] * FFALIGN(qf->frame->height, q->height_align))) {
|
||||||
qf->frame->height = FFALIGN(frame->height, q->height_align);
|
qf->frame->height = FFALIGN(frame->height, q->height_align);
|
||||||
qf->frame->width = FFALIGN(frame->width, q->width_align);
|
qf->frame->width = FFALIGN(frame->width, q->width_align);
|
||||||
|
|
||||||
ret = ff_get_buffer(q->avctx, qf->frame, AV_GET_BUFFER_FLAG_REF);
|
qf->frame->format = frame->format;
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
if (!qf->frame->data[0]) {
|
||||||
|
ret = av_frame_get_buffer(qf->frame, q->width_align);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
qf->frame->height = frame->height;
|
qf->frame->height = frame->height;
|
||||||
qf->frame->width = frame->width;
|
qf->frame->width = frame->width;
|
||||||
|
|
||||||
ret = av_frame_copy(qf->frame, frame);
|
ret = av_frame_copy(qf->frame, frame);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_frame_unref(qf->frame);
|
av_frame_unref(qf->frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user