[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 529, Mon Sep 23 10:59:10 2002 UTC revision 530, Mon Sep 23 20:36:02 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 165  Line 174 
174          src = image->y;          src = image->y;
175    
176          for (i = 0; i < EDGE_SIZE; i++) {          for (i = 0; i < EDGE_SIZE; i++) {
177  /*              // if interlacing, edges contain top-most data from each field                  // if interlacing, edges contain top-most data from each field
178                  if (interlacing && (i & 1)) {                  if (interlacing && (i & 1)) {
179                          memset(dst, *(src + edged_width), EDGE_SIZE);                          memset(dst, *(src + edged_width), EDGE_SIZE);
180                          memcpy(dst + EDGE_SIZE, src + edged_width, width);                          memcpy(dst + EDGE_SIZE, src + edged_width, width);
181                          memset(dst + edged_width - EDGE_SIZE,                          memset(dst + edged_width - EDGE_SIZE,
182                                     *(src + edged_width + width - 1), EDGE_SIZE);                                     *(src + edged_width + width - 1), EDGE_SIZE);
183                  } else {*/                  } else {
184                          memset(dst, *src, EDGE_SIZE);                          memset(dst, *src, EDGE_SIZE);
185                          memcpy(dst + EDGE_SIZE, src, width);                          memcpy(dst + EDGE_SIZE, src, width);
186                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),
187                                     EDGE_SIZE);                                     EDGE_SIZE);
188                  /*}*/                  }
189                  dst += edged_width;                  dst += edged_width;
190          }          }
191    
# Line 189  Line 198 
198    
199          src -= edged_width;          src -= edged_width;
200          for (i = 0; i < EDGE_SIZE; i++) {          for (i = 0; i < EDGE_SIZE; i++) {
201  /*              // if interlacing, edges contain bottom-most data from each field                  // if interlacing, edges contain bottom-most data from each field
202                  if (interlacing && !(i & 1)) {                  if (interlacing && !(i & 1)) {
203                          memset(dst, *(src - edged_width), EDGE_SIZE);                          memset(dst, *(src - edged_width), EDGE_SIZE);
204                          memcpy(dst + EDGE_SIZE, src - edged_width, width);                          memcpy(dst + EDGE_SIZE, src - edged_width, width);
205                          memset(dst + edged_width - EDGE_SIZE,                          memset(dst + edged_width - EDGE_SIZE,
206                                     *(src - edged_width + width - 1), EDGE_SIZE);                                     *(src - edged_width + width - 1), EDGE_SIZE);
207                  } else {*/                  } else {
208                          memset(dst, *src, EDGE_SIZE);                          memset(dst, *src, EDGE_SIZE);
209                          memcpy(dst + EDGE_SIZE, src, width);                          memcpy(dst + EDGE_SIZE, src, width);
210                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),                          memset(dst + edged_width - EDGE_SIZE, *(src + width - 1),
211                                     EDGE_SIZE);                                     EDGE_SIZE);
212                  /*}*/                  }
213                  dst += edged_width;                  dst += edged_width;
214          }          }
215    
# Line 261  Line 270 
270          }          }
271  }  }
272    
273    // bframe encoding requires image-based u,v interpolation
 // image-based y,u,v interpolation  
