scoped_refptr<VideoFrameBuffer> VideoFrameBuffer::CropAndScale(
int offset_x,
int offset_y,
int crop_width,
int crop_height,
int scaled_width,
int scaled_height) {
scoped_refptr<I420Buffer> result =
I420Buffer::Create(scaled_width, scaled_height);
result->CropAndScaleFrom(*this->ToI420(), offset_x, offset_y, crop_width,
crop_height); return result;
}
void VideoFrameBuffer::PrepareMappedBufferAsync(
size_t width,
size_t height,
scoped_refptr<PreparedFrameHandler> handler,
size_t frame_identifier) { // Default implementation can't do any preparations, // so it just invokes the callback immediately.
handler->OnFramePrepared(frame_identifier);
}
const I420BufferInterface* VideoFrameBuffer::GetI420() const { // Overridden by subclasses that can return an I420 buffer without any // conversion, in particular, I420BufferInterface. return nullptr;
}
const char* VideoFrameBufferTypeToString(VideoFrameBuffer::Type type) { switch (type) { case VideoFrameBuffer::Type::kNative: return"kNative"; case VideoFrameBuffer::Type::kI420: return"kI420"; case VideoFrameBuffer::Type::kI420A: return"kI420A"; case VideoFrameBuffer::Type::kI444: return"kI444"; case VideoFrameBuffer::Type::kI422: return"kI422"; case VideoFrameBuffer::Type::kI010: return"kI010"; case VideoFrameBuffer::Type::kI210: return"kI210"; case VideoFrameBuffer::Type::kI410: return"kI410"; case VideoFrameBuffer::Type::kNV12: return"kNV12"; default:
RTC_DCHECK_NOTREACHED();
}
}
int I444BufferInterface::ChromaWidth() const { return width();
}
int I444BufferInterface::ChromaHeight() const { return height();
}
scoped_refptr<VideoFrameBuffer> I444BufferInterface::CropAndScale(
int offset_x,
int offset_y,
int crop_width,
int crop_height,
int scaled_width,
int scaled_height) {
scoped_refptr<I444Buffer> result =
I444Buffer::Create(scaled_width, scaled_height);
result->CropAndScaleFrom(*this, offset_x, offset_y, crop_width, crop_height); return result;
}
int I422BufferInterface::ChromaHeight() const { return height();
}
scoped_refptr<VideoFrameBuffer> I422BufferInterface::CropAndScale(
int offset_x,
int offset_y,
int crop_width,
int crop_height,
int scaled_width,
int scaled_height) {
scoped_refptr<I422Buffer> result =
I422Buffer::Create(scaled_width, scaled_height);
result->CropAndScaleFrom(*this, offset_x, offset_y, crop_width, crop_height); return result;
}
scoped_refptr<VideoFrameBuffer> NV12BufferInterface::CropAndScale(
int offset_x,
int offset_y,
int crop_width,
int crop_height,
int scaled_width,
int scaled_height) {
scoped_refptr<NV12Buffer> result =
NV12Buffer::Create(scaled_width, scaled_height);
result->CropAndScaleFrom(*this, offset_x, offset_y, crop_width, crop_height); return result;
}
void CheckValidDimensions(int width,
int height,
int stride_y,
int stride_u,
int stride_v) {
RTC_CHECK_GT(width, 0);
RTC_CHECK_GT(height, 0);
RTC_CHECK_GE(stride_y, width);
RTC_CHECK_GT(stride_u, 0);
RTC_CHECK_GT(stride_v, 0);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.