mirror of
https://github.com/immich-app/immich.git
synced 2025-01-17 01:06:46 +01:00
fallback to software decoding if is hdr video
This commit is contained in:
parent
c30ef4dfd6
commit
88ca1f31ad
2 changed files with 13 additions and 13 deletions
|
@ -2260,7 +2260,7 @@ describe(MediaService.name, () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should use software tone-mapping if opencl is not available', async () => {
|
it('should use software decoding and tone-mapping if opencl is not available', async () => {
|
||||||
storageMock.readdir.mockResolvedValue(['renderD128']);
|
storageMock.readdir.mockResolvedValue(['renderD128']);
|
||||||
storageMock.stat.mockResolvedValue({ isFile: () => false, isCharacterDevice: () => false } as Stats);
|
storageMock.stat.mockResolvedValue({ isFile: () => false, isCharacterDevice: () => false } as Stats);
|
||||||
mediaMock.probe.mockResolvedValue(probeStub.videoStreamHDR);
|
mediaMock.probe.mockResolvedValue(probeStub.videoStreamHDR);
|
||||||
|
@ -2273,10 +2273,10 @@ describe(MediaService.name, () => {
|
||||||
'/original/path.ext',
|
'/original/path.ext',
|
||||||
'upload/encoded-video/user-id/as/se/asset-id.mp4',
|
'upload/encoded-video/user-id/as/se/asset-id.mp4',
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
inputOptions: expect.any(Array),
|
inputOptions: [],
|
||||||
outputOptions: expect.arrayContaining([
|
outputOptions: expect.arrayContaining([
|
||||||
expect.stringContaining(
|
expect.stringContaining(
|
||||||
'tonemapx=tonemap=hable:desat=0:p=bt709:t=bt709:m=bt709:r=pc:peak=100:format=',
|
'tonemapx=tonemap=hable:desat=0:p=bt709:t=bt709:m=bt709:r=pc:peak=100:format=yuv420p',
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
twoPass: false,
|
twoPass: false,
|
||||||
|
|
|
@ -924,7 +924,8 @@ export class RkmppSwDecodeConfig extends BaseHWConfig {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseInputOptions(): string[] {
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
getBaseInputOptions(videoStream: VideoStreamInfo): string[] {
|
||||||
if (this.devices.length === 0) {
|
if (this.devices.length === 0) {
|
||||||
throw new Error('No RKMPP device found');
|
throw new Error('No RKMPP device found');
|
||||||
}
|
}
|
||||||
|
@ -977,12 +978,16 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
|
||||||
this.hasMaliOpenCL = hasMaliOpenCL;
|
this.hasMaliOpenCL = hasMaliOpenCL;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBaseInputOptions() {
|
getBaseInputOptions(videoStream: VideoStreamInfo) {
|
||||||
if (this.devices.length === 0) {
|
if (this.devices.length === 0) {
|
||||||
throw new Error('No RKMPP device found');
|
throw new Error('No RKMPP device found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['-hwaccel rkmpp', '-hwaccel_output_format drm_prime', '-afbc rga', '-noautorotate'];
|
if (!this.shouldToneMap(videoStream) || (this.shouldToneMap(videoStream) && this.hasMaliOpenCL)) {
|
||||||
|
return ['-hwaccel rkmpp', '-hwaccel_output_format drm_prime', '-afbc rga', '-noautorotate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilterOptions(videoStream: VideoStreamInfo) {
|
getFilterOptions(videoStream: VideoStreamInfo) {
|
||||||
|
@ -997,13 +1002,8 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
|
||||||
'format=drm_prime',
|
'format=drm_prime',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return [ // use RKMPP for scaling, CPU for tone mapping
|
// use CPU for scaling & tone mapping
|
||||||
`scale_rkrga=${this.getScaling(videoStream)}:format=nv12`,
|
return super.getFilterOptions(videoStream);
|
||||||
'hwdownload',
|
|
||||||
'format=nv12',
|
|
||||||
`tonemapx=tonemap=${this.config.tonemap}:desat=0:p=${primaries}:t=${transfer}:m=${matrix}:r=pc:peak=100:format=nv12`,
|
|
||||||
'hwupload',
|
|
||||||
];
|
|
||||||
} else if (this.shouldScale(videoStream)) {
|
} else if (this.shouldScale(videoStream)) {
|
||||||
return [`scale_rkrga=${this.getScaling(videoStream)}:format=nv12:afbc=1`];
|
return [`scale_rkrga=${this.getScaling(videoStream)}:format=nv12:afbc=1`];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue