style: unify identifier naming per updated conventions

Automated with clang-tidy readability-identifier-naming (config added to
.clang-tidy) plus scripted passes, per the updated rules now documented
in CONTRIBUTING.md:

- types (class/struct/enum/alias/template params): PascalCase
- functions, variables, members: snake_case (incl. rational -> Rational)
- private/protected members: trailing underscore; static member
  variables likewise (instance_, available_themes_)
- constants and enum values: snake_case (kLinear -> k_linear,
  F32P -> f32p); ALL_CAPS reserved for macros
- macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG ->
  OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE,
  include guards -> OAK_*)
- file names: all lowercase (Current/Plugin/OliveHost/OliveClip/
  OlivePluginInstance -> current/plugin/olivehost/oliveclip/
  oliveplugininstance)
- getters share the member name sans underscore, setters set_foo()
- Qt and third-party (OpenFX) virtual overrides and framework callbacks
  keep their original names (exempt in .clang-tidy)

Manual follow-ups required where automation could not reach:
- string-based QMetaObject/SIGNAL/SLOT references updated to renamed
  methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...)
- macro bodies referencing renamed methods (OLIVE_CONFIG,
  NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*)
- self-shadowing locals renamed where signals/methods became same-named
  (size_changed, worker_count, selected_items, import param, filters)
- third_party OFX member/namespace usages restored (OFX::Host::*,
  _created, _clipPrefsDirty, createInstance, clearPersistentMessage)
