File: quantumpriority.sh

package info (click to toggle)
imagemagick 8%3A7.1.1.43%2Bdfsg1-1%2Bdeb13u3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 96,160 kB
  • sloc: ansic: 370,601; cpp: 22,835; xml: 11,549; perl: 6,280; sh: 6,203; makefile: 3,484; tcl: 459
file content (54 lines) | stat: -rwxr-xr-x 1,042 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

# set priority according to quantum
set -e

# default quantum priority is above all priority
DEFAULT_PRIORITY=10000

if test "x$DEFAULTQUANTUMDEPTH" = x; then
    echo "No default quantum exit" > /dev/stderr;
    exit 1;
fi

if test "x$1" = x; then
    echo "No quantum exit" > /dev/stderr;
    exit 1;
fi


QUANTUM_PART=$(set -e;echo -n "$1" | sed -r 's/q?([[:digit:]]*)(HDRI)?/\1/gi')
HDRI_STR=$(set -e;echo -n "$1" | sed -e 's/\(.*\)/\L\1/') 
HDRI=$(set -e;case "$HDRI_STR" in *hdri) echo 'yes';; *) echo 'no' ;; esac)
								       
if test "x$1" = "x$DEFAULTQUANTUMDEPTH"; then
    echo -n $DEFAULT_PRIORITY
    exit 0;
fi

# hdri is slower divide 
if test "x$HDRI" = "xyes"; then
    PRIO_OFFSET=100;
else
    PRIO_OFFSET=1000;
fi;

# larger is slower
case $QUANTUM_PART
in 8)
       BASE_PRIO=4;;
   16)
       BASE_PRIO=3;;
   32)
       BASE_PRIO=2;;
   64)
       BASE_PRIO=1;;
   *)
       echo "unknown quantum exit" > /dev/stderr;
       exit 1;
       ;;
esac

echo -n $(($BASE_PRIO*100+$PRIO_OFFSET))
			  
exit 0;