[svn] / branches / dev-api-3 / xvidcore / src / image / image.c Repository:
ViewVC logotype

Diff of /branches/dev-api-3/xvidcore/src/image/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 449, Sun Sep 8 09:49:55 2002 UTC revision 543, Thu Sep 26 01:54:54 2002 UTC
# Line 3  Line 3 
3   *      XVID MPEG-4 VIDEO CODEC   *      XVID MPEG-4 VIDEO CODEC
4   *      image stuff   *      image stuff
5   *   *
6     *      This program is an implementation of a part of one or more MPEG-4
7     *      Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
8     *      to use this software module in hardware or software products are
9     *      advised that its use may infringe existing patents or copyrights, and
10     *      any such use would be at such party's own risk.  The original
11     *      developer of this software module and his/her company, and subsequent
12     *      editors and their companies, will have no liability for use of this
13     *      software or modifications or derivatives thereof.
14     *
15   *      This program is free software; you can redistribute it and/or modify   *      This program is free software; you can redistribute it and/or modify
16   *      it under the terms of the GNU General Public License as published by   *      it under the terms of the GNU General Public License as published by
17   *      the Free Software Foundation; either version 2 of the License, or   *      the Free Software Foundation; either version 2 of the License, or
# Line 151  Line 160 
160                             uint32_t edged_width,                             uint32_t edged_width,
161                             uint32_t edged_height,                             uint32_t edged_height,
162                             uint32_t width,                             uint32_t width,
163                             uint32_t height,                             uint32_t height)
                            uint32_t interlacing)  
164  {  {
165          const uint32_t edged_width2 = edged_width / 2;          const uint32_t edged_width2 = edged_width / 2;
166          const uint32_t width2 = width / 2;          const uint32_t width2 = width / 2;
# Line 165  Line 173 
173          src = image->y;          src = image->y;
174    
175          for (i = 0; i < EDGE_SIZE; i++) {          for (i = 0; i < EDGE_SIZE; i++) {
 /*              // if interlacing, edges contain top-most data from each field  
                 if (interlacing && (i & 1)) {  
                         memset(dst, *(src + edged_width), EDGE_SIZE);  
                         memcpy(dst + EDGE_SIZE, src + edged_width, width);  
                         memset(dst + edged_width - EDGE_SIZE,  
                                    *(src + edged_width + width - 1), EDGE_SIZE);  
                 } else {*/  
176                          memset(dst, *src, EDGE_SIZE);                          memset(dst, *src, EDGE_SIZE);
177                          memcpy(dst + EDGE_SIZE, src, width);                          memcpy(dst + EDGE_SIZE, src, width);
178                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),
179                                     EDGE_SIZE);                                     EDGE_SIZE);
                 /*}*/  
180                  dst += edged_width;                  dst += edged_width;
181          }          }
182    
# Line 189  Line 189 
189    
190          src -= edged_width;          src -= edged_width;
191          for (i = 0; i < EDGE_SIZE; i++) {          for (i = 0; i < EDGE_SIZE; i++) {
 /*              // if interlacing, edges contain bottom-most data from each field  
                 if (interlacing && !(i & 1)) {  
                         memset(dst, *(src - edged_width), EDGE_SIZE);  
                         memcpy(dst + EDGE_SIZE, src - edged_width, width);  
                         memset(dst + edged_width - EDGE_SIZE,  
                                    *(src - edged_width + width - 1), EDGE_SIZE);  
                 } else {*/  
192                          memset(dst, *src, EDGE_SIZE);                          memset(dst, *src, EDGE_SIZE);
193                          memcpy(dst + EDGE_SIZE, src, width);                          memcpy(dst + EDGE_SIZE, src, width);
194                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),
195                                     EDGE_SIZE);                                     EDGE_SIZE);
                 /*}*/  
196                  dst += edged_width;                  dst += edged_width;
197          }          }
198    
# Line 261  Line 253 
253          }          }
254  }  }
255    
256    // bframe encoding requires image-based u,v interpolation
 // image-based y,u,v interpolation  
