Skip to content

Commit

Permalink
fix: allow 16bit from ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jan 4, 2024
1 parent f07b281 commit bfcedf4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/modules/ffmpeg/producer/av_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@ struct Filter
AV_PIX_FMT_ARGB,
AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR,
AV_PIX_FMT_BGR48LE,
AV_PIX_FMT_RGB48LE,
AV_PIX_FMT_BGRA64LE,
AV_PIX_FMT_RGBA64LE,
// AV_PIX_FMT_X2RGB10LE TODO
AV_PIX_FMT_YUV444P,
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV420P,
Expand All @@ -511,14 +516,12 @@ struct Filter
AV_PIX_FMT_YUV444P10LE,
AV_PIX_FMT_YUV422P10LE,
AV_PIX_FMT_YUV420P10LE,
// AV_PIX_FMT_YUV410P10LE,
AV_PIX_FMT_YUV444P16LE,
AV_PIX_FMT_YUV422P16LE,
AV_PIX_FMT_YUV420P16LE,
AV_PIX_FMT_YUVA444P10LE,
AV_PIX_FMT_YUVA422P10LE,
AV_PIX_FMT_YUVA420P10LE,
// AV_PIX_FMT_UYVY42210LE,
AV_PIX_FMT_YUVA444P16LE,
AV_PIX_FMT_YUVA422P16LE,
AV_PIX_FMT_YUVA420P16LE,
Expand Down
12 changes: 10 additions & 2 deletions src/modules/ffmpeg/util/av_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,18 @@ core::pixel_format get_pixel_format(AVPixelFormat pix_fmt)
case AV_PIX_FMT_GRAY8:
return core::pixel_format::gray;
case AV_PIX_FMT_RGB24:
case AV_PIX_FMT_RGB48LE:
return core::pixel_format::rgb;
case AV_PIX_FMT_BGR24:
case AV_PIX_FMT_BGR48LE:
return core::pixel_format::bgr;
case AV_PIX_FMT_BGRA:
case AV_PIX_FMT_BGRA64LE:
return core::pixel_format::bgra;
case AV_PIX_FMT_ARGB:
return core::pixel_format::argb;
case AV_PIX_FMT_RGBA:
case AV_PIX_FMT_RGBA64LE:
return core::pixel_format::rgba;
case AV_PIX_FMT_ABGR:
return core::pixel_format::abgr;
Expand Down Expand Up @@ -175,14 +179,18 @@ core::pixel_format_desc pixel_format_desc(AVPixelFormat pix_fmt, int width, int
}
case core::pixel_format::bgr:
case core::pixel_format::rgb: {
desc.planes.emplace_back(linesizes[0] / 3, height, 3);
auto depth = (pix_fmt == AV_PIX_FMT_BGR48LE || pix_fmt==AV_PIX_FMT_RGB48LE) ? common::bit_depth::bit16:common::bit_depth::bit8;
auto scale = depth == common::bit_depth::bit16?6:3;
desc.planes.emplace_back(linesizes[0] / scale, height, 3, depth);
return desc;
}
case core::pixel_format::bgra:
case core::pixel_format::argb:
case core::pixel_format::rgba:
case core::pixel_format::abgr: {
desc.planes.emplace_back(linesizes[0] / 4, height, 4);
auto depth = (pix_fmt == AV_PIX_FMT_BGRA64LE || pix_fmt==AV_PIX_FMT_RGBA64LE) ? common::bit_depth::bit16:common::bit_depth::bit8;
auto scale = depth == common::bit_depth::bit16?8:4;
desc.planes.emplace_back(linesizes[0] / scale, height, 4, depth);
return desc;
}
case core::pixel_format::ycbcr:
Expand Down

0 comments on commit bfcedf4

Please sign in to comment.