MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / decode_frame

Function decode_frame

libavcodec/bink.c:897–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt)
898{
899 BinkContext * const c = avctx->priv_data;
900 GetBitContext gb;
901 int plane, plane_idx;
902 int bits_count = pkt->size << 3;
903
904 if(c->pic.data[0])
905 avctx->release_buffer(avctx, &c->pic);
906
907 if(avctx->get_buffer(avctx, &c->pic) < 0){
908 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
909 return -1;
910 }
911
912 init_get_bits(&gb, pkt->data, bits_count);
913 if (c->has_alpha) {
914 if (c->version >= 'i')
915 skip_bits_long(&gb, 32);
916 if (bink_decode_plane(c, &gb, 3, 0) < 0)
917 return -1;
918 }
919 if (c->version >= 'i')
920 skip_bits_long(&gb, 32);
921
922 for (plane = 0; plane < 3; plane++) {
923 plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3);
924
925 if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0)
926 return -1;
927 if (get_bits_count(&gb) >= bits_count)
928 break;
929 }
930 emms_c();
931
932 *data_size = sizeof(AVFrame);
933 *(AVFrame*)data = c->pic;
934
935 FFSWAP(AVFrame, c->pic, c->last);
936
937 /* always report that the buffer was completely consumed */
938 return pkt->size;
939}
940
941static av_cold int decode_init(AVCodecContext *avctx)
942{

Callers

nothing calls this directly

Calls 5

av_logFunction · 0.85
init_get_bitsFunction · 0.85
skip_bits_longFunction · 0.85
bink_decode_planeFunction · 0.85
get_bits_countFunction · 0.85

Tested by

no test coverage detected