257  void  void
258  image_interpolate(const IMAGE * refn,  image_interpolate(const IMAGE * refn,
259                                    IMAGE * refh,                                    IMAGE * refh,
# Line 275  Line 266 
266          const uint32_t offset = EDGE_SIZE * (edged_width + 1);          const uint32_t offset = EDGE_SIZE * (edged_width + 1);
267          const uint32_t stride_add = 7 * edged_width;          const uint32_t stride_add = 7 * edged_width;
268    
269          /* --- u,v-image-based interpolation ---  #ifdef BFRAMES
270          const uint32_t edged_width2 = edged_width / 2;          const uint32_t edged_width2 = edged_width / 2;
271          const uint32_t edged_height2 = edged_height / 2;          const uint32_t edged_height2 = edged_height / 2;
272          const uint32_t offset2 = EDGE_SIZE2 * (edged_width2 + 1);          const uint32_t offset2 = EDGE_SIZE2 * (edged_width2 + 1);
273          const uint32_t stride_add2 = 7 * edged_width2;          const uint32_t stride_add2 = 7 * edged_width2;
274          */  #endif
275    
276          uint8_t *n_ptr, *h_ptr, *v_ptr, *hv_ptr;          uint8_t *n_ptr, *h_ptr, *v_ptr, *hv_ptr;
277          uint32_t x, y;          uint32_t x, y;
# Line 296  Line 287 
287          v_ptr -= offset;          v_ptr -= offset;
288          hv_ptr -= offset;          hv_ptr -= offset;
289    
290          for (y = 0; y < edged_height; y = y + 8) {          for (y = 0; y < edged_height; y += 8) {
291                  for (x = 0; x < edged_width; x = x + 8) {                  for (x = 0; x < edged_width; x += 8) {
292                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width, rounding);                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width, rounding);
293                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width, rounding);                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width, rounding);
294                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width, rounding);                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width, rounding);
# Line 312  Line 303 
303                  hv_ptr += stride_add;                  hv_ptr += stride_add;
304                  n_ptr += stride_add;                  n_ptr += stride_add;
305          }          }
306    /*
307  /* --- u,v-image-based interpolation ---  #ifdef BFRAMES
308          n_ptr = refn->u;          n_ptr = refn->u;
309          h_ptr = refh->u;          h_ptr = refh->u;
310          v_ptr = refv->u;          v_ptr = refv->u;
# Line 324  Line 315 
315          v_ptr -= offset2;          v_ptr -= offset2;
316          hv_ptr -= offset2;          hv_ptr -= offset2;
317    
318          for (y = 0; y < edged_height2; y = y + 8) {          for (y = 0; y < edged_height2; y += 8) {
319                  for (x = 0; x < edged_width2; x = x + 8) {                  for (x = 0; x < edged_width2; x += 8) {
320                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width2, rounding);                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width2, rounding);
321                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width2, rounding);                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width2, rounding);
322                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width2, rounding);                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width2, rounding);
# Line 367  Line 358 
358                  hv_ptr += stride_add2;                  hv_ptr += stride_add2;
359                  n_ptr += stride_add2;                  n_ptr += stride_add2;
360          }          }
361    #endif
362    */
363            /*
364               interpolate_halfpel_h(
365               refh->y - offset,
366               refn->y - offset,
367               edged_width, edged_height,
368               rounding);
369    
370               interpolate_halfpel_v(
371               refv->y - offset,
372               refn->y - offset,
373               edged_width, edged_height,
374               rounding);
375    
376               interpolate_halfpel_hv(
377               refhv->y - offset,
378               refn->y - offset,
379               edged_width, edged_height,
380               rounding);
381             */
382    
383            /* uv-image-based compensation
384               offset = EDGE_SIZE2 * (edged_width / 2 + 1);
385    
386               interpolate_halfpel_h(
387               refh->u - offset,
388               refn->u - offset,
389               edged_width / 2, edged_height / 2,
390               rounding);
391    
392               interpolate_halfpel_v(
393               refv->u - offset,
394               refn->u - offset,
395               edged_width / 2, edged_height / 2,
396               rounding);
397    
398               interpolate_halfpel_hv(
399               refhv->u - offset,
400               refn->u - offset,
401               edged_width / 2, edged_height / 2,
402               rounding);
403    
404    
405               interpolate_halfpel_h(
406               refh->v - offset,
407               refn->v - offset,
408               edged_width / 2, edged_height / 2,
409               rounding);
410    
411               interpolate_halfpel_v(
412               refv->v - offset,
413               refn->v - offset,
414               edged_width / 2, edged_height / 2,
415               rounding);
416    
417               interpolate_halfpel_hv(
418               refhv->v - offset,
419               refn->v - offset,
420               edged_width / 2, edged_height / 2,
421               rounding);
422  */  */
423  }  }
424    

Legend:
Removed from v.449  
changed lines
  Added in v.543

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4