Skip to content

Commit

Permalink
Merge pull request #154 from nyanmisaka/fix-intel
Browse files Browse the repository at this point in the history
Fix a compile error on intel
  • Loading branch information
nyanmisaka authored Jun 3, 2022
2 parents 9b9d186 + bb3c84a commit 931b8e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Index: jellyfin-ffmpeg/libavfilter/opencl/scale.cl
+
+#ifdef ENABLE_DITHER
+ float2 ncoords = convert_float2((int2)(xi, yi)) *
+ (float2)(native_recip(get_image_width(dither)), native_recip(get_image_height(dither)));
+ native_recip((float2)(get_image_width(dither), get_image_height(dither)));
+#endif
+
+ if (xi < get_image_width(dst2) && yi < get_image_height(dst2)) {
Expand Down Expand Up @@ -158,7 +158,7 @@ Index: jellyfin-ffmpeg/libavfilter/opencl/scale.cl
+
+#ifdef ENABLE_DITHER
+ float2 ncoords = convert_float2((int2)(xi, yi)) *
+ (float2)(native_recip(get_image_width(dither)), native_recip(get_image_height(dither)));
+ native_recip((float2)(get_image_width(dither), get_image_height(dither)));
+#endif
+
+ int2 read_pos = clamp(src_pos, 0, src_size - 1);
Expand Down Expand Up @@ -228,7 +228,7 @@ Index: jellyfin-ffmpeg/libavfilter/opencl/scale.cl
+
+#ifdef ENABLE_DITHER
+ float2 ncoords = convert_float2((int2)(xi, yi)) *
+ (float2)(native_recip(get_image_width(dither)), native_recip(get_image_height(dither)));
+ native_recip((float2)(get_image_width(dither), get_image_height(dither)));
+#endif
+
+ int i, j;
Expand Down Expand Up @@ -653,8 +653,8 @@ Index: jellyfin-ffmpeg/libavfilter/vf_scale_opencl.c
+
+ if (ctx->in_desc->comp[0].depth > ctx->out_desc->comp[0].depth) {
+ av_bprintf(&header, "#define ENABLE_DITHER\n");
+ av_bprintf(&header, "__constant float dither_size2 = %f;\n", (float)(ff_fruit_dither_size * ff_fruit_dither_size));
+ av_bprintf(&header, "__constant float dither_quantization = %f;\n", (float)((1 << ctx->out_desc->comp[0].depth) - 1));
+ av_bprintf(&header, "__constant float dither_size2 = %.4ff;\n", (float)(ff_fruit_dither_size * ff_fruit_dither_size));
+ av_bprintf(&header, "__constant float dither_quantization = %.4ff;\n", (float)((1 << ctx->out_desc->comp[0].depth) - 1));
+ }
+
+ av_log(avctx, AV_LOG_DEBUG, "Generated OpenCL header:\n%s\n", header.str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ Index: jellyfin-ffmpeg/libavfilter/opencl/tonemap.cl
- float3 chroma = lrgb2yuv(chroma_c);
+#ifdef ENABLE_DITHER
+ float2 ncoords = convert_float2((int2)(xi, yi)) *
+ (float2)(native_recip(get_image_width(dither)), native_recip(get_image_height(dither)));
+ native_recip((float2)(get_image_width(dither), get_image_height(dither)));
+#endif

if (xi < get_image_width(dst2) && yi < get_image_height(dst2)) {
Expand Down Expand Up @@ -1060,8 +1060,8 @@ Index: jellyfin-ffmpeg/libavfilter/vf_tonemap_opencl.c
+
+ if (ctx->in_desc->comp[0].depth > ctx->out_desc->comp[0].depth) {
+ av_bprintf(&header, "#define ENABLE_DITHER\n");
+ av_bprintf(&header, "__constant float dither_size2 = %f;\n", (float)(ff_fruit_dither_size * ff_fruit_dither_size));
+ av_bprintf(&header, "__constant float dither_quantization = %f;\n", (float)((1 << ctx->out_desc->comp[0].depth) - 1));
+ av_bprintf(&header, "__constant float dither_size2 = %.4ff;\n", (float)(ff_fruit_dither_size * ff_fruit_dither_size));
+ av_bprintf(&header, "__constant float dither_quantization = %.4ff;\n", (float)((1 << ctx->out_desc->comp[0].depth) - 1));
+ }

if (ctx->primaries_out != ctx->primaries_in) {
Expand Down

0 comments on commit 931b8e6

Please sign in to comment.