| 49 | } |
| 50 | |
| 51 | static int alloc_base_frame(void *logctx, FFLCEVCContext *lcevc, |
| 52 | const AVFrame *frame, LCEVC_PictureHandle *picture) |
| 53 | { |
| 54 | LCEVC_PictureDesc desc; |
| 55 | LCEVC_ColorFormat fmt = map_format(frame->format); |
| 56 | LCEVC_PicturePlaneDesc planes[AV_VIDEO_MAX_PLANES] = { 0 }; |
| 57 | int width = frame->width - frame->crop_left - frame->crop_right; |
| 58 | int height = frame->height - frame->crop_top - frame->crop_bottom; |
| 59 | LCEVC_ReturnCode res; |
| 60 | |
| 61 | res = LCEVC_DefaultPictureDesc(&desc, fmt, width, height); |
| 62 | if (res != LCEVC_Success) |
| 63 | return AVERROR_EXTERNAL; |
| 64 | |
| 65 | desc.cropTop = frame->crop_top; |
| 66 | desc.cropBottom = frame->crop_bottom; |
| 67 | desc.cropLeft = frame->crop_left; |
| 68 | desc.cropRight = frame->crop_right; |
| 69 | desc.sampleAspectRatioNum = frame->sample_aspect_ratio.num; |
| 70 | desc.sampleAspectRatioDen = frame->sample_aspect_ratio.den; |
| 71 | |
| 72 | for (int i = 0; i < AV_VIDEO_MAX_PLANES; i++) { |
| 73 | planes[i].firstSample = frame->data[i]; |
| 74 | planes[i].rowByteStride = frame->linesize[i]; |
| 75 | } |
| 76 | |
| 77 | /* Allocate LCEVC Picture */ |
| 78 | res = LCEVC_AllocPictureExternal(lcevc->decoder, &desc, NULL, planes, picture); |
| 79 | if (res != LCEVC_Success) { |
| 80 | return AVERROR_EXTERNAL; |
| 81 | } |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | static int alloc_enhanced_frame(void *logctx, FFLCEVCFrame *frame_ctx, |
| 87 | LCEVC_PictureHandle *picture) |
no test coverage detected