| 82 | } |
| 83 | |
| 84 | static int hcom_decode(AVCodecContext *avctx, AVFrame *frame, |
| 85 | int *got_frame, AVPacket *pkt) |
| 86 | { |
| 87 | HCOMContext *s = avctx->priv_data; |
| 88 | GetBitContext gb; |
| 89 | int ret, n = 0; |
| 90 | |
| 91 | if (pkt->size > INT16_MAX) |
| 92 | return AVERROR_INVALIDDATA; |
| 93 | |
| 94 | frame->nb_samples = pkt->size * 8; |
| 95 | if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) |
| 96 | return ret; |
| 97 | |
| 98 | if ((ret = init_get_bits8(&gb, pkt->data, pkt->size)) < 0) |
| 99 | return ret; |
| 100 | |
| 101 | while (get_bits_left(&gb) > 0) { |
| 102 | if (get_bits1(&gb)) |
| 103 | s->dict_entry = s->dict[s->dict_entry].r; |
| 104 | else |
| 105 | s->dict_entry = s->dict[s->dict_entry].l; |
| 106 | |
| 107 | if (s->dict[s->dict_entry].l < 0) { |
| 108 | int16_t datum; |
| 109 | |
| 110 | datum = s->dict[s->dict_entry].r; |
| 111 | |
| 112 | if (!s->delta_compression) |
| 113 | s->sample = 0; |
| 114 | s->sample = (s->sample + datum) & 0xFF; |
| 115 | |
| 116 | frame->data[0][n++] = s->sample; |
| 117 | |
| 118 | s->dict_entry = 0; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | frame->nb_samples = n; |
| 123 | |
| 124 | *got_frame = 1; |
| 125 | |
| 126 | return pkt->size; |
| 127 | } |
| 128 | |
| 129 | static av_cold int hcom_close(AVCodecContext *avctx) |
| 130 | { |
nothing calls this directly
no test coverage detected