- STL protocol aliases restored (const_iterator) with .clang-tidy
  ignore rules; qHash overloads restored

Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
2026-07-19 16:10:54 +08:00
parent cb1718a103
commit bb40b4923e
1014 changed files with 44257 additions and 44220 deletions
+36 -36
View File
@@ -17,10 +17,10 @@ using namespace olive;
using namespace olive::core;
// Test helper to create AVFrame with specific format
static AVFramePtr CreateTestFrame(int width, int height, int fmt,
static AVFramePtr create_test_frame(int width, int height, int fmt,
uint32_t fill_color = 0xFF804020)
{
AVFramePtr frame = CreateAVFramePtr();
AVFramePtr frame = create_av_frame_ptr();
frame->set_width(width);
frame->set_height(height);
frame->set_format(fmt);
@@ -39,7 +39,7 @@ static AVFramePtr CreateTestFrame(int width, int height, int fmt,
uint8_t b = (fill_color >> 8) & 0xFF;
uint8_t a = fill_color & 0xFF;
if (fmt == FB_PIX_FMT_RGBA) {
if (fmt == fb_pix_fmt_rgba) {
for (int y = 0; y < height; ++y) {
uint8_t *row = frame->data(0) + y * frame->linesize(0);
for (int x = 0; x < width; ++x) {
@@ -49,7 +49,7 @@ static AVFramePtr CreateTestFrame(int width, int height, int fmt,
row[x * 4 + 3] = a;
}
}
} else if (fmt == FB_PIX_FMT_RGBA64LE) {
} else if (fmt == fb_pix_fmt_rgb_a64_le) {
uint16_t r16 = (r << 8) | r;
uint16_t g16 = (g << 8) | g;
uint16_t b16 = (b << 8) | b;
@@ -78,17 +78,17 @@ TEST(FormatConversion, U8ToU16)
// Create U8 source frame
AVFramePtr u8_frame =
CreateTestFrame(width, height, FB_PIX_FMT_RGBA, test_color);
create_test_frame(width, height, fb_pix_fmt_rgba, test_color);
ASSERT_NE(u8_frame, nullptr);
// Create U16 destination frame
AVFramePtr u16_frame =
CreateTestFrame(width, height, FB_PIX_FMT_RGBA64LE, 0);
create_test_frame(width, height, fb_pix_fmt_rgb_a64_le, 0);
ASSERT_NE(u16_frame, nullptr);
// Use the bridge scaler to convert
FBScaler *sws_ctx = fb_scaler_create(width, height, FB_PIX_FMT_RGBA, width,
height, FB_PIX_FMT_RGBA64LE,
FBScaler *sws_ctx = fb_scaler_create(width, height, fb_pix_fmt_rgba, width,
height, fb_pix_fmt_rgb_a64_le,
FB_SCALER_POINT);
ASSERT_NE(sws_ctx, nullptr);
@@ -127,16 +127,16 @@ TEST(FormatConversion, FFmpegU16ToU8)
// Create U16 frame
AVFramePtr u16_frame =
CreateTestFrame(width, height, FB_PIX_FMT_RGBA64LE, test_color);
create_test_frame(width, height, fb_pix_fmt_rgb_a64_le, test_color);
ASSERT_NE(u16_frame, nullptr);
// Create destination U8 frame
AVFramePtr u8_frame = CreateTestFrame(width, height, FB_PIX_FMT_RGBA, 0);
AVFramePtr u8_frame = create_test_frame(width, height, fb_pix_fmt_rgba, 0);
ASSERT_NE(u8_frame, nullptr);
// Use the bridge scaler to convert
FBScaler *sws_ctx = fb_scaler_create(width, height, FB_PIX_FMT_RGBA64LE,
width, height, FB_PIX_FMT_RGBA,
FBScaler *sws_ctx = fb_scaler_create(width, height, fb_pix_fmt_rgb_a64_le,
width, height, fb_pix_fmt_rgba,
FB_SCALER_POINT);
ASSERT_NE(sws_ctx, nullptr);
@@ -168,28 +168,28 @@ TEST(FormatConversion, FFmpegU16ToU8)
TEST(FormatConversion, VideoParamsToAVFormat)
{
// U8 RGBA
VideoParams u8_rgba(320, 240, PixelFormat::U8, 4);
int fmt_u8_rgba = FFmpegUtils::GetFFmpegPixelFormat(
VideoParams u8_rgba(320, 240, PixelFormat::u8, 4);
int fmt_u8_rgba = FFmpegUtils::get_f_fmpeg_pixel_format(
u8_rgba.format(), u8_rgba.channel_count());
EXPECT_EQ(fmt_u8_rgba, FB_PIX_FMT_RGBA);
EXPECT_EQ(fmt_u8_rgba, fb_pix_fmt_rgba);
// U16 RGBA
VideoParams u16_rgba(320, 240, PixelFormat::U16, 4);
int fmt_u16_rgba = FFmpegUtils::GetFFmpegPixelFormat(
VideoParams u16_rgba(320, 240, PixelFormat::u16, 4);
int fmt_u16_rgba = FFmpegUtils::get_f_fmpeg_pixel_format(
u16_rgba.format(), u16_rgba.channel_count());
EXPECT_EQ(fmt_u16_rgba, FB_PIX_FMT_RGBA64LE);
EXPECT_EQ(fmt_u16_rgba, fb_pix_fmt_rgb_a64_le);
// U8 RGB
VideoParams u8_rgb(320, 240, PixelFormat::U8, 3);
int fmt_u8_rgb = FFmpegUtils::GetFFmpegPixelFormat(
VideoParams u8_rgb(320, 240, PixelFormat::u8, 3);
int fmt_u8_rgb = FFmpegUtils::get_f_fmpeg_pixel_format(
u8_rgb.format(), u8_rgb.channel_count());
EXPECT_EQ(fmt_u8_rgb, FB_PIX_FMT_RGB24);
EXPECT_EQ(fmt_u8_rgb, fb_pix_fmt_rg_b24);
// U16 RGB
VideoParams u16_rgb(320, 240, PixelFormat::U16, 3);
int fmt_u16_rgb = FFmpegUtils::GetFFmpegPixelFormat(
VideoParams u16_rgb(320, 240, PixelFormat::u16, 3);
int fmt_u16_rgb = FFmpegUtils::get_f_fmpeg_pixel_format(
u16_rgb.format(), u16_rgb.channel_count());
EXPECT_EQ(fmt_u16_rgb, FB_PIX_FMT_RGB48LE);
EXPECT_EQ(fmt_u16_rgb, fb_pix_fmt_rg_b48_le);
}
// Test row bytes calculation via VideoParams::GetBytesPerPixel
@@ -198,16 +198,16 @@ TEST(FormatConversion, RowBytes)
const int width = 320;
// U8 RGBA: 4 bytes per pixel
EXPECT_EQ(width * VideoParams::GetBytesPerPixel(PixelFormat::U8, 4), 1280);
EXPECT_EQ(width * VideoParams::get_bytes_per_pixel(PixelFormat::u8, 4), 1280);
// U16 RGBA: 8 bytes per pixel
EXPECT_EQ(width * VideoParams::GetBytesPerPixel(PixelFormat::U16, 4), 2560);
EXPECT_EQ(width * VideoParams::get_bytes_per_pixel(PixelFormat::u16, 4), 2560);
// U8 RGB: 3 bytes per pixel
EXPECT_EQ(width * VideoParams::GetBytesPerPixel(PixelFormat::U8, 3), 960);
EXPECT_EQ(width * VideoParams::get_bytes_per_pixel(PixelFormat::u8, 3), 960);
// U16 RGB: 6 bytes per pixel
EXPECT_EQ(width * VideoParams::GetBytesPerPixel(PixelFormat::U16, 3), 1920);
EXPECT_EQ(width * VideoParams::get_bytes_per_pixel(PixelFormat::u16, 3), 1920);
}
// Test that linesize may differ from width * bpp due to alignment
@@ -216,10 +216,10 @@ TEST(FormatConversion, LinesizeAlignment)
const int width = 10;
const int height = 10;
AVFramePtr frame = CreateAVFramePtr();
AVFramePtr frame = create_av_frame_ptr();
frame->set_width(width);
frame->set_height(height);
frame->set_format(FB_PIX_FMT_RGBA);
frame->set_format(fb_pix_fmt_rgba);
ASSERT_EQ(frame->get_buffer(0), 0);
@@ -238,16 +238,16 @@ TEST(FormatConversion, LoadImageFile)
.filePath(QStringLiteral("tests/img.png"));
ASSERT_TRUE(QFileInfo::exists(img_path));
DecoderPtr decoder = Decoder::CreateFromID(QStringLiteral("oiio"));
DecoderPtr decoder = Decoder::create_from_id(QStringLiteral("oiio"));
ASSERT_TRUE(decoder);
ASSERT_TRUE(decoder->Open(Decoder::CodecStream(img_path, 0, nullptr)));
ASSERT_TRUE(decoder->open(Decoder::CodecStream(img_path, 0, nullptr)));
Decoder::RetrieveVideoParams params;
params.time = rational(0);
params.time = Rational(0);
params.divider = 1;
FramePtr frame = decoder->RetrieveVideoFrame(params);
decoder->Close();
FramePtr frame = decoder->retrieve_video_frame(params);
decoder->close();
ASSERT_TRUE(frame);
ASSERT_TRUE(frame->is_allocated());
@@ -255,7 +255,7 @@ TEST(FormatConversion, LoadImageFile)
EXPECT_EQ(frame->height(), 1080);
// Still images are decoded to F32 RGBA (channel values scaled by 1/255)
EXPECT_EQ(frame->format(), PixelFormat::F32);
EXPECT_EQ(frame->format(), PixelFormat::f32);
EXPECT_EQ(frame->channel_count(), 4);
// Spot-check decoded pixels against the known PNG content