diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-03-26 19:04:43 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-03-26 19:04:51 +0200 |
commit | d92ecea69eab0db4e1c3a0e73fed10923374c3a8 (patch) | |
tree | d98b77274f93b070d1841dbabddc2c6375fec5b8 /src/capture | |
parent | 0e5e547c21176b2d9c4b0a4ef790d78781ac0a31 (diff) |
Remove yuv444 for now
Diffstat (limited to 'src/capture')
-rw-r--r-- | src/capture/nvfbc.c | 8 | ||||
-rw-r--r-- | src/capture/xcomposite_cuda.c | 11 | ||||
-rw-r--r-- | src/capture/xcomposite_drm.c | 1 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c index 68732f9..c1c998b 100644 --- a/src/capture/nvfbc.c +++ b/src/capture/nvfbc.c @@ -160,7 +160,7 @@ static bool ffmpeg_create_cuda_contexts(gsr_capture_nvfbc *cap_nvfbc, AVCodecCon AVHWFramesContext *hw_frame_context = (AVHWFramesContext*)frame_context->data; hw_frame_context->width = video_codec_context->width; hw_frame_context->height = video_codec_context->height; - hw_frame_context->sw_format = AV_PIX_FMT_0RGB32; + hw_frame_context->sw_format = AV_PIX_FMT_BGR0; hw_frame_context->format = video_codec_context->pix_fmt; hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; @@ -381,6 +381,7 @@ static void gsr_capture_nvfbc_tick(gsr_capture *cap, AVCodecContext *video_codec (*frame)->color_primaries = video_codec_context->color_primaries; (*frame)->color_trc = video_codec_context->color_trc; (*frame)->colorspace = video_codec_context->colorspace; + (*frame)->chroma_location = video_codec_context->chroma_sample_location; } } @@ -414,7 +415,12 @@ static int gsr_capture_nvfbc_capture(gsr_capture *cap, AVFrame *frame) { */ frame->data[0] = (uint8_t*)cu_device_ptr; + //frame->data[1] = (uint8_t*)cu_device_ptr; + //frame->data[2] = (uint8_t*)cu_device_ptr; frame->linesize[0] = frame->width * 4; + // TODO: Use these when outputting yuv444 by changing nvfbc color to YUV444P and sw_format to YUV444P + //frame->linesize[1] = frame->width * 1; + //frame->linesize[2] = frame->width * 1; return 0; } diff --git a/src/capture/xcomposite_cuda.c b/src/capture/xcomposite_cuda.c index bf8a053..1ce80f5 100644 --- a/src/capture/xcomposite_cuda.c +++ b/src/capture/xcomposite_cuda.c @@ -117,7 +117,7 @@ static bool cuda_create_codec_context(gsr_capture_xcomposite_cuda *cap_xcomp, AV (AVHWFramesContext *)frame_context->data; hw_frame_context->width = video_codec_context->width; hw_frame_context->height = video_codec_context->height; - hw_frame_context->sw_format = AV_PIX_FMT_0RGB32; + hw_frame_context->sw_format = AV_PIX_FMT_BGR0; hw_frame_context->format = video_codec_context->pix_fmt; hw_frame_context->device_ref = device_ctx; hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data; @@ -387,6 +387,7 @@ static void gsr_capture_xcomposite_cuda_tick(gsr_capture *cap, AVCodecContext *v (*frame)->color_primaries = video_codec_context->color_primaries; (*frame)->color_trc = video_codec_context->color_trc; (*frame)->colorspace = video_codec_context->colorspace; + (*frame)->chroma_location = video_codec_context->chroma_sample_location; if(av_hwframe_get_buffer(video_codec_context->hw_frames_ctx, *frame, 0) < 0) { fprintf(stderr, "gsr error: gsr_capture_xcomposite_cuda_tick: av_hwframe_get_buffer failed\n"); @@ -439,6 +440,9 @@ static int gsr_capture_xcomposite_cuda_capture(gsr_capture *cap, AVFrame *frame) cap_xcomp->egl.eglSwapBuffers(cap_xcomp->egl.egl_display, cap_xcomp->egl.egl_surface); frame->linesize[0] = frame->width * 4; + //frame->linesize[0] = frame->width * 1; + //frame->linesize[1] = frame->width * 1; + //frame->linesize[2] = frame->width * 1; CUDA_MEMCPY2D memcpy_struct; memcpy_struct.srcXInBytes = 0; @@ -452,10 +456,13 @@ static int gsr_capture_xcomposite_cuda_capture(gsr_capture *cap, AVFrame *frame) memcpy_struct.srcArray = cap_xcomp->mapped_array; memcpy_struct.dstDevice = (CUdeviceptr)frame->data[0]; memcpy_struct.dstPitch = frame->linesize[0]; - memcpy_struct.WidthInBytes = frame->width * 4; + memcpy_struct.WidthInBytes = frame->width * 4;//frame->width * 1; memcpy_struct.Height = frame->height; cap_xcomp->cuda.cuMemcpy2D_v2(&memcpy_struct); + //frame->data[1] = frame->data[0]; + //frame->data[2] = frame->data[0]; + return 0; } diff --git a/src/capture/xcomposite_drm.c b/src/capture/xcomposite_drm.c index a4810a8..fbd96fc 100644 --- a/src/capture/xcomposite_drm.c +++ b/src/capture/xcomposite_drm.c @@ -376,6 +376,7 @@ static void gsr_capture_xcomposite_drm_tick(gsr_capture *cap, AVCodecContext *vi (*frame)->color_primaries = video_codec_context->color_primaries; (*frame)->color_trc = video_codec_context->color_trc; (*frame)->colorspace = video_codec_context->colorspace; + (*frame)->chroma_location = video_codec_context->chroma_sample_location; int res = av_hwframe_get_buffer(video_codec_context->hw_frames_ctx, *frame, 0); if(res < 0) { |