avcodec: use the new AVFrame key_frame flag in all decoders and encoders

Signed-off-by: James Almer <jamrial@gmail.com>
pull/389/head
James Almer 2 years ago
parent cc11191fda
commit dc7bd7c5a5
  1. 2
      libavcodec/012v.c
  2. 5
      libavcodec/4xm.c
  3. 7
      libavcodec/agm.c
  4. 2
      libavcodec/aic.c
  5. 2
      libavcodec/aliaspixdec.c
  6. 5
      libavcodec/arbc.c
  7. 5
      libavcodec/argo.c
  8. 2
      libavcodec/asvdec.c
  9. 5
      libavcodec/av1dec.c
  10. 2
      libavcodec/avrndec.c
  11. 4
      libavcodec/avs.c
  12. 2
      libavcodec/avuidec.c
  13. 4
      libavcodec/bfi.c
  14. 2
      libavcodec/bitpacked_dec.c
  15. 2
      libavcodec/bmp.c
  16. 2
      libavcodec/brenderpix.c
  17. 4
      libavcodec/c93.c
  18. 2
      libavcodec/cdxl.c
  19. 4
      libavcodec/cinepak.c
  20. 4
      libavcodec/clearvideo.c
  21. 2
      libavcodec/cljrdec.c
  22. 2
      libavcodec/cllc.c
  23. 4
      libavcodec/cpia.c
  24. 2
      libavcodec/cri.c
  25. 4
      libavcodec/cscd.c
  26. 5
      libavcodec/cuviddec.c
  27. 2
      libavcodec/dds.c
  28. 3
      libavcodec/decode.c
  29. 5
      libavcodec/diracdec.c
  30. 2
      libavcodec/dnxhddec.c
  31. 2
      libavcodec/dvdec.c
  32. 10
      libavcodec/dxa.c
  33. 2
      libavcodec/dxtory.c
  34. 2
      libavcodec/dxv.c
  35. 4
      libavcodec/eacmv.c
  36. 2
      libavcodec/eatgq.c
  37. 4
      libavcodec/eatgv.c
  38. 2
      libavcodec/encode.c
  39. 14
      libavcodec/ffv1dec.c
  40. 4
      libavcodec/fic.c
  41. 2
      libavcodec/fitsdec.c
  42. 4
      libavcodec/fmvc.c
  43. 2
      libavcodec/fraps.c
  44. 2
      libavcodec/frwu.c
  45. 5
      libavcodec/g2meet.c
  46. 2
      libavcodec/gemdec.c
  47. 4
      libavcodec/gifdec.c
  48. 5
      libavcodec/h261dec.c
  49. 10
      libavcodec/h264_slice.c
  50. 4
      libavcodec/h264dec.c
  51. 2
      libavcodec/hapdec.c
  52. 2
      libavcodec/hdrdec.c
  53. 5
      libavcodec/hevcdec.c
  54. 4
      libavcodec/hnm4video.c
  55. 2
      libavcodec/hq_hqa.c
  56. 2
      libavcodec/hqx.c
  57. 4
      libavcodec/iff.c
  58. 10
      libavcodec/imm4.c
  59. 10
      libavcodec/imx.c
  60. 2
      libavcodec/jpeg2000dec.c
  61. 2
      libavcodec/jvdec.c
  62. 4
      libavcodec/kmvc.c
  63. 2
      libavcodec/lagarith.c
  64. 2
      libavcodec/lcldec.c
  65. 5
      libavcodec/libaomdec.c
  66. 5
      libavcodec/libdav1d.c
  67. 2
      libavcodec/libjxldec.c
  68. 2
      libavcodec/librsvgdec.c
  69. 5
      libavcodec/libuavs3d.c
  70. 2
      libavcodec/loco.c
  71. 13
      libavcodec/lscrdec.c
  72. 2
      libavcodec/m101.c
  73. 2
      libavcodec/magicyuv.c
  74. 2
      libavcodec/mdec.c
  75. 5
      libavcodec/midivid.c
  76. 4
      libavcodec/mjpegdec.c
  77. 4
      libavcodec/mobiclip.c
  78. 12
      libavcodec/mpeg12dec.c
  79. 2
      libavcodec/mpeg12enc.c
  80. 9
      libavcodec/mpegvideo_dec.c
  81. 18
      libavcodec/mpegvideo_enc.c
  82. 2
      libavcodec/mscc.c
  83. 2
      libavcodec/msp2dec.c
  84. 4
      libavcodec/mss1.c
  85. 5
      libavcodec/mss2.c
  86. 5
      libavcodec/mss3.c
  87. 5
      libavcodec/mss4.c
  88. 6
      libavcodec/mv30.c
  89. 2
      libavcodec/mvcdec.c
  90. 2
      libavcodec/mvha.c
  91. 9
      libavcodec/mwsc.c
  92. 4
      libavcodec/mxpegdec.c
  93. 2
      libavcodec/notchlc.c
  94. 5
      libavcodec/nuv.c
  95. 4
      libavcodec/pafvideo.c
  96. 2
      libavcodec/pdvdec.c
  97. 2
      libavcodec/pgxdec.c
  98. 2
      libavcodec/photocd.c
  99. 2
      libavcodec/pixlet.c
  100. 2
      libavcodec/pngdec.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -65,7 +65,7 @@ static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic,
