You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Merge commit 'd6006dd9f0d4d01023359230212f1f9fa4800e5b'
* commit 'd6006dd9f0d4d01023359230212f1f9fa4800e5b': libvpxenc: Do not entangle coded_frame Conflicts: libavcodec/libvpxenc.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -692,31 +692,32 @@ static inline void cx_pktcpy(struct FrameListData *dst,
|
|||||||
* @return a negative AVERROR on error
|
* @return a negative AVERROR on error
|
||||||
*/
|
*/
|
||||||
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
||||||
AVPacket *pkt, AVFrame *coded_frame)
|
AVPacket *pkt)
|
||||||
{
|
{
|
||||||
int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz);
|
int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz);
|
||||||
uint8_t *side_data;
|
uint8_t *side_data;
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
memcpy(pkt->data, cx_frame->buf, pkt->size);
|
memcpy(pkt->data, cx_frame->buf, pkt->size);
|
||||||
pkt->pts = pkt->dts = cx_frame->pts;
|
pkt->pts = pkt->dts = cx_frame->pts;
|
||||||
coded_frame->pts = cx_frame->pts;
|
avctx->coded_frame->pts = cx_frame->pts;
|
||||||
coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY);
|
avctx->coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY);
|
||||||
|
|
||||||
if (coded_frame->key_frame) {
|
if (!!(cx_frame->flags & VPX_FRAME_IS_KEY)) {
|
||||||
coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
} else
|
} else {
|
||||||
coded_frame->pict_type = AV_PICTURE_TYPE_P;
|
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
|
||||||
|
}
|
||||||
|
|
||||||
if (cx_frame->have_sse) {
|
if (cx_frame->have_sse) {
|
||||||
int i;
|
int i;
|
||||||
/* Beware of the Y/U/V/all order! */
|
/* Beware of the Y/U/V/all order! */
|
||||||
coded_frame->error[0] = cx_frame->sse[1];
|
avctx->coded_frame->error[0] = cx_frame->sse[1];
|
||||||
coded_frame->error[1] = cx_frame->sse[2];
|
avctx->coded_frame->error[1] = cx_frame->sse[2];
|
||||||
coded_frame->error[2] = cx_frame->sse[3];
|
avctx->coded_frame->error[2] = cx_frame->sse[3];
|
||||||
coded_frame->error[3] = 0; // alpha
|
avctx->coded_frame->error[3] = 0; // alpha
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
avctx->error[i] += coded_frame->error[i];
|
avctx->error[i] += avctx->coded_frame->error[i];
|
||||||
}
|
}
|
||||||
cx_frame->have_sse = 0;
|
cx_frame->have_sse = 0;
|
||||||
}
|
}
|
||||||
@@ -746,8 +747,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
|
|||||||
* @return AVERROR(EINVAL) on output size error
|
* @return AVERROR(EINVAL) on output size error
|
||||||
* @return AVERROR(ENOMEM) on coded frame queue data allocation error
|
* @return AVERROR(ENOMEM) on coded frame queue data allocation error
|
||||||
*/
|
*/
|
||||||
static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out,
|
static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out)
|
||||||
AVFrame *coded_frame)
|
|
||||||
{
|
{
|
||||||
VP8Context *ctx = avctx->priv_data;
|
VP8Context *ctx = avctx->priv_data;
|
||||||
const struct vpx_codec_cx_pkt *pkt;
|
const struct vpx_codec_cx_pkt *pkt;
|
||||||
@@ -759,7 +759,7 @@ static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out,
|
|||||||
if (ctx->coded_frame_list) {
|
if (ctx->coded_frame_list) {
|
||||||
struct FrameListData *cx_frame = ctx->coded_frame_list;
|
struct FrameListData *cx_frame = ctx->coded_frame_list;
|
||||||
/* return the leading frame if we've already begun queueing */
|
/* return the leading frame if we've already begun queueing */
|
||||||
size = storeframe(avctx, cx_frame, pkt_out, coded_frame);
|
size = storeframe(avctx, cx_frame, pkt_out);
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return size;
|
return size;
|
||||||
ctx->coded_frame_list = cx_frame->next;
|
ctx->coded_frame_list = cx_frame->next;
|
||||||
@@ -780,7 +780,7 @@ static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out,
|
|||||||
provided a frame for output */
|
provided a frame for output */
|
||||||
av_assert0(!ctx->coded_frame_list);
|
av_assert0(!ctx->coded_frame_list);
|
||||||
cx_pktcpy(&cx_frame, pkt, pkt_alpha, ctx);
|
cx_pktcpy(&cx_frame, pkt, pkt_alpha, ctx);
|
||||||
size = storeframe(avctx, &cx_frame, pkt_out, coded_frame);
|
size = storeframe(avctx, &cx_frame, pkt_out);
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return size;
|
return size;
|
||||||
} else {
|
} else {
|
||||||
@@ -907,7 +907,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
coded_size = queue_frames(avctx, pkt, avctx->coded_frame);
|
coded_size = queue_frames(avctx, pkt);
|
||||||
|
|
||||||
if (!frame && avctx->flags & CODEC_FLAG_PASS1) {
|
if (!frame && avctx->flags & CODEC_FLAG_PASS1) {
|
||||||
unsigned int b64_size = AV_BASE64_SIZE(ctx->twopass_stats.sz);
|
unsigned int b64_size = AV_BASE64_SIZE(ctx->twopass_stats.sz);
|
||||||
|
Reference in New Issue
Block a user