274  void  void
275  image_interpolate(const IMAGE * refn,  image_interpolate(const IMAGE * refn,
276                                    IMAGE * refh,                                    IMAGE * refh,
# Line 275  Line 283 
283          const uint32_t offset = EDGE_SIZE * (edged_width + 1);          const uint32_t offset = EDGE_SIZE * (edged_width + 1);
284          const uint32_t stride_add = 7 * edged_width;          const uint32_t stride_add = 7 * edged_width;
285    
286          /* --- u,v-image-based interpolation ---  #ifdef BFRAMES
287          const uint32_t edged_width2 = edged_width / 2;          const uint32_t edged_width2 = edged_width / 2;
288          const uint32_t edged_height2 = edged_height / 2;          const uint32_t edged_height2 = edged_height / 2;
289          const uint32_t offset2 = EDGE_SIZE2 * (edged_width2 + 1);          const uint32_t offset2 = EDGE_SIZE2 * (edged_width2 + 1);
290          const uint32_t stride_add2 = 7 * edged_width2;          const uint32_t stride_add2 = 7 * edged_width2;
291          */  #endif
292    
293          uint8_t *n_ptr, *h_ptr, *v_ptr, *hv_ptr;          uint8_t *n_ptr, *h_ptr, *v_ptr, *hv_ptr;
294          uint32_t x, y;          uint32_t x, y;
# Line 296  Line 304 
304          v_ptr -= offset;          v_ptr -= offset;
305          hv_ptr -= offset;          hv_ptr -= offset;
306    
307          for (y = 0; y < edged_height; y = y + 8) {          for (y = 0; y < edged_height; y += 8) {
308                  for (x = 0; x < edged_width; x = x + 8) {                  for (x = 0; x < edged_width; x += 8) {
309                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width, rounding);                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width, rounding);
310                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width, rounding);                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width, rounding);
311                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width, rounding);                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width, rounding);
# Line 312  Line 320 
320                  hv_ptr += stride_add;                  hv_ptr += stride_add;
321                  n_ptr += stride_add;                  n_ptr += stride_add;
322          }          }
323    /*
324  /* --- u,v-image-based interpolation ---  #ifdef BFRAMES
325          n_ptr = refn->u;          n_ptr = refn->u;
326          h_ptr = refh->u;          h_ptr = refh->u;
327          v_ptr = refv->u;          v_ptr = refv->u;
# Line 324  Line 332 
332          v_ptr -= offset2;          v_ptr -= offset2;
333          hv_ptr -= offset2;          hv_ptr -= offset2;
334    
335          for (y = 0; y < edged_height2; y = y + 8) {          for (y = 0; y < edged_height2; y += 8) {
336                  for (x = 0; x < edged_width2; x = x + 8) {                  for (x = 0; x < edged_width2; x += 8) {
337                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width2, rounding);                          interpolate8x8_halfpel_h(h_ptr, n_ptr, edged_width2, rounding);
338                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width2, rounding);                          interpolate8x8_halfpel_v(v_ptr, n_ptr, edged_width2, rounding);
339                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width2, rounding);                          interpolate8x8_halfpel_hv(hv_ptr, n_ptr, edged_width2, rounding);
# Line 367  Line 375 
375                  hv_ptr += stride_add2;                  hv_ptr += stride_add2;
376                  n_ptr += stride_add2;                  n_ptr += stride_add2;
377          }          }
378    #endif
379    */
380            /*
381               interpolate_halfpel_h(
382               refh->y - offset,
383               refn->y - offset,
384               edged_width, edged_height,
385               rounding);
386    
387               interpolate_halfpel_v(
388               refv->y - offset,
389               refn->y - offset,
390               edged_width, edged_height,
391               rounding);
392    
393               interpolate_halfpel_hv(
394               refhv->y - offset,
395               refn->y - offset,
396               edged_width, edged_height,
397               rounding);
398             */
399    
400            /* uv-image-based compensation
401               offset = EDGE_SIZE2 * (edged_width / 2 + 1);
402    
403               interpolate_halfpel_h(
404               refh->u - offset,
405               refn->u - offset,
406               edged_width / 2, edged_height / 2,
407               rounding);
408    
409               interpolate_halfpel_v(
410               refv->u - offset,
411               refn->u - offset,
412               edged_width / 2, edged_height / 2,
413               rounding);
414    
415               interpolate_halfpel_hv(
416               refhv->u - offset,
417               refn->u - offset,
418               edged_width / 2, edged_height / 2,
419               rounding);
420    
421    
422               interpolate_halfpel_h(
423               refh->v - offset,
424               refn->v - offset,
425               edged_width / 2, edged_height / 2,
426               rounding);
427    
428               interpolate_halfpel_v(
429               refv->v - offset,
430               refn->v - offset,
431               edged_width / 2, edged_height / 2,
432               rounding);
433    
434               interpolate_halfpel_hv(
435               refhv->v - offset,
436               refn->v - offset,
437               edged_width / 2, edged_height / 2,
438               rounding);
439  */  */
440  }  }
441    

Legend:
Removed from v.529  
changed lines
  Added in v.530

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