mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00: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.stat.mockResolvedValue({ isFile: () => false, isCharacterDevice: () => false } as Stats);
|
||||
mediaMock.probe.mockResolvedValue(probeStub.videoStreamHDR);
|
||||
|
@ -2273,10 +2273,10 @@ describe(MediaService.name, () => {
|
|||
'/original/path.ext',
|
||||
'upload/encoded-video/user-id/as/se/asset-id.mp4',
|
||||
expect.objectContaining({
|
||||
inputOptions: expect.any(Array),
|
||||
inputOptions: [],
|
||||
outputOptions: expect.arrayContaining([
|
||||
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,
|
||||
|
|
|
@ -924,7 +924,8 @@ export class RkmppSwDecodeConfig extends BaseHWConfig {
|
|||
return false;
|
||||
}
|
||||
|
||||
getBaseInputOptions(): string[] {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
getBaseInputOptions(videoStream: VideoStreamInfo): string[] {
|
||||
if (this.devices.length === 0) {
|
||||
throw new Error('No RKMPP device found');
|
||||
}
|
||||
|
@ -977,12 +978,16 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
|
|||
this.hasMaliOpenCL = hasMaliOpenCL;
|
||||
}
|
||||
|
||||
getBaseInputOptions() {
|
||||
getBaseInputOptions(videoStream: VideoStreamInfo) {
|
||||
if (this.devices.length === 0) {
|
||||
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) {
|
||||
|
@ -997,13 +1002,8 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
|
|||
'format=drm_prime',
|
||||
];
|
||||
}
|
||||
return [ // use RKMPP for scaling, CPU for tone mapping
|
||||
`scale_rkrga=${this.getScaling(videoStream)}:format=nv12`,
|
||||
'hwdownload',
|
||||
'format=nv12',
|
||||
`tonemapx=tonemap=${this.config.tonemap}:desat=0:p=${primaries}:t=${transfer}:m=${matrix}:r=pc:peak=100:format=nv12`,
|
||||
'hwupload',
|
||||
];
|
||||
// use CPU for scaling & tone mapping
|
||||
return super.getFilterOptions(videoStream);
|
||||
} else if (this.shouldScale(videoStream)) {
|
||||
return [`scale_rkrga=${this.getScaling(videoStream)}:format=nv12:afbc=1`];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue