PROCÉDÉ D'ALLOCATION DE MÉMOIRE DANS UN PROCESSEUR DE MEMORY ALLOCATION METHOD IN A PROCESSOR
TRAITEMENT D'IMAGESIMAGE PROCESSING
La présente invention se rapporte au domaine des processeurs dédiés au traitement d'images et plus particulièrement à la gestion des mémoires internes au processeur nécessaires pour ledit traitement d'images. En effet, la mise en œuvre d'un processeur de traitement d'image nécessite la gestion de l'accès aux données à traiter. Dans le cas de codage ou de décodage d'image, certains algorithmes (JBIG, JPEG par exemple) nécessitent l'utilisation de plusieurs lignes de l'image pour coder ou décoder un pixel : ces lignes sont appelées le contexte. Les processeurs utilisant un de ces algorithmes de codage et de décodage (appelés aussi « codées ») contiennent donc une mémoire interne pour stocker le contexte. Au fur et à mesure du traitement de l'image, le contexte évolue car il est différent pour chaque pixel. Le processeur doit mettre en œuvre également des mémoires destinées à stocker les données en attente d'être utilisées ou en attente d'être supprimées de la mémoire parce qu'elles ne sont plus utilisées. Ces mémoires contiennent des données organisées en files d'attente d'entrée et de sortie. Ces files d'attente sont accédées selon le système « premier entré, premier sorti », appelé communément FIFO (« First In, First Out », traduction en anglais des termes français).The present invention relates to the field of processors dedicated to image processing and more particularly to the management of memories internal to the processor necessary for said image processing. Indeed, the implementation of an image processing processor requires the management of access to the data to be processed. In the case of image coding or decoding, certain algorithms (JBIG, JPEG for example) require the use of several lines of the image to code or decode a pixel: these lines are called the context. Processors using one of these coding and decoding algorithms (also called “coded”) therefore contain internal memory to store the context. As the image is processed, the context changes because it is different for each pixel. The processor must also implement memories intended to store the data waiting to be used or waiting to be deleted from the memory because it is no longer used. These memories contain data organized into input and output queues. These queues are accessed using the "first in, first out" system, commonly known as FIFO ("First In, First Out", English translation of French terms).
La taille de ces files d'attente conditionne la tenue du débit dans le traitement de l'image. Si elle est trop faible, le processeur sera obligé de s'arrêter de temps en temps pour attendre les nouvelles données. Ainsi, plus la taille est grande, plus ce type d'événement est rare.The size of these queues conditions the performance of the throughput in image processing. If it is too low, the processor will be forced to stop from time to time to wait for the new data. Thus, the larger the size, the more rare this type of event.
La solution employée en général utilise des mémoires différentes pour stocker le contexte et les files d'attente d'entrée et de sortie. Chacune de ces mémoires a une taille
fixée indépendante de l'image traitée. Cette solution induit une perte d'espace mémoire égale à la différence entre la taille de la mémoire allouée au contexte et la taille de la mémoire effectivement occupée par le contexte. L'art antérieur connaît, par le brevet américain US 5 263 136 (Optigraphics) , un système pour la gestion d'images tuilées utilisant des résolutions multiples. Le système définit un espace d'adresse pour une mémoire virtuelle qui comprend un cache de données d'image et un disque. Une pile image pour chaque source d'image est stockée en tant qu'une image de pleine résolution et un ensemble de sous-images de plus basse résolution. Chaque tuile d'une image peut exister en un ou plus de cinq états : non compressée et résidente dans le cache d'image de données d'image, compressée et résidente dans le cache d'image de données d'image, non compressée et résidente sur le disque, compressée et résidente sur le disque et non chargée mais re-créable en utilisant des données des tuiles d'images de plus haute résolution. La présente invention propose une solution qui permet de dimensionner la taille de la mémoire allouée aux files d'attente d'entrée et de sortie en fonction de l'image traitée. Pour cela, elle met en place une mémoire physique commune pour le contexte et les files d'attente. Au début du traitement de l'image, la taille de mémoire prise par le contexte est spécifiée et le processeur attribue la place restante aux files d'attente. Ceci est possible car la taille du contexte est constante pendant tout le traitement de l'image. Ainsi, lesdites files d'attente ont un espace mémoire optimisé en fonction de l'image.The solution generally used uses different memories to store the context and the input and output queues. Each of these memories has a size fixed independent of the processed image. This solution induces a loss of memory space equal to the difference between the size of the memory allocated to the context and the size of the memory actually occupied by the context. The prior art knows, from American patent US 5,263,136 (Optigraphics), a system for managing tiled images using multiple resolutions. The system defines an address space for virtual memory that includes an image data cache and a disk. An image stack for each image source is stored as a full resolution image and a set of lower resolution sub-images. Each tile in an image can exist in one or more than five states: uncompressed and resident in the image data image cache, compressed and resident in the image data image cache, uncompressed and resident on disk, compressed and resident on disk and not loaded but re-authorable using data from higher resolution image tiles. The present invention provides a solution which makes it possible to size the size of the memory allocated to the input and output queues as a function of the image processed. For this, it sets up a common physical memory for the context and the queues. At the start of image processing, the memory size taken by the context is specified and the processor allocates the remaining space to the queues. This is possible because the size of the context is constant throughout the image processing. Thus, said queues have an optimized memory space according to the image.
Pour ce faire, la présente invention est du type décrit ci-dessus et elle est remarquable dans son acceptation la plus large, en ce qu'elle concerne un procédé
d'allocation de mémoire dans un processeur de traitement d'images comprenant une mémoire interne d'une taille connue caractérisé en ce qu'il comprend les étapes : a) Une étape de spécification de la taille de mémoire nécessaire pour stocker un élément caractérisant l'image à traiter ; b) Une étape de calcul de la taille restante dans la mémoire interne du processeur ; c) Une étape d'allocation de ladite taille restante pour stocker les données entrantes ou sortantes [FIFO],To do this, the present invention is of the type described above and it is remarkable in its broadest acceptance, in that it relates to a process allocating memory in an image processing processor comprising an internal memory of a known size characterized in that it comprises the steps: a) A step of specifying the size of memory necessary for storing an element characterizing the image to be processed; b) A step of calculating the size remaining in the internal memory of the processor; c) a step of allocating said remaining size to store the incoming or outgoing data [FIFO],
De préférence, ledit élément caractérisant est une ou plusieurs lignes de l'image à traiter.Preferably, said characterizing element is one or more lines of the image to be processed.
Selon un mode de réalisation de l'invention, ladite étape de spécification consiste en un envoi par l'utilisateur du processeur de la longueur d'une ligne de l'image à traiterAccording to one embodiment of the invention, said step of specification consists in the sending by the user of the processor of the length of a line of the image to be processed
Selon un autre mode de réalisation de l'invention, ladite étape de spécification consiste en la lecture de 1'en-tête de l'image à traiter dans lequel la longueur de la ligne est inscrite.According to another embodiment of the invention, said step of specification consists in reading the header of the image to be processed in which the length of the line is written.
On comprendra mieux la présente invention à l'aide de la description, faite ci-après à titre purement explicatif, d'un mode de réalisation de l'invention.The present invention will be better understood on the basis of the description, given below for purely explanatory purposes, of an embodiment of the invention.
Le procédé selon l'invention peut être utilisé lors du codage d'une image en JBIG. Dans ce cas, le calcul du code correspondant à un pixel demande la connaissance des deux lignes précédentes. Ainsi, le processeur utilisé pour mettre en œuvre le procédé comprend une mémoire interne utilisée pour stocker les lignes de contexte nécessaires ainsi que les files d'attente d'entrée et de sortie. La taille totale de la mémoire est dimensionnée pour permettre le codage
d'images dont la largeur est inférieure à un nombre défini par le constructeur du processeur.The method according to the invention can be used when coding an image in JBIG. In this case, the calculation of the code corresponding to a pixel requires knowledge of the two preceding lines. Thus, the processor used to implement the method includes an internal memory used to store the necessary context lines as well as the input and output queues. The total memory size is dimensioned to allow coding images whose width is less than a number defined by the manufacturer of the processor.
Le procédé selon l'invention appliqué à un codage JBIG comporte les étapes suivantes : i) Une étape de spécification de la largeur en pixels de l'image par l'utilisateur via une interface entre lui et le processeur ; j ) Une étape de calcul de la taille allouée aux files d'attente dans la mémoire interne du processeur en faisant la différence entre la taille totale de la mémoire et la taille nécessaire au stockage de deux lignes de l'image ; k) Une étape d'allocation de la mémoire d'une part au contexte, d'autre part aux files d'attente d'entrée et de sortie par modification d'un registre d'adressage ; 1) Une étape d'envoi des informations à coder au processeur et de traitement de l'image, ledit processeur appelant les données d'entrée à un rythme dépendant de la taille de la mémoire allouée à la file d'attente.The method according to the invention applied to a JBIG coding comprises the following steps: i) A step of specifying the width in pixels of the image by the user via an interface between him and the processor; j) A step of calculating the size allocated to the queues in the internal memory of the processor by making the difference between the total size of the memory and the size necessary for the storage of two lines of the image; k) A step of allocating memory on the one hand to the context, on the other hand to the input and output queues by modification of an address register; 1) A step of sending information to be coded to the processor and of processing the image, said processor calling the input data at a rate depending on the size of the memory allocated to the queue.
Selon un autre mode de réalisation, le procédé selon l'invention peut être utilisé pour décoder une image. Un décodage d'une image JBIG est décrit ci-après, mais le procédé est utilisable avec de nombreux autres algorithmes de codage. Pour le décodage d'une image JBIG, le procédé selon l'invention utilise le fait qu'une image codée en JBIG comporte un en-tête contenant des informations sur l'image parmi lesquelles la largeur en pixels de l'image. Le procédé selon l'invention pour un décodage JBIG comprend donc les étapes suivantes : m) Une étape d'envoi du fichier JBIG au processeur ; n) Une étape de lecture de l' en-tête dudit fichier et de détermination de la largeur de l'image ; o) Une étape de calcul de la taille allouée aux files d'attente dans la mémoire interne du processeur en faisant
la différence entre la taille totale de la mémoire et la taille nécessaire au stockage de deux lignes de l'image ; p) Une étape d'allocation de la mémoire d'une part au contexte, d'autre part aux files d'attente d'entrée et de sortie par modification d'un registre d'adressage ; q) Une étape de traitement de l'image.According to another embodiment, the method according to the invention can be used to decode an image. Decoding of a JBIG image is described below, but the method can be used with many other coding algorithms. For the decoding of a JBIG image, the method according to the invention uses the fact that an image coded in JBIG comprises a header containing information on the image among which the width in pixels of the image. The method according to the invention for a JBIG decoding therefore comprises the following steps: m) A step of sending the JBIG file to the processor; n) A step of reading the header of said file and determining the width of the image; o) A step of calculating the size allocated to the queues in the internal memory of the processor by making the difference between the total size of the memory and the size necessary for the storage of two lines of the image; p) A step of allocating memory on the one hand to the context, on the other hand to the input and output queues by modification of an address register; q) An image processing step.
D'autre part, si la largeur en pixels de l'image n'est spécifiée ni par l'utilisateur ni par lecture de l' en-tête, ni par un autre moyen, l'étape d'allocation de la mémoire utilise des informations prédéfinies par le constructeur du processeur qui sont stockées dans un registre du processeur et qui spécifient soit la taille allouée par défaut aux files d'attente d'entrée et de sortie, soit la taille allouée par défaut au contexte ; l'allocation de la mémoire se faisant comme dans les cas décrits précédemment à partir des données par défaut.On the other hand, if the width in pixels of the image is not specified either by the user or by reading the header or by any other means, the memory allocation step uses information predefined by the processor manufacturer which is stored in a processor register and which specifies either the size allocated by default to the input and output queues, or the size allocated by default to the context; the allocation of the memory is done as in the cases described above from the default data.
L'invention est décrite dans ce qui précède à titre d'exemple. Il est entendu que l'homme du métier est à même de réaliser différentes variantes de l'invention sans pour autant sortir du cadre du brevet.
The invention is described in the foregoing by way of example. It is understood that a person skilled in the art is able to carry out different variants of the invention without going beyond the scope of the patent.