| 32 | }; |
| 33 | |
| 34 | static int encode_yuv422p10(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame) |
| 35 | { |
| 36 | const int buf_size = avctx->height * avctx->width * avctx->bits_per_coded_sample / 8; |
| 37 | int ret; |
| 38 | uint8_t *dst; |
| 39 | const uint16_t *y; |
| 40 | const uint16_t *u; |
| 41 | const uint16_t *v; |
| 42 | PutBitContext pb; |
| 43 | |
| 44 | ret = ff_get_encode_buffer(avctx, pkt, buf_size, 0); |
| 45 | if (ret < 0) { |
| 46 | av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); |
| 47 | return ret; |
| 48 | } |
| 49 | dst = pkt->data; |
| 50 | |
| 51 | init_put_bits(&pb, dst, buf_size); |
| 52 | |
| 53 | for (int i = 0; i < avctx->height; i++) { |
| 54 | y = (uint16_t*)(frame->data[0] + i * frame->linesize[0]); |
| 55 | u = (uint16_t*)(frame->data[1] + i * frame->linesize[1]); |
| 56 | v = (uint16_t*)(frame->data[2] + i * frame->linesize[2]); |
| 57 | |
| 58 | for (int j = 0; j < avctx->width; j += 2) { |
| 59 | /* u, y0, v, y1 */ |
| 60 | put_bits(&pb, 10, av_clip_uintp2(*u++, 10)); |
| 61 | put_bits(&pb, 10, av_clip_uintp2(*y++, 10)); |
| 62 | put_bits(&pb, 10, av_clip_uintp2(*v++, 10)); |
| 63 | put_bits(&pb, 10, av_clip_uintp2(*y++, 10)); |
| 64 | } |
| 65 | } |
| 66 | flush_put_bits(&pb); |
| 67 | |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | |
| 72 | static av_cold int encode_init(AVCodecContext *avctx) |
nothing calls this directly
no test coverage detected