MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / CopyToFrame

Function CopyToFrame

src/render/plugins/ffmpeg_encoder/ffmpeg_encoder.cpp:148–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146 }
147
148 static void CopyToFrame(AVFrame* frame, uint8_t* src_y, uint8_t* src_u, uint8_t* src_v) {
149 int y_h = frame->height;
150 int uv_h = frame->height / 2;
151
152 int y_w = frame->width;
153 int uv_w = frame->width / 2;
154
155 // Y plane
156 for (int i = 0; i < y_h; i++) {
157 memcpy(frame->data[0] + i * frame->linesize[0],
158 src_y + i * y_w,
159 y_w);
160 }
161
162 // U plane
163 for (int i = 0; i < uv_h; i++) {
164 memcpy(frame->data[1] + i * frame->linesize[1],
165 src_u + i * uv_w,
166 uv_w);
167 }
168
169 // V plane
170 for (int i = 0; i < uv_h; i++) {
171 memcpy(frame->data[2] + i * frame->linesize[2],
172 src_v + i * uv_w,
173 uv_w);
174 }
175 }
176
177 bool FFmpegEncoder::Encode(std::shared_ptr<Image> image, uint64_t frame_index, const std::any & extra) {
178 auto beg = TimeUtil::GetCurrentTimestamp();

Callers 1

EncodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected