[FFmpeg-devel] [PATCH 1/2] compat/cuda/ptx2c: remove shell loop

rcombs rcombs at rcombs.me
Sat May 23 07:01:21 EEST 2020


This improves build times dramatically
---
 compat/cuda/ptx2c.sh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/compat/cuda/ptx2c.sh b/compat/cuda/ptx2c.sh
index 0750e7a3b7..435a9b4b6c 100755
--- a/compat/cuda/ptx2c.sh
+++ b/compat/cuda/ptx2c.sh
@@ -27,10 +27,8 @@ IN="$2"
 NAME="$(basename "$IN" | sed 's/\..*//')"
 
 printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
-while IFS= read -r LINE
-do
-    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed -e 's/\r//g' -e 's/["\\]/\\&/g')" >> "$OUT"
-done < "$IN"
-printf ";\n" >> "$OUT"
+echo >> "$OUT"
+sed -e 's/\r//g' -e 's/["\\]/\\&/g' -e 's/^[[:space:]]*/\t"/' -e 's/$/\\n"/' < "$IN" >> "$OUT"
+echo ";" >> "$OUT"
 
 exit 0
-- 
2.26.2



More information about the ffmpeg-devel mailing list