Skip to content

Commit

Permalink
Factor out common expression
Browse files Browse the repository at this point in the history
  • Loading branch information
ledoge authored Sep 29, 2024
1 parent c5911db commit 408b68d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions CUETools.Codecs.FLACCL/flac.cl
Original file line number Diff line number Diff line change
Expand Up @@ -2220,13 +2220,15 @@ void clRiceEncoding(
}
barrier(CLK_LOCAL_MEM_FENCE);
remainder = data[start / 32 - start32];
if ((start32 + tid) * 32 <= start)
int write = (start32 + tid) * 32;
if (write <= start) {
output[start32 + tid] = as_int(as_char4(data[tid]).wzyx);
if ((start32 + tid + GROUP_SIZE) * 32 <= start)
{
output[start32 + tid + GROUP_SIZE] = as_int(as_char4(data[tid + GROUP_SIZE]).wzyx);
data[tid + GROUP_SIZE] = 0;
}
if (write + GROUP_SIZE * 32 <= start)
{
output[start32 + tid + GROUP_SIZE] = as_int(as_char4(data[tid + GROUP_SIZE]).wzyx);
data[tid + GROUP_SIZE] = 0;
}
}
}
if (pos < bs)
{
Expand Down Expand Up @@ -2286,13 +2288,15 @@ void clRiceEncoding(
}
barrier(CLK_LOCAL_MEM_FENCE);
remainder = data[start / 32 - start32];
if ((start32 + tid) * 32 <= start)
int write = (start32 + tid) * 32;
if (write <= start) {
output[start32 + tid] = as_int(as_char4(data[tid]).wzyx);
if ((start32 + tid + GROUP_SIZE) * 32 <= start)
{
output[start32 + tid + GROUP_SIZE] = as_int(as_char4(data[tid + GROUP_SIZE]).wzyx);
data[tid + GROUP_SIZE] = 0;
}
if (write + GROUP_SIZE * 32 <= start)
{
output[start32 + tid + GROUP_SIZE] = as_int(as_char4(data[tid + GROUP_SIZE]).wzyx);
data[tid + GROUP_SIZE] = 0;
}
}
}
// if (tid == 0 && start != task.encodingOffset - task.headerLen + task.size)
//printf("size mismatch: %d != %d\n", start, task.encodingOffset - task.headerLen + task.size);
Expand Down

0 comments on commit 408b68d

Please sign in to comment.