]> git.sesse.net Git - vlc/blob - plugins/yuv/video_yuv.c
* fixed 8bpp YUV.
[vlc] / plugins / yuv / video_yuv.c
1 /*****************************************************************************
2  * video_yuv.c: YUV transformation functions
3  * Provides functions to perform the YUV conversion. The functions provided here
4  * are a complete and portable C implementation, and may be replaced in certain
5  * case by optimized functions.
6  *****************************************************************************
7  * Copyright (C) 1999, 2000 VideoLAN
8  *
9  * Authors:
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public
22  * License along with this program; if not, write to the
23  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  *****************************************************************************/
26
27 /*****************************************************************************
28  * Preamble
29  *****************************************************************************/
30 #include "defs.h"
31
32 #include <math.h>                                            /* exp(), pow() */
33 #include <errno.h>                                                 /* ENOMEM */
34 #include <stdlib.h>                                                /* free() */
35 #include <string.h>                                            /* strerror() */
36
37 #include "config.h"
38 #include "common.h"
39 #include "threads.h"
40 #include "mtime.h"
41 #include "plugins.h"
42 #include "video.h"
43 #include "video_output.h"
44 #include "video_yuv.h"
45
46 #include "intf_msg.h"
47
48 /*****************************************************************************
49  * vout_InitYUV: allocate and initialize translations tables
50  *****************************************************************************
51  * This function will allocate memory to store translation tables, depending
52  * of the screen depth.
53  *****************************************************************************/
54 int yuv_CInit( vout_thread_t *p_vout )
55 {
56     size_t      tables_size;                        /* tables size, in bytes */
57
58     /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
59     switch( p_vout->i_bytes_per_pixel )
60     {
61     case 1:
62         tables_size = sizeof( u8 )
63                 * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
64         break;
65     case 2:
66         tables_size = sizeof( u16 )
67                 * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
68         break;
69     case 3:
70     case 4:
71     default:
72         tables_size = sizeof( u32 )
73                 * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
74         break;
75     }
76
77     /* Allocate memory */
78     p_vout->yuv.p_base = malloc( tables_size );
79     if( p_vout->yuv.p_base == NULL )
80     {
81         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
82         return( 1 );
83     }
84
85     /* Allocate memory for conversion buffer and offset array */
86     p_vout->yuv.p_buffer = malloc( VOUT_MAX_WIDTH * p_vout->i_bytes_per_pixel );
87     if( p_vout->yuv.p_buffer == NULL )
88     {
89         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
90         free( p_vout->yuv.p_base );
91         return( 1 );
92     }
93
94     /* In 8bpp we have a twice as big offset table because we also
95      * need the offsets for U and V (not only Y) */
96     p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) *
97                              ( ( p_vout->i_bytes_per_pixel == 1 ) ? 2 : 1 ) );
98     if( p_vout->yuv.p_offset == NULL )
99     {
100         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
101         free( p_vout->yuv.p_base );
102         free( p_vout->yuv.p_buffer );
103         return( 1 );
104     }
105
106     /* Initialize tables */
107     SetYUV( p_vout );
108     return( 0 );
109 }
110
111 /*****************************************************************************
112  * yuv_CEnd: destroy translations tables
113  *****************************************************************************
114  * Free memory allocated by yuv_CCreate.
115  *****************************************************************************/
116 void yuv_CEnd( vout_thread_t *p_vout )
117 {
118     free( p_vout->yuv.p_base );
119     free( p_vout->yuv.p_buffer );
120     free( p_vout->yuv.p_offset );
121 }
122
123 /*****************************************************************************
124  * yuv_CReset: re-initialize translations tables
125  *****************************************************************************
126  * This function will initialize the tables allocated by vout_CreateTables and
127  * set functions pointers.
128  *****************************************************************************/
129 int yuv_CReset( vout_thread_t *p_vout )
130 {
131     yuv_CEnd( p_vout );
132     return( yuv_CInit( p_vout ) );
133 }
134
135 /* following functions are local */
136
137 /*****************************************************************************
138  * SetGammaTable: return intensity table transformed by gamma curve.
139  *****************************************************************************
140  * pi_table is a table of 256 entries from 0 to 255.
141  *****************************************************************************/
142 void SetGammaTable( int *pi_table, double f_gamma )
143 {
144     int         i_y;                                       /* base intensity */
145
146     /* Use exp(gamma) instead of gamma */
147     f_gamma = exp( f_gamma );
148
149     /* Build gamma table */
150     for( i_y = 0; i_y < 256; i_y++ )
151     {
152         pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
153     }
154  }
155
156 /*****************************************************************************
157  * SetYUV: compute tables and set function pointers
158 + *****************************************************************************/
159 void SetYUV( vout_thread_t *p_vout )
160 {
161     int         pi_gamma[256];                                /* gamma table */
162     int         i_index;                                  /* index in tables */
163
164     /* Build gamma table */
165     SetGammaTable( pi_gamma, p_vout->f_gamma );
166
167     /*
168      * Set pointers and build YUV tables
169      */
170     if( p_vout->b_grayscale )
171     {
172         /* Grayscale: build gray table */
173         switch( p_vout->i_bytes_per_pixel )
174         {
175         case 1:
176             {
177                 u16 bright[256], transp[256];
178
179                 p_vout->yuv.yuv.p_gray8 =  (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
180                 for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
181                 {
182                     p_vout->yuv.yuv.p_gray8[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
183                     p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
184                 }
185                 for( i_index = 0; i_index < 256; i_index++)
186                 {
187                     p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
188                     bright[ i_index ] = i_index << 8;
189                     transp[ i_index ] = 0;
190                 }
191                 /* the colors have been allocated, we can set the palette */
192                 p_vout->p_set_palette( p_vout, bright, bright, bright, transp );
193                 p_vout->i_white_pixel = 0xff;
194                 p_vout->i_black_pixel = 0x00;
195                 p_vout->i_gray_pixel = 0x44;
196                 p_vout->i_blue_pixel = 0x3b;
197
198                 break;
199             }
200         case 2:
201             p_vout->yuv.yuv.p_gray16 =  (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
202             for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
203             {
204                 p_vout->yuv.yuv.p_gray16[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
205                 p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
206             }
207             for( i_index = 0; i_index < 256; i_index++)
208             {
209                 p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
210             }
211             break;
212         case 3:
213         case 4:
214             p_vout->yuv.yuv.p_gray32 =  (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
215             for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
216             {
217                 p_vout->yuv.yuv.p_gray32[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
218                 p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
219             }
220             for( i_index = 0; i_index < 256; i_index++)
221             {
222                 p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
223             }
224             break;
225          }
226     }
227     else
228     {
229         /* Color: build red, green and blue tables */
230         switch( p_vout->i_bytes_per_pixel )
231         {
232         case 1:
233             {
234                 #define RGB_MIN 0
235                 #define RGB_MAX 255
236                 #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
237
238                 int y,u,v;
239                 int r,g,b;
240                 int uvr, uvg, uvb;
241                 int i = 0, j = 0;
242                 u16 red[256], green[256], blue[256], transp[256];
243                 unsigned char lookup[PALETTE_TABLE_SIZE];
244
245                 p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
246
247                 /* this loop calculates the intersection of an YUV box
248                  * and the RGB cube. */
249                 for ( y = 0; y <= 256; y += 16 )
250                 {
251                     for ( u = 0; u <= 256; u += 32 )
252                     for ( v = 0; v <= 256; v += 32 )
253                     {
254                         uvr = (V_RED_COEF*(v-128)) >> SHIFT;
255                         uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
256                         uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
257                         r = y + uvr;
258                         g = y + uvg;
259                         b = y + uvb;
260
261                         if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
262                                 && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
263                         {
264                             /* this one should never happen unless someone fscked up my code */
265                             if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette\n" ); break; }
266
267                             /* clip the colors */
268                             red[j] = CLIP( r );
269                             green[j] = CLIP( g );
270                             blue[j] = CLIP( b );
271                             transp[j] = 0;
272
273                             /* allocate color */
274                             lookup[i] = 1;
275                             p_vout->yuv.yuv.p_rgb8[i++] = j;
276                             j++;
277                         }
278                         else
279                         {
280                             lookup[i] = 0;
281                             p_vout->yuv.yuv.p_rgb8[i++] = 0;
282                         }
283                     }
284                     i += 128-81;
285                 }
286
287                 /* the colors have been allocated, we can set the palette */
288                 /* there will eventually be a way to know which colors
289                  * couldn't be allocated and try to find a replacement */
290                 p_vout->p_set_palette( p_vout, red, green, blue, transp );
291
292                 p_vout->i_white_pixel = 0xff;
293                 p_vout->i_black_pixel = 0x00;
294                 p_vout->i_gray_pixel = 0x44;
295                 p_vout->i_blue_pixel = 0x3b;
296
297                 i = 0;
298                 /* this loop allocates colors that got outside
299                  * the RGB cube */
300                 for ( y = 0; y <= 256; y += 16 )
301                 {
302                     for ( u = 0; u <= 256; u += 32 )
303                     for ( v = 0; v <= 256; v += 32 )
304                     {
305                         int u2, v2;
306                         int dist, mindist = 100000000;
307
308                         if( lookup[i] || y==0)
309                         {
310                             i++;
311                             continue;
312                         }
313
314                         /* heavy. yeah. */
315                         for( u2 = 0; u2 <= 256; u2 += 32 )
316                         for( v2 = 0; v2 <= 256; v2 += 32 )
317                         {
318                             j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
319                             dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
320                             if( lookup[j] )
321                             /* find the nearest color */
322                             if( dist < mindist )
323                             {
324                                 p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
325                                 mindist = dist;
326                             }
327                             j -= 128;
328                             if( lookup[j] )
329                             /* find the nearest color */
330                             if( dist + 128 < mindist )
331                             {
332                                 p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
333                                 mindist = dist + 128;
334                             }
335                         }
336                         i++;
337                     }
338                     i += 128-81;
339                 }
340
341                 break;
342             }
343         case 2:
344             p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
345             for( i_index = 0; i_index < RED_MARGIN; i_index++ )
346             {
347                 p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
348                 p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
349             }
350             for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
351             {
352                 p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
353                 p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
354             }
355             for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
356             {
357                 p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
358                 p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
359             }
360             for( i_index = 0; i_index < 256; i_index++ )
361             {
362                 p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
363                 p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
364                 p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
365             }
366             break;
367         case 3:
368         case 4:
369             p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
370             for( i_index = 0; i_index < RED_MARGIN; i_index++ )
371             {
372                 p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
373                 p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
374             }
375             for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
376             {
377                 p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
378                 p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
379             }
380             for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
381             {
382                 p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
383                 p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
384             }
385             for( i_index = 0; i_index < 256; i_index++ )
386             {
387                 p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
388                 p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
389                 p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
390             }
391             break;
392         }
393     }
394
395     /*
396      * Set functions pointers
397      */
398     if( p_vout->b_grayscale )
399     {
400         /* Grayscale */
401         switch( p_vout->i_bytes_per_pixel )
402         {
403         case 1:
404             p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray8;
405             p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray8;
406             p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray8;
407             break;
408         case 2:
409             p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
410             p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray16;
411             p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray16;
412             break;
413         case 3:
414             p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray24;
415             p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray24;
416             p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray24;
417             break;
418         case 4:
419             p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray32;
420             p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray32;
421             p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray32;
422             break;
423         }
424     }
425     else
426     {
427         /* Color */
428         switch( p_vout->i_bytes_per_pixel )
429         {
430         case 1:
431             p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB8;
432             p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB8;
433             p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB8;
434             break;
435         case 2:
436             p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB16;
437             p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB16;
438             p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB16;
439             break;
440         case 3:
441             p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB24;
442             p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB24;
443             p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB24;
444             break;
445         case 4:
446             p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB32;
447             p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB32;
448             p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB32;
449             break;
450         }
451     }
452 }
453
454 /*****************************************************************************
455  * SetOffset: build offset array for conversion functions
456  *****************************************************************************
457  * This function will build an offset array used in later conversion functions.
458  * It will also set horizontal and vertical scaling indicators. If b_double
459  * is set, the p_offset structure has interleaved Y and U/V offsets.
460  *****************************************************************************/
461 void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
462                 boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset,
463                 boolean_t b_double )
464 {
465     int i_x;                                    /* x position in destination */
466     int i_scale_count;                                     /* modulo counter */
467
468     /*
469      * Prepare horizontal offset array
470      */
471     if( i_pic_width - i_width == 0 )
472     {
473         /* No horizontal scaling: YUV conversion is done directly to picture */
474         *pb_h_scaling = 0;
475     }
476     else if( i_pic_width - i_width > 0 )
477     {
478         /* Prepare scaling array for horizontal extension */
479         *pb_h_scaling = 1;
480         i_scale_count = i_pic_width;
481         if( !b_double )
482         {
483             for( i_x = i_width; i_x--; )
484             {
485                 while( (i_scale_count -= i_width) > 0 )
486                 {
487                     *p_offset++ = 0;
488                 }
489                 *p_offset++ = 1;
490                 i_scale_count += i_pic_width;
491             }
492         }
493         else
494         {
495             int i_dummy = 0;
496             for( i_x = i_width; i_x--; )
497             {
498                 while( (i_scale_count -= i_width) > 0 )
499                 {
500                     *p_offset++ = 0;
501                     *p_offset++ = 0;
502                 }
503                 *p_offset++ = 1;
504                 *p_offset++ = i_dummy;
505                 i_dummy = 1 - i_dummy;
506                 i_scale_count += i_pic_width;
507             }
508         }
509     }
510     else /* if( i_pic_width - i_width < 0 ) */
511     {
512         /* Prepare scaling array for horizontal reduction */
513         *pb_h_scaling = 1;
514         i_scale_count = i_width;
515         if( !b_double )
516         {
517            for( i_x = i_pic_width; i_x--; )
518             {
519                 *p_offset = 1;
520                 while( (i_scale_count -= i_pic_width) > 0 )
521                 {
522                     *p_offset += 1;
523                 }
524                 p_offset++;
525                 i_scale_count += i_width;
526             }
527         }
528         else
529         {
530             int i_remainder = 0;
531             int i_jump;
532             for( i_x = i_pic_width; i_x--; )
533             {
534                 i_jump = 1;
535                 while( (i_scale_count -= i_pic_width) > 0 )
536                 {
537                     i_jump += 1;
538                 }
539                 *p_offset++ = i_jump;
540                 *p_offset++ = ( i_jump += i_remainder ) >> 1;
541                 i_remainder = i_jump & 1;
542                 i_scale_count += i_width;
543             }
544         }
545      }
546
547     /*
548      * Set vertical scaling indicator
549      */
550     if( i_pic_height - i_height == 0 )
551     {
552         *pi_v_scaling = 0;
553     }
554     else if( i_pic_height - i_height > 0 )
555     {
556         *pi_v_scaling = 1;
557     }
558     else /* if( i_pic_height - i_height < 0 ) */
559     {
560         *pi_v_scaling = -1;
561     }
562 }
563