Skip to content

Commit 10f55d9

Browse files
committed
tweak matrix guess by video size
1 parent db5c699 commit 10f55d9

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

docs/CHANGELOG.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
## Change log
22

3-
### 0.36.0-dev.3 (20251202)
4-
* Use frame properties if they available for "YCbCr Matrix: None"
5-
6-
### 0.36.0-dev.2 (20251201)
7-
* Restore x86-32 assrender.dll build
8-
9-
### 0.36.0-dev.1 (20251201)
3+
### 0.36.0-dev.4 (20251201)
104
* Switch submodule build system to meson
115
* Update avisynth(plus) headers to v12
6+
* Update libass to 0.17.4
127
* Unicode-safe file reading
138
* Add frame size parameters
149
* Add set_default_storage_size boolean
15-
* Update libass to 0.17.4
10+
* Use frame properties if they available for "YCbCr Matrix: None"
1611

1712
### 0.35 (20210304)
1813
* Windows MSVC: Update to libass v0.15

docs/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ Default is to use the ASS script's "YCbCr Matrix" or "Video Colorspace" property
8181

8282
Recognized .ASS properties: "TV.601" "TV.709", "PC.601" "PC.709" "TV.240m" "PC.240m" "TV.fcc" "PC.fcc" and "none".
8383

84-
"none" and "guess" decides upon on video resolution: width > 1280 or height > 576 → BT.709, else → BT.601.
85-
When no hint found in ASS script and 'colorspace' parameter is empty then the default is BT.601.
84+
"none" and "guess" determine the colorspace based on the video's `_Matrix` frame property if available. Otherwise, if the resolution is width > 1024 or height > 576, BT.709 is used; otherwise BT.601.
8685

8786
## Build instructions
8887
See: [BUILD.md](BUILD.md)

src/assrender.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,6 @@ AVS_Value AVSC_CC assrender_create(AVS_ScriptEnvironment* env, AVS_Value args,
450450
color_mt = MATRIX_BT2020;
451451
}
452452
else if (!strcasecmp(tmpcsp, "none") || !strcasecmp(tmpcsp, "guess")) {
453-
/* not yet
454-
* Theoretically only for 10 and 12 bits:
455-
if (fi->vi.width > 1920 || fi->vi.height > 1080)
456-
color_mt = MATRIX_BT2020;
457-
else
458-
*/
459-
460453
int mt_from_props_ok = 0;
461454
matrix_type mt_from_props = MATRIX_NONE;
462455

@@ -467,10 +460,16 @@ AVS_Value AVSC_CC assrender_create(AVS_ScriptEnvironment* env, AVS_Value args,
467460
if (mt_from_props_ok && mt_from_props != MATRIX_NONE) {
468461
color_mt = mt_from_props;
469462
} else {
470-
if (vi->width >= 1280 || vi->height >= 576) {
471-
color_mt = MATRIX_PC709;
463+
/* not yet
464+
* Theoretically only for 10 and 12 bits:
465+
if (fi->vi.width > 1920 || fi->vi.height > 1080)
466+
color_mt = MATRIX_BT2020;
467+
else
468+
*/
469+
if (vi->width > 1024 || vi->height > 576) {
470+
color_mt = MATRIX_BT709;
472471
} else {
473-
color_mt = MATRIX_PC601;
472+
color_mt = MATRIX_BT601;
474473
}
475474
}
476475
}
@@ -501,7 +500,6 @@ AVS_Value AVSC_CC assrender_create(AVS_ScriptEnvironment* env, AVS_Value args,
501500
return v;
502501
}
503502

504-
505503
switch (fi->vi.pixel_type)
506504
{
507505
case AVS_CS_YV12:

0 commit comments

Comments
 (0)