return ret;
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
pic->flags |= AV_FRAME_FLAG_KEY;
line_end = avpkt->data + stride;
for (line = 0; line < avctx->height; line++) {

@ -957,7 +957,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
return AVERROR_INVALIDDATA;
}
picture->key_frame = picture->pict_type == AV_PICTURE_TYPE_I;
if (picture->pict_type == AV_PICTURE_TYPE_I)
picture->flags |= AV_FRAME_FLAG_KEY;
else
picture->flags &= ~AV_FRAME_FLAG_KEY;
av_image_copy_plane(picture->data[0], picture->linesize[0],
(const uint8_t*)f->frame_buffer, avctx->width * 2,

@ -1100,7 +1100,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
s->key_frame = (avpkt->flags & AV_PKT_FLAG_KEY);
frame->key_frame = s->key_frame;
if (s->key_frame)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = s->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if (!s->key_frame) {
@ -1171,7 +1174,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
if (frame->key_frame) {
if (frame->flags & AV_FRAME_FLAG_KEY) {
if (!s->dct && !s->rgb)
ret = decode_raw_intra(avctx, gbyte, frame);
else if (!s->dct && s->rgb)

@ -393,7 +393,7 @@ static int aic_decode_frame(AVCodecContext *avctx, AVFrame *frame,
ctx->frame = frame;
ctx->frame->pict_type = AV_PICTURE_TYPE_I;
ctx->frame->key_frame = 1;
ctx->frame->flags |= AV_FRAME_FLAG_KEY;
off = FFALIGN(AIC_HDR_SIZE + ctx->num_x_slices * ctx->mb_height * 2, 4);

@ -70,7 +70,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
return ret;
f->pict_type = AV_PICTURE_TYPE_I;
f->key_frame = 1;
f->flags |= AV_FRAME_FLAG_KEY;
x = 0;
y = 1;

@ -171,7 +171,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
frame->pict_type = prev_pixels <= 0 ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
frame->key_frame = prev_pixels <= 0;
if (prev_pixels <= 0)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -666,7 +666,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
frame->pict_type = s->key ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
frame->key_frame = s->key;
if (s->key)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -245,7 +245,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
if (avctx->codec_id == AV_CODEC_ID_ASV1) {
av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size,

@ -846,7 +846,10 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
goto fail;
frame = f->f;
frame->key_frame = header->frame_type == AV1_FRAME_KEY;
if (header->frame_type == AV1_FRAME_KEY)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
switch (header->frame_type) {
case AV1_FRAME_KEY:

@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
p->flags |= AV_FRAME_FLAG_KEY;
if(a->interlace) {
buf += (true_height - avctx->height)*avctx->width;

@ -61,7 +61,7 @@ static int avs_decode_frame(AVCodecContext * avctx, AVFrame *picture,
if ((ret = ff_reget_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_P;
p->key_frame = 0;
p->flags &= ~AV_FRAME_FLAG_KEY;
out = p->data[0];
stride = p->linesize[0];
@ -97,7 +97,7 @@ static int avs_decode_frame(AVCodecContext * avctx, AVFrame *picture,
switch (sub_type) {
case AVS_I_FRAME:
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
case AVS_P_FRAME_3X3:
vect_w = 3;
vect_h = 3;

@ -71,7 +71,7 @@ static int avui_decode_frame(AVCodecContext *avctx, AVFrame *pic,
if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
return ret;
pic->key_frame = 1;
pic->flags |= AV_FRAME_FLAG_KEY;
pic->pict_type = AV_PICTURE_TYPE_I;
if (!interlaced) {

@ -68,7 +68,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
/* Set frame parameters and palette, if necessary */
if (!avctx->frame_num) {
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
/* Setting the palette */
if (avctx->extradata_size > 768) {
av_log(avctx, AV_LOG_ERROR, "Palette is too large.\n");
@ -87,7 +87,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame,
frame->palette_has_changed = 1;
} else {
frame->pict_type = AV_PICTURE_TYPE_P;
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->palette_has_changed = 0;
memcpy(frame->data[1], bfi->pal, sizeof(bfi->pal));
}

@ -134,7 +134,7 @@ static int bitpacked_decode(AVCodecContext *avctx, AVFrame *frame,
return res;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return buf_size;

@ -210,7 +210,7 @@ static int bmp_decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
buf = buf0 + hsize;
dsize = buf_size - hsize;

@ -278,7 +278,7 @@ static int pix_decode_frame(AVCodecContext *avctx, AVFrame *frame,
bytes_per_scanline, hdr.height);
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -147,10 +147,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
b = bytestream2_get_byte(&gb);
if (b & C93_FIRST_FRAME) {
newpic->pict_type = AV_PICTURE_TYPE_I;
newpic->key_frame = 1;
newpic->flags |= AV_FRAME_FLAG_KEY;
} else {
newpic->pict_type = AV_PICTURE_TYPE_P;
newpic->key_frame = 0;
newpic->flags &= ~AV_FRAME_FLAG_KEY;
}
for (y = 0; y < HEIGHT; y += 8) {

@ -305,7 +305,7 @@ static int cdxl_decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
if (encoding) {
av_fast_padded_malloc(&c->new_video, &c->new_video_size,

@ -379,7 +379,7 @@ static int cinepak_decode (CinepakContext *s)
num_strips = FFMIN(num_strips, MAX_STRIPS);
s->frame->key_frame = 0;
s->frame->flags &= ~AV_FRAME_FLAG_KEY;
for (i=0; i < num_strips; i++) {
if ((s->data + 12) > eod)
@ -395,7 +395,7 @@ static int cinepak_decode (CinepakContext *s)
s->strips[i].x2 = AV_RB16 (&s->data[10]);
if (s->strips[i].id == 0x10)
s->frame->key_frame = 1;
s->frame->flags |= AV_FRAME_FLAG_KEY;
strip_size = AV_RB24 (&s->data[1]) - 12;
if (strip_size < 0)

@ -511,7 +511,7 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = 1;
c->pic->flags |= AV_FRAME_FLAG_KEY;
c->pic->pict_type = AV_PICTURE_TYPE_I;
bytestream2_get_be32(&gb); // frame size;
@ -605,7 +605,7 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
extend_edges(c->pic, c->tile_size);
c->pic->key_frame = 0;
c->pic->flags &= ~AV_FRAME_FLAG_KEY;
c->pic->pict_type = AV_PICTURE_TYPE_P;
}

@ -51,7 +51,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
init_get_bits(&gb, buf, buf_size * 8);

@ -460,7 +460,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic,
return AVERROR_INVALIDDATA;
}
pic->key_frame = 1;
pic->flags |= AV_FRAME_FLAG_KEY;
pic->pict_type = AV_PICTURE_TYPE_I;
*got_picture_ptr = 1;

@ -94,10 +94,10 @@ static int cpia_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (header[28] == NOT_COMPRESSED) {
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
} else {
frame->pict_type = AV_PICTURE_TYPE_P;
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
}
// Get buffer filled with previous frame

@ -408,7 +408,7 @@ skip:
}
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;

@ -110,12 +110,12 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
// flip upside down, add difference frame
if (buf[0] & 1) { // keyframe
c->pic->pict_type = AV_PICTURE_TYPE_I;
c->pic->key_frame = 1;
c->pic->flags |= AV_FRAME_FLAG_KEY;
copy_frame_default(c->pic, c->decomp_buf,
c->linelen, c->height);
} else {
c->pic->pict_type = AV_PICTURE_TYPE_P;
c->pic->key_frame = 0;
c->pic->flags &= ~AV_FRAME_FLAG_KEY;
add_frame_default(c->pic, c->decomp_buf,
c->linelen, c->height);
}

@ -599,7 +599,10 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
goto error;
}
frame->key_frame = ctx->key_frame[parsed_frame.dispinfo.picture_index];
if (ctx->key_frame[parsed_frame.dispinfo.picture_index])
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
ctx->key_frame[parsed_frame.dispinfo.picture_index] = 0;
frame->width = avctx->width;

@ -702,7 +702,7 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame,
/* Frame is ready to be output. */
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -570,6 +570,9 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
}
if (!ret) {
if (avctx->codec_type != AVMEDIA_TYPE_VIDEO)
frame->flags |= AV_FRAME_FLAG_KEY;
frame->key_frame = !!(frame->flags & AV_FRAME_FLAG_KEY);
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
frame->interlaced_frame = !!(frame->flags & AV_FRAME_FLAG_INTERLACED);

@ -2230,7 +2230,10 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int
s->hq_picture = (parse_code & 0xF8) == 0xE8; /* [DIRAC_STD] is_hq_picture() */
s->dc_prediction = (parse_code & 0x28) == 0x08; /* [DIRAC_STD] using_dc_prediction() */
pic->reference = (parse_code & 0x0C) == 0x0C; /* [DIRAC_STD] is_reference() */
pic->avframe->key_frame = s->num_refs == 0; /* [DIRAC_STD] is_intra() */
if (s->num_refs == 0) /* [DIRAC_STD] is_intra() */
pic->avframe->flags |= AV_FRAME_FLAG_KEY;
else
pic->avframe->flags &= ~AV_FRAME_FLAG_KEY;
pic->avframe->pict_type = s->num_refs + 1; /* Definition of AVPictureType in avutil.h */
/* VC-2 Low Delay has a different parse code than the Dirac Low Delay */

@ -653,7 +653,7 @@ decode_coding_unit:
if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0)
return ret;
picture->pict_type = AV_PICTURE_TYPE_I;
picture->key_frame = 1;
picture->flags |= AV_FRAME_FLAG_KEY;
}
ctx->buf_size = buf_size - ctx->data_offset;

@ -646,7 +646,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
s->frame = frame;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
avctx->pix_fmt = s->sys->pix_fmt;
avctx->framerate = av_inv_q(s->sys->time_base);

@ -258,19 +258,19 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
switch(compr){
case -1:
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
if (c->prev->data[0])
memcpy(frame->data[0], c->prev->data[0], frame->linesize[0] * avctx->height);
else{ // Should happen only when first frame is 'NULL'
memset(frame->data[0], 0, frame->linesize[0] * avctx->height);
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
}
break;
case 2:
case 4:
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
for (j = 0; j < avctx->height; j++) {
memcpy(outptr, srcptr, avctx->width);
@ -285,7 +285,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (!(avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL))
return AVERROR_INVALIDDATA;
}
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
for (j = 0; j < avctx->height; j++) {
if(tmpptr){
@ -300,7 +300,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
break;
case 12: // ScummVM coding
case 13:
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
if (!c->prev->data[0]) {
av_log(avctx, AV_LOG_ERROR, "Missing reference frame\n");

@ -864,7 +864,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
return ret;
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
pic->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -1220,7 +1220,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame,
/* Frame is ready to be output. */
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -202,10 +202,10 @@ static int cmv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
buf += EA_PREAMBLE_SIZE;
if ((buf[0]&1)) { // subtype
cmv_decode_inter(s, frame, buf+2, buf_end);
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
}else{
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
cmv_decode_intra(s, frame, buf+2, buf_end);
}

@ -237,7 +237,7 @@ static int tgq_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
for (y = 0; y < FFALIGN(avctx->height, 16) >> 4; y++)

@ -310,7 +310,7 @@ static int tgv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (chunk_type == kVGT_TAG) {
int y;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
if (!s->frame_buffer &&
@ -330,7 +330,7 @@ static int tgv_decode_frame(AVCodecContext *avctx, AVFrame *frame,
av_log(avctx, AV_LOG_WARNING, "inter frame without corresponding intra frame\n");
return buf_size;
}
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
if (tgv_decode_inter(s, frame, buf, buf_end) < 0) {
av_log(avctx, AV_LOG_WARNING, "truncated inter frame\n");

@ -192,6 +192,8 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
av_frame_move_ref(frame, avci->buffer_frame);
if (frame->key_frame)
frame->flags |= AV_FRAME_FLAG_KEY;
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
if (frame->interlaced_frame)

@ -264,16 +264,16 @@ static int decode_slice(AVCodecContext *c, void *arg)
for( si=0; fs != f->slice_context[si]; si ++)
;
if(f->fsrc && !p->key_frame)
if(f->fsrc && !(p->flags & AV_FRAME_FLAG_KEY))
ff_thread_await_progress(&f->last_picture, si, 0);
if(f->fsrc && !p->key_frame) {
if(f->fsrc && !(p->flags & AV_FRAME_FLAG_KEY)) {
FFV1Context *fssrc = f->fsrc->slice_context[si];
FFV1Context *fsdst = f->slice_context[si];
av_assert1(fsdst->plane_count == fssrc->plane_count);
av_assert1(fsdst == fs);
if (!p->key_frame)
if (!(p->flags & AV_FRAME_FLAG_KEY))
fsdst->slice_damaged |= fssrc->slice_damaged;
for (i = 0; i < f->plane_count; i++) {
@ -310,7 +310,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
}
if ((ret = ff_ffv1_init_slice_state(f, fs)) < 0)
return ret;
if (f->cur->key_frame || fs->slice_reset_contexts) {
if ((f->cur->flags & AV_FRAME_FLAG_KEY) || fs->slice_reset_contexts) {
ff_ffv1_clear_slice_state(f, fs);
} else if (fs->slice_damaged) {
return AVERROR_INVALIDDATA;
@ -892,7 +892,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
p->pict_type = AV_PICTURE_TYPE_I; //FIXME I vs. P
if (get_rac(c, &keystate)) {
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
f->key_frame_ok = 0;
if ((ret = read_header(f)) < 0)
return ret;
@ -903,7 +903,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
"Cannot decode non-keyframe without valid keyframe\n");
return AVERROR_INVALIDDATA;
}
p->key_frame = 0;
p->flags &= ~AV_FRAME_FLAG_KEY;
}
if (f->ac != AC_GOLOMB_RICE) {
@ -927,7 +927,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_DEBUG, "ver:%d keyframe:%d coder:%d ec:%d slices:%d bps:%d\n",
f->version, p->key_frame, f->ac, f->ec, f->slice_count, f->avctx->bits_per_raw_sample);
f->version, !!(p->flags & AV_FRAME_FLAG_KEY), f->ac, f->ec, f->slice_count, f->avctx->bits_per_raw_sample);
ff_thread_finish_setup(avctx);

@ -406,11 +406,11 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
return ret;
ctx->frame->key_frame = 1;
ctx->frame->flags |= AV_FRAME_FLAG_KEY;
ctx->frame->pict_type = AV_PICTURE_TYPE_I;
for (slice = 0; slice < nslices; slice++) {
if (ctx->slice_data[slice].p_frame) {
ctx->frame->key_frame = 0;
ctx->frame->flags &= ~AV_FRAME_FLAG_KEY;
ctx->frame->pict_type = AV_PICTURE_TYPE_P;
break;
}

@ -301,7 +301,7 @@ static int fits_decode_frame(AVCodecContext *avctx, AVFrame *p,
}
}
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
p->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;

@ -433,7 +433,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
src = s->buffer;
@ -519,7 +519,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
ssrc = s->buffer;

@ -216,7 +216,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f,
}
f->pict_type = AV_PICTURE_TYPE_I;
f->key_frame = 1;
f->flags |= AV_FRAME_FLAG_KEY;
avctx->pix_fmt = version & 1 ? is_pal ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P;
avctx->color_range = version & 1 ? AVCOL_RANGE_UNSPECIFIED

@ -63,7 +63,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic,
return ret;
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
pic->flags |= AV_FRAME_FLAG_KEY;
for (field = 0; field < 2; field++) {
int i;

@ -1560,7 +1560,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, AVFrame *pic,
if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
return ret;
pic->key_frame = got_header;
if (got_header)
pic->flags |= AV_FRAME_FLAG_KEY;
else
pic->flags &= ~AV_FRAME_FLAG_KEY;
pic->pict_type = got_header ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
for (i = 0; i < avctx->height; i++)

@ -180,7 +180,7 @@ static int gem_decode_frame(AVCodecContext *avctx, AVFrame *p,
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
p->palette_has_changed = 1;
palette = (uint32_t *)p->data[1];

@ -501,7 +501,7 @@ static int gif_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return AVERROR(ENOMEM);
s->frame->pict_type = AV_PICTURE_TYPE_I;
s->frame->key_frame = 1;
s->frame->flags |= AV_FRAME_FLAG_KEY;
s->keyframe_ok = 1;
} else {
if (!s->keyframe_ok) {
@ -513,7 +513,7 @@ static int gif_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
s->frame->pict_type = AV_PICTURE_TYPE_P;
s->frame->key_frame = 0;
s->frame->flags &= ~AV_FRAME_FLAG_KEY;
}
ret = gif_parse_next_image(s, s->frame);

@ -643,7 +643,10 @@ retry:
// for skipping the frame
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if (s->pict_type == AV_PICTURE_TYPE_I)
s->current_picture.f->flags |= AV_FRAME_FLAG_KEY;
else
s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY;
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) ||

@ -501,7 +501,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
* in later.
* See decode_nal_units().
*/
pic->f->key_frame = 0;
pic->f->flags &= ~AV_FRAME_FLAG_KEY;
pic->mmco_reset = 0;
pic->recovered = 0;
pic->invalid_gap = 0;
@ -1326,7 +1326,7 @@ static int h264_select_output_frame(H264Context *h)
out = h->delayed_pic[0];
out_idx = 0;
for (i = 1; h->delayed_pic[i] &&
!h->delayed_pic[i]->f->key_frame &&
!(h->delayed_pic[i]->f->flags & AV_FRAME_FLAG_KEY) &&
!h->delayed_pic[i]->mmco_reset;
i++)
if (h->delayed_pic[i]->poc < out->poc) {
@ -1334,7 +1334,7 @@ static int h264_select_output_frame(H264Context *h)
out_idx = i;
}
if (h->avctx->has_b_frames == 0 &&
(h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset))
((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) || h->delayed_pic[0]->mmco_reset))
h->next_outputed_poc = INT_MIN;
out_of_order = out->poc < h->next_outputed_poc;
@ -1345,7 +1345,7 @@ static int h264_select_output_frame(H264Context *h)
}
if (!out_of_order && pics > h->avctx->has_b_frames) {
h->next_output_pic = out;
if (out_idx == 0 && h->delayed_pic[0] && (h->delayed_pic[0]->f->key_frame || h->delayed_pic[0]->mmco_reset)) {
if (out_idx == 0 && h->delayed_pic[0] && ((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) || h->delayed_pic[0]->mmco_reset)) {
h->next_outputed_poc = INT_MIN;
} else
h->next_outputed_poc = out->poc;
@ -1635,7 +1635,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
}
}
h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE);
h->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_KEY * !!(nal->type == H264_NAL_IDR_SLICE);
if (nal->type == H264_NAL_IDR_SLICE ||
(h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {

@ -849,7 +849,7 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
av_dict_set(&dst->metadata, "stereo_mode", ff_h264_sei_stereo_mode(&h->sei.common.frame_packing), 0);
if (srcp->sei_recovery_frame_cnt == 0)
dst->key_frame = 1;
dst->flags |= AV_FRAME_FLAG_KEY;
if (h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS) {
ret = h264_export_enc_params(dst, srcp);
@ -951,7 +951,7 @@ static int send_next_delayed_frame(H264Context *h, AVFrame *dst_frame,
out_idx = 0;
for (i = 1;
h->delayed_pic[i] &&
!h->delayed_pic[i]->f->key_frame &&
!(h->delayed_pic[i]->f->flags & AV_FRAME_FLAG_KEY) &&
!h->delayed_pic[i]->mmco_reset;
i++)
if (h->delayed_pic[i]->poc < out->poc) {

@ -328,7 +328,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame,
/* Frame is ready to be output */
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -212,7 +212,7 @@ convert:
}
}
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
p->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;

@ -2910,7 +2910,10 @@ static int hevc_frame_start(HEVCContext *s)
goto fail;
}
s->ref->frame->key_frame = IS_IRAP(s);
if (IS_IRAP(s))
s->ref->frame->flags |= AV_FRAME_FLAG_KEY;
else
s->ref->frame->flags &= ~AV_FRAME_FLAG_KEY;
s->ref->needs_fg = s->sei.common.film_grain_characteristics.present &&
!(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&

@ -420,7 +420,7 @@ static int hnm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
postprocess_current_frame(avctx);
copy_processed_frame(avctx, frame);
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
memcpy(frame->data[1], hnm->palette, 256 * 4);
*got_frame = 1;
} else if (chunk_id == HNM4_CHUNK_ID_IU) {
@ -438,7 +438,7 @@ static int hnm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
copy_processed_frame(avctx, frame);
frame->pict_type = AV_PICTURE_TYPE_P;
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
memcpy(frame->data[1], hnm->palette, 256 * 4);
*got_frame = 1;
FFSWAP(uint8_t *, hnm->current, hnm->previous);

@ -354,7 +354,7 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic,
return ret;
}
pic->key_frame = 1;
pic->flags |= AV_FRAME_FLAG_KEY;
pic->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;

@ -504,7 +504,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, AVFrame *frame,
avctx->execute2(avctx, decode_slice_thread, NULL, NULL, 16);
ctx->pic->key_frame = 1;
ctx->pic->flags |= AV_FRAME_FLAG_KEY;
ctx->pic->pict_type = AV_PICTURE_TYPE_I;
*got_picture_ptr = 1;

@ -1887,10 +1887,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
if (avpkt->flags & AV_PKT_FLAG_KEY) {
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
} else {
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
}

@ -420,11 +420,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
switch (type) {
case 0x19781977:
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
break;
case 0x12250926:
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
break;
default:
@ -434,7 +434,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (avctx->width != width ||
avctx->height != height) {
if (!frame->key_frame) {
if (!(frame->flags & AV_FRAME_FLAG_KEY)) {
av_log(avctx, AV_LOG_ERROR, "Frame size change is unsupported.\n");
return AVERROR_INVALIDDATA;
}
@ -445,10 +445,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (ret < 0)
return ret;
if ((ret = ff_get_buffer(avctx, frame, frame->key_frame ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
if ((ret = ff_get_buffer(avctx, frame, (frame->flags & AV_FRAME_FLAG_KEY) ? AV_GET_BUFFER_FLAG_REF : 0)) < 0)
return ret;
if (frame->key_frame) {
if (frame->flags & AV_FRAME_FLAG_KEY) {
ret = decode_intra(avctx, gb, frame);
if (ret < 0)
return ret;

@ -59,9 +59,9 @@ static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if (ff_copy_palette(imx->pal, avpkt, avctx)) {
frame->palette_has_changed = 1;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
} else {
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->palette_has_changed = 0;
}
@ -92,7 +92,7 @@ static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
break;
}
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
break;
case 1:
if (len == 0) {
@ -114,7 +114,7 @@ static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
break;
}
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
} else {
while (len > 0) {
fill = bytestream2_get_byte(&gb);
@ -150,7 +150,7 @@ static int imx_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
}
frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
frame->pict_type = (frame->flags & AV_FRAME_FLAG_KEY) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if ((ret = av_frame_ref(rframe, frame)) < 0)
return ret;

@ -2482,7 +2482,7 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0)
goto end;
picture->pict_type = AV_PICTURE_TYPE_I;
picture->key_frame = 1;
picture->flags |= AV_FRAME_FLAG_KEY;
if (ret = jpeg2000_read_bitstream_packets(s))
goto end;

@ -211,7 +211,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
}
if (video_size) {
s->frame->key_frame = 1;
s->frame->flags |= AV_FRAME_FLAG_KEY;
s->frame->pict_type = AV_PICTURE_TYPE_I;
s->frame->palette_has_changed = s->palette_has_changed;
s->palette_has_changed = 0;

@ -288,10 +288,10 @@ static int decode_frame(AVCodecContext * avctx, AVFrame *frame,
}
if (header & KMVC_KEYFRAME) {
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
} else {
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_P;
}

@ -550,7 +550,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p,
int i, j, planes = 3;
int ret = 0;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
p->pict_type = AV_PICTURE_TYPE_I;
frametype = buf[0];

@ -478,7 +478,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;

@ -185,7 +185,10 @@ static int aom_decode(AVCodecContext *avctx, AVFrame *picture,
aom_codec_frame_flags_t flags;
ret = aom_codec_control(&ctx->decoder, AOMD_GET_FRAME_FLAGS, &flags);
if (ret == AOM_CODEC_OK) {
picture->key_frame = !!(flags & AOM_FRAME_IS_KEY);
if (flags & AOM_FRAME_IS_KEY)
picture->flags |= AV_FRAME_FLAG_KEY;
else
picture->flags &= ~AV_FRAME_FLAG_KEY;
if (flags & (AOM_FRAME_IS_KEY | AOM_FRAME_IS_INTRAONLY))
picture->pict_type = AV_PICTURE_TYPE_I;
else if (flags & AOM_FRAME_IS_SWITCH)

@ -463,7 +463,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
goto fail;
frame->pkt_dts = pkt->pts;
frame->key_frame = p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY;
if (p->frame_hdr->frame_type == DAV1D_FRAME_TYPE_KEY)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
switch (p->frame_hdr->frame_type) {
case DAV1D_FRAME_TYPE_KEY:

@ -411,7 +411,7 @@ static int libjxl_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_f
/* full image is one frame, even if animated */
av_log(avctx, AV_LOG_DEBUG, "FULL_IMAGE event emitted\n");
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
if (ctx->iccp) {
AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_ICC_PROFILE, ctx->iccp);
if (!sd)

@ -73,7 +73,7 @@ static int librsvg_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)))
return ret;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
image = cairo_image_surface_create_for_data(frame->data[0], CAIRO_FORMAT_ARGB32,
frame->width, frame->height,

@ -96,7 +96,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log(NULL, AV_LOG_WARNING, "Error frame type in uavs3d: %d.\n", dec_frame->type);
} else {
frm->pict_type = ff_avs3_image_type[dec_frame->type];
frm->key_frame = (frm->pict_type == AV_PICTURE_TYPE_I);
if (frm->pict_type == AV_PICTURE_TYPE_I)
frm->flags |= AV_FRAME_FLAG_KEY;
else
frm->flags &= ~AV_FRAME_FLAG_KEY;
}
for (i = 0; i < 3; i++) {

@ -206,7 +206,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
#define ADVANCE_BY_DECODED do { \
if (decoded < 0 || decoded >= buf_size) goto buf_too_small; \

@ -154,10 +154,13 @@ static int decode_frame_lscr(AVCodecContext *avctx, AVFrame *rframe,
size = bytestream2_get_le32(gb);
frame->key_frame = (nb_blocks == 1) &&
(w == avctx->width) &&
(h == avctx->height) &&
(x == 0) && (y == 0);
if ((nb_blocks == 1) &&
(w == avctx->width) &&
(h == avctx->height) &&
(x == 0) && (y == 0))
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
bytestream2_seek(gb, 2 + nb_blocks * 12 + offset, SEEK_SET);
csize = bytestream2_get_be32(gb);
@ -199,7 +202,7 @@ static int decode_frame_lscr(AVCodecContext *avctx, AVFrame *rframe,
}
}
frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
frame->pict_type = (frame->flags & AV_FRAME_FLAG_KEY) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if ((ret = av_frame_ref(rframe, frame)) < 0)
return ret;

@ -67,7 +67,7 @@ static int m101_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
if ((avctx->extradata[3*4] & 3) != 3) {
frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (avctx->extradata[3*4] & 1)

@ -637,7 +637,7 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
return ret;

@ -177,7 +177,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size);
if (!a->bitstream_buffer)

@ -222,7 +222,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return ret;
frame->pict_type = key ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
frame->key_frame = key;
if (key)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -745,7 +745,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->avctx->skip_frame == AVDISCARD_ALL) {
s->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
s->picture_ptr->key_frame = 1;
s->picture_ptr->flags |= AV_FRAME_FLAG_KEY;
s->got_picture = 1;
return 0;
}
@ -754,7 +754,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0)
return -1;
s->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
s->picture_ptr->key_frame = 1;
s->picture_ptr->flags |= AV_FRAME_FLAG_KEY;
s->got_picture = 1;
// Lets clear the palette to avoid leaving uninitialized values in it

@ -1235,7 +1235,7 @@ static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
if (get_bits1(gb)) {
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
s->moflex = get_bits1(gb);
s->dct_tab_idx = get_bits1(gb);
@ -1256,7 +1256,7 @@ static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
memset(motion, 0, s->motion_size);
frame->pict_type = AV_PICTURE_TYPE_P;
frame->key_frame = 0;
frame->flags &= ~AV_FRAME_FLAG_KEY;
s->dct_tab_idx = 0;
ret = setup_qtables(avctx, s->quantizer + (int64_t)get_se_golomb(gb));

@ -1343,7 +1343,10 @@ static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf,
s->mpeg_f_code[1][1] = f_code;
}
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if (s->pict_type == AV_PICTURE_TYPE_I)
s->current_picture.f->flags |= AV_FRAME_FLAG_KEY;
else
s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY;
if (avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_DEBUG,
@ -1525,7 +1528,10 @@ static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
} else
s->pict_type = AV_PICTURE_TYPE_B;
s->current_picture.f->pict_type = s->pict_type;
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if (s->pict_type == AV_PICTURE_TYPE_I)
s->current_picture.f->flags |= AV_FRAME_FLAG_KEY;
else
s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY;
}
s->intra_dc_precision = get_bits(&s->gb, 2);
@ -3046,7 +3052,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -290,7 +290,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
AVRational aspect_ratio = s->avctx->sample_aspect_ratio;
int aspect_ratio_info;
if (!s->current_picture.f->key_frame)
if (!(s->current_picture.f->flags & AV_FRAME_FLAG_KEY))
return;
if (aspect_ratio.num == 0 || aspect_ratio.den == 0)

@ -343,7 +343,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->current_picture_ptr->field_picture = s->picture_structure != PICT_FRAME;
s->current_picture_ptr->f->pict_type = s->pict_type;
s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if (s->pict_type == AV_PICTURE_TYPE_I)
s->current_picture.f->flags |= AV_FRAME_FLAG_KEY;
else
s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY;
if ((ret = ff_mpeg_ref_picture(s->avctx, &s->current_picture,
s->current_picture_ptr)) < 0)
@ -382,7 +385,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->last_picture_ptr = &s->picture[idx];
s->last_picture_ptr->reference = 3;
s->last_picture_ptr->f->key_frame = 0;
s->last_picture_ptr->f->flags &= ~AV_FRAME_FLAG_KEY;
s->last_picture_ptr->f->pict_type = AV_PICTURE_TYPE_P;
if (alloc_picture(s, s->last_picture_ptr) < 0) {
@ -424,7 +427,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->next_picture_ptr = &s->picture[idx];
s->next_picture_ptr->reference = 3;
s->next_picture_ptr->f->key_frame = 0;
s->next_picture_ptr->f->flags &= ~AV_FRAME_FLAG_KEY;
s->next_picture_ptr->f->pict_type = AV_PICTURE_TYPE_P;
if (alloc_picture(s, s->next_picture_ptr) < 0) {

@ -1703,7 +1703,10 @@ static int frame_start(MpegEncContext *s)
}
s->current_picture_ptr->f->pict_type = s->pict_type;
s->current_picture_ptr->f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
if (s->pict_type == AV_PICTURE_TYPE_I)
s->current_picture.f->flags |= AV_FRAME_FLAG_KEY;
else
s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY;
ff_mpeg_unref_picture(s->avctx, &s->current_picture);
if ((ret = ff_mpeg_ref_picture(s->avctx, &s->current_picture,
@ -1979,7 +1982,7 @@ vbv_retry:
return ret;
}
if (s->current_picture.f->key_frame)
if (s->current_picture.f->flags & AV_FRAME_FLAG_KEY)
pkt->flags |= AV_PKT_FLAG_KEY;
if (s->mb_info)
av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size);
@ -3783,12 +3786,17 @@ static int encode_picture(MpegEncContext *s)
}
//FIXME var duplication
s->current_picture_ptr->f->key_frame =
s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; //FIXME pic_ptr
if (s->pict_type == AV_PICTURE_TYPE_I) {
s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_KEY; //FIXME pic_ptr
s->current_picture.f->flags |= AV_FRAME_FLAG_KEY;
} else {
s->current_picture_ptr->f->flags &= ~AV_FRAME_FLAG_KEY; //FIXME pic_ptr
s->current_picture.f->flags &= ~AV_FRAME_FLAG_KEY;
}
s->current_picture_ptr->f->pict_type =
s->current_picture.f->pict_type = s->pict_type;
if (s->current_picture.f->key_frame)
if (s->current_picture.f->flags & AV_FRAME_FLAG_KEY)
s->picture_in_gop_number=0;
s->mb_x = s->mb_y = 0;

@ -200,7 +200,7 @@ inflate_error:
s->uncomp_buf + s->bpp * j * avctx->width, s->bpp * avctx->width);
}
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
*got_frame = 1;

@ -47,7 +47,7 @@ static int msp2_decode_frame(AVCodecContext *avctx, AVFrame *p,
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
bytestream2_init(&idx, buf, 2 * avctx->height);
buf += 2 * avctx->height;

@ -165,12 +165,12 @@ static int mss1_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
c->corrupted = 0;
ff_mss12_slicecontext_reset(&ctx->sc);
pal_changed = decode_pal(c, &acoder);
ctx->pic->key_frame = 1;
ctx->pic->flags |= AV_FRAME_FLAG_KEY;
ctx->pic->pict_type = AV_PICTURE_TYPE_I;
} else {
if (c->corrupted)
return AVERROR_INVALIDDATA;
ctx->pic->key_frame = 0;
ctx->pic->flags &= ~AV_FRAME_FLAG_KEY;
ctx->pic->pict_type = AV_PICTURE_TYPE_P;
}
c->corrupted = ff_mss12_decode_rect(&ctx->sc, &acoder, 0, 0,

@ -660,7 +660,10 @@ static int mss2_decode_frame(AVCodecContext *avctx, AVFrame *frame,
frame->linesize[0] * (avctx->height - 1);
c->rgb_stride = -frame->linesize[0];
frame->key_frame = keyframe;
if (keyframe)
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if (is_555) {

@ -740,7 +740,10 @@ static int mss3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = keyframe;
if (keyframe)
c->pic->flags |= AV_FRAME_FLAG_KEY;
else
c->pic->flags &= ~AV_FRAME_FLAG_KEY;
c->pic->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if (!bytestream2_get_bytes_left(&gb)) {
if ((ret = av_frame_ref(rframe, c->pic)) < 0)

@ -503,7 +503,10 @@ static int mss4_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0)
return ret;
c->pic->key_frame = (frame_type == INTRA_FRAME);
if (frame_type == INTRA_FRAME)
c->pic->flags |= AV_FRAME_FLAG_KEY;
else
c->pic->flags &= ~AV_FRAME_FLAG_KEY;
c->pic->pict_type = (frame_type == INTRA_FRAME) ? AV_PICTURE_TYPE_I
: AV_PICTURE_TYPE_P;
if (frame_type == SKIP_FRAME) {

@ -623,9 +623,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
get_qtable(s->intraq_tab[0], s->intra_quant, luma_tab);
get_qtable(s->intraq_tab[1], s->intra_quant, chroma_tab);
frame->key_frame = s->is_inter == 0;
if (frame->key_frame) {
if (s->is_inter == 0) {
frame->flags |= AV_FRAME_FLAG_KEY;
ret = decode_intra(avctx, gb, frame);
if (ret < 0)
return ret;
@ -638,6 +637,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}
frame->flags &= ~AV_FRAME_FLAG_KEY;
ret = decode_inter(avctx, gb, frame, s->prev_frame);
if (ret < 0)
return ret;

@ -247,7 +247,7 @@ static int mvc_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;

@ -272,7 +272,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
}
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;
return avpkt->size;

@ -119,10 +119,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
bytestream2_init(&gbp, s->prev_frame->data[0], avctx->height * s->prev_frame->linesize[0]);
bytestream2_init_writer(&pb, frame->data[0], avctx->height * frame->linesize[0]);
frame->key_frame = rle_uncompress(&gb, &pb, &gbp, avctx->width, avctx->height, avctx->width * 3,
frame->linesize[0], s->prev_frame->linesize[0]);
if (rle_uncompress(&gb, &pb, &gbp, avctx->width, avctx->height, avctx->width * 3,
frame->linesize[0], s->prev_frame->linesize[0]))
frame->flags |= AV_FRAME_FLAG_KEY;
else
frame->flags &= ~AV_FRAME_FLAG_KEY;
frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
frame->pict_type = (frame->flags & AV_FRAME_FLAG_KEY) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
av_frame_unref(s->prev_frame);
if ((ret = av_frame_ref(s->prev_frame, frame)) < 0)

@ -286,11 +286,11 @@ static int mxpeg_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
AV_GET_BUFFER_FLAG_REF)) < 0)
return ret;
jpg->picture_ptr->pict_type = AV_PICTURE_TYPE_P;
jpg->picture_ptr->key_frame = 0;
jpg->picture_ptr->flags &= ~AV_FRAME_FLAG_KEY;
jpg->got_picture = 1;
} else {
jpg->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
jpg->picture_ptr->key_frame = 1;
jpg->picture_ptr->flags |= AV_FRAME_FLAG_KEY;
}
if (s->got_mxm_bitmask) {

@ -514,7 +514,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
*got_frame = 1;

@ -263,7 +263,10 @@ retry:
}
c->pic->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
c->pic->key_frame = keyframe;
if (keyframe)
c->pic->flags |= AV_FRAME_FLAG_KEY;
else
c->pic->flags &= ~AV_FRAME_FLAG_KEY;
// decompress/copy/whatever data
switch (comptype) {
case NUV_LZO:

@ -296,10 +296,10 @@ static int paf_video_decode(AVCodecContext *avctx, AVFrame *rframe,
if (code & 0x20) { // frame is keyframe
memset(c->pic->data[1], 0, AVPALETTE_SIZE);
c->current_frame = 0;
c->pic->key_frame = 1;
c->pic->flags |= AV_FRAME_FLAG_KEY;
c->pic->pict_type = AV_PICTURE_TYPE_I;
} else {
c->pic->key_frame = 0;
c->pic->flags &= ~AV_FRAME_FLAG_KEY;
c->pic->pict_type = AV_PICTURE_TYPE_P;
}

@ -107,7 +107,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
return ret;
if (avpkt->flags & AV_PKT_FLAG_KEY) {
frame->key_frame = 1;
frame->flags |= AV_FRAME_FLAG_KEY;
frame->pict_type = AV_PICTURE_TYPE_I;
} else {
frame->pict_type = AV_PICTURE_TYPE_P;

@ -140,7 +140,7 @@ static int pgx_decode_frame(AVCodecContext *avctx, AVFrame *p,
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
avctx->bits_per_raw_sample = depth;
if (bpp == 8)
write_frame_8(p, &g, width, height, sign, depth);

@ -332,7 +332,7 @@ static int photocd_decode_frame(AVCodecContext *avctx, AVFrame *p,
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
bytestream2_init(gb, avpkt->data, avpkt->size);

@ -667,7 +667,7 @@ static int pixlet_decode_frame(AVCodecContext *avctx, AVFrame *p,
bytestream2_skip(&ctx->gb, 8);
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
p->color_range = AVCOL_RANGE_JPEG;
ret = ff_thread_get_buffer(avctx, p, 0);

@ -840,7 +840,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s,
}
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->flags |= AV_FRAME_FLAG_KEY;
p->flags |= AV_FRAME_FLAG_INTERLACED * !!s->interlace_type;
if ((ret = populate_avctx_color_fields(avctx, p)) < 0)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save