<commit_before>#emacs, this is -*-Python-*- mode

# indexing starts from left, bottom

cimport c_lib
import traceback, sys
import numpy

cdef int FASTIMAGEDEBUG
FASTIMAGEDEBUG = 0

# for computing histograms
cdef int n_hist_levels
n_hist_levels = 256
cdef fw.Fw32s hist_levels[257]
for i in range(0,257):
    hist_levels[i]=i

def set_debug(int val):
    global FASTIMAGEDEBUG
    FASTIMAGEDEBUG = val

cdef extern from "unistd.h":
    ctypedef unsigned long intptr_t

cdef extern from "limits.h":
    cdef intptr_t INT_MAX
    cdef intptr_t INT_MIN

####################################

cdef ensure_framewave_bug_SF2541341_fixed():
    cdef fw.Fw8u* im
    cdef int step, width, height

    # This is essentially the same test as SF #2541341
    for width from 2<= width < 3: # original test went to 10
        for height from 2 <= height < 3: # original test went to 10
            im = fw.fwiMalloc_8u_C1( width, height, &step)
            if im==NULL: raise MemoryError("Error allocating memory")
            if step<width:
                raise RuntimeError('Your AMD Framewave installation has a '
                                   'serious bug. For %dx%d image, the '
                                   'allocated step %d is less than the width. '
                                   'This bug should is fixed in Framewave 1.4 '
                                   'or in svn r469 or higher.'%(
                    width,height,step))
            fw.fwiFree(im)

cdef extern from "FastImage_macros.h":
    # for PyArrayInterface
    int CONTIGUOUS
    int FORTRAN
    int ALIGNED
    int NOTSWAPPED
    int WRITEABLE
    int ARR_HAS_DESCR

    # for FW
    fw.Fw8u*  IMPOS8u(  fw.Fw8u*  im, int step, int bottom, int left)
    fw.Fw32f* IMPOS32f( fw.Fw32f* im, int step, int bottom, int left)
    void CHK_NOGIL( fw.FwStatus errval )

    char* fwGetStatusString( fw.FwStatus StsCode )

    cdef void InitStaticIfNecessary()<commit_msg>fix error string<commit_after>#emacs, this is -*-Python-*- mode

# indexing starts from left, bottom

cimport c_lib
import traceback, sys
import numpy

cdef int FASTIMAGEDEBUG
FASTIMAGEDEBUG = 0

# for computing histograms
cdef int n_hist_levels
n_hist_levels = 256
cdef fw.Fw32s hist_levels[257]
for i in range(0,257):
    hist_levels[i]=i

def set_debug(int val):
    global FASTIMAGEDEBUG
    FASTIMAGEDEBUG = val

cdef extern from "unistd.h":
    ctypedef unsigned long intptr_t

cdef extern from "limits.h":
    cdef intptr_t INT_MAX
    cdef intptr_t INT_MIN

####################################

cdef ensure_framewave_bug_SF2541341_fixed():
    cdef fw.Fw8u* im
    cdef int step, width, height

    # This is essentially the same test as SF #2541341
    for width from 2<= width < 3: # original test went to 10
        for height from 2 <= height < 3: # original test went to 10
            im = fw.fwiMalloc_8u_C1( width, height, &step)
            if im==NULL: raise MemoryError("Error allocating memory")
            if step<width:
                raise RuntimeError('Your AMD Framewave installation has a '
                                   'serious bug. For %dx%d image, the '
                                   'allocated step %d is less than the width. '
                                   'This bug is fixed in Framewave 1.3.1 '
                                   '(or in svn r469 or higher).'%(
                    width,height,step))
            fw.fwiFree(im)

cdef extern from "FastImage_macros.h":
    # for PyArrayInterface
    int CONTIGUOUS
    int FORTRAN
    int ALIGNED
    int NOTSWAPPED
    int WRITEABLE
    int ARR_HAS_DESCR

    # for FW
    fw.Fw8u*  IMPOS8u(  fw.Fw8u*  im, int step, int bottom, int left)
    fw.Fw32f* IMPOS32f( fw.Fw32f* im, int step, int bottom, int left)
    void CHK_NOGIL( fw.FwStatus errval )

    char* fwGetStatusString( fw.FwStatus StsCode )

    cdef void InitStaticIfNecessary()
{'fraction_non_alphanumeric': 0.08878023674729799, 'fraction_numerical': 0.027020072053525475, 'mean_word_length': 2.302463891248938, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5897279', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1274, 'n_words': 410}