MCPcopy Create free account
hub / github.com/Tencent/libpag / FillYUVPadding

Function FillYUVPadding

exporter/src/export/encode/VideoEncoder.cpp:40–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40static void FillYUVPadding(uint8_t* data[4], int stride[4], int width, int height, int alphaStartX,
41 int alphaStartY) {
42 if (alphaStartX > width) {
43 int xAdd = (alphaStartX - width) / 2;
44 auto p = data[0] + width;
45 auto q = data[0] + alphaStartX;
46 for (int j = 0; j < height; j++) {
47 memset(p, p[-1], xAdd);
48 memset(q - xAdd, q[0], xAdd);
49 p += stride[0];
50 q += stride[0];
51 }
52 } else if (alphaStartY > height) {
53 int yAdd = (alphaStartY - height) / 2;
54 auto pSrc = data[0] + (height - 1) * stride[0];
55 auto pDst = data[0] + height * stride[0];
56 auto qSrc = data[0] + alphaStartY * stride[0];
57 auto qDst = data[0] + (alphaStartY - 1) * stride[0];
58 for (int j = 0; j < yAdd; j++) {
59 memcpy(pDst, pSrc, width);
60 memcpy(qDst, qSrc, width);
61 pDst += stride[0];
62 qDst -= stride[0];
63 }
64 }
65}
66
67std::unique_ptr<VideoEncoder> VideoEncoder::MakeVideoEncoder(bool) {
68 return std::make_unique<OfflineVideoEncoder>();

Callers 1

encodeRGBAMethod · 0.85

Calls 1

memcpyFunction · 0.85

Tested by

no test coverage detected