~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/video/renderyuv.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
                         int src_x, int src_y,
165
165
                         unsigned int src_w, unsigned int src_h,
166
166
                         int dest_x, int dest_y,
167
 
                         int pal_mode)
 
167
                         int pal_blur)
168
168
{
169
169
  unsigned int x, y;
170
170
  unsigned int YUVm1, YUV0, YUV1, YUV2;
173
173
  YUV_avg* line;
174
174
  unsigned int *dest = (unsigned int *)(image->data + image->offsets[0]);
175
175
  int dest_pitch = image->pitches[0]/4;
 
176
  int pal_sharp = 256 - (pal_blur << 1);
176
177
 
177
178
  /* Normalize to 2x1 blocks. */
178
179
  if (dest_x & 1) {
264
265
      /* Read next two pixels. */
265
266
      YUV1 = src_color[*++src];
266
267
      YUV2 = src_color[*++src];
267
 
/*
268
 
      if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
269
 
        line->Y0 = (Y(YUVm1) + (Y(YUV0) << 1) + Y(YUV1)) >> 2;
270
 
        line->Y1 = (Y(YUV0) + (Y(YUV1) << 1) + Y(YUV2)) >> 2;
271
 
      }
272
 
      else */
273
 
          { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
274
 
        line->Y0 = Y(YUV0);
275
 
        line->Y1 = Y(YUV1);
276
 
      }
 
268
      line->Y0 = (Y(YUV0)*pal_sharp + (Y(YUVm1) + Y(YUV1))*pal_blur) >> 8;
 
269
      line->Y1 = (Y(YUV1)*pal_sharp + (Y(YUV0) + Y(YUV2))*pal_blur) >> 8;
277
270
      line->U = U(YUVm1) + U(YUV0) + U(YUV1) + U(YUV2);
278
271
      line->V = V(YUVm1) + V(YUV0) + V(YUV1) + V(YUV2);
279
272
 
290
283
    else {
291
284
      YUV2 = src_color[*src++];
292
285
    }
293
 
/*
294
 
    if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
295
 
      line->Y0 = (Y(YUVm1) + (Y(YUV0) << 1) + Y(YUV1)) >> 2;
296
 
      line->Y1 = (Y(YUV0) + (Y(YUV1) << 1) + Y(YUV2)) >> 2;
297
 
    }
298
 
    else */
299
 
        { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
300
 
      line->Y0 = Y(YUV0);
301
 
      line->Y1 = Y(YUV1);
302
 
    }
 
286
    line->Y0 = (Y(YUV0)*pal_sharp + (Y(YUVm1) + Y(YUV1))*pal_blur) >> 8;
 
287
    line->Y1 = (Y(YUV1)*pal_sharp + (Y(YUV0) + Y(YUV2))*pal_blur) >> 8;
303
288
    line->U = U(YUVm1) + U(YUV0) + U(YUV1) + U(YUV2);
304
289
    line->V = V(YUVm1) + V(YUV0) + V(YUV1) + V(YUV2);
305
290
    src += src_pitch - src_w;
332
317
                            int src_x, int src_y,
333
318
                            unsigned int src_w, unsigned int src_h,
334
319
                            int dest_x, int dest_y,
335
 
                            int pal_mode,
 
320
                            int pal_blur,
336
321
                            int double_scan, int pal_scanline_shade)
337
322
{
338
323
  unsigned int x, y;
342
327
  YUV_avg* line;
343
328
  unsigned int *dest = (unsigned int *)(image->data + image->offsets[0]);
344
329
  int dest_pitch = image->pitches[0]/4;
 
330
  int pal_sharp = 256 - (pal_blur << 1);
345
331
 
346
332
  /* No need to normalize to 2x1 blocks because of size doubling. */
347
333
 
427
413
    for (x = 0; x < src_w - 1; x++) {
428
414
      /* Read next pixel. */
429
415
      YUV1 = src_color[*++src];
430
 
/*
431
 
      if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
432
 
        line->Y0 = (Y(YUVm1) + (Y(YUV0) << 1) + Y(YUV1)) >> 2;
433
 
      }
434
 
      else */
435
 
          { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
436
 
        line->Y0 = Y(YUV0);
437
 
      }
 
416
      line->Y0 = (Y(YUV0)*pal_sharp + (Y(YUVm1) + Y(YUV1))*pal_blur) >> 8;
438
417
      line->U = U(YUVm2) + U(YUVm1) + U(YUV0) + U(YUV1);
439
418
      line->V = V(YUVm2) + V(YUVm1) + V(YUV0) + V(YUV1);
440
419
 
451
430
    else {
452
431
      YUV1 = src_color[*src++];
453
432
    }
454
 
/*
455
 
    if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
456
 
      line->Y0 = (Y(YUVm1) + (Y(YUV0) << 1) + Y(YUV1)) >> 2;
457
 
    }
458
 
    else */
459
 
        { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
460
 
      line->Y0 = Y(YUV0);
461
 
    }
 
433
    line->Y0 = (Y(YUV0)*pal_sharp + (Y(YUVm1) + Y(YUV1))*pal_blur) >> 8;
462
434
    line->U = U(YUVm2) + U(YUVm1) + U(YUV0) + U(YUV1);
463
435
    line->V = V(YUVm2) + V(YUVm1) + V(YUV0) + V(YUV1);
464
436
    src += src_pitch - src_w;
622
594
                         int src_x, int src_y,
623
595
                         unsigned int src_w, unsigned int src_h,
624
596
                         int dest_x, int dest_y,
625
 
                         int pal_mode)
 
597
                         int pal_blur)
626
598
{
627
599
  unsigned int x, y;
628
600
  unsigned int
634
606
  int Ypitch = image->pitches[plane_y];
635
607
  int Upitch = image->pitches[plane_u];
636
608
  int Vpitch = image->pitches[plane_v];
 
609
  int pal_sharp = 256 - (pal_blur << 1);
637
610
 
638
611
  /* Normalize to 2x2 blocks. */
639
612
  if (dest_x & 1) {
690
663
      YUV11 = src_color[*(src + src_pitch + 1)];
691
664
      YUV21 = src_color[*(src + src_pitch + 2)];
692
665
      src += 2;
693
 
/*
694
 
      if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
695
 
        *Yptr =               (Y(YUVm10) + (Y(YUV00) << 1) + Y(YUV10)) >> 2;
696
 
        *(Yptr + 1) =          (Y(YUV00) + (Y(YUV10) << 1) + Y(YUV20)) >> 2;
697
 
        *(Yptr + Ypitch) =    (Y(YUVm11) + (Y(YUV01) << 1) + Y(YUV11)) >> 2;
698
 
        *(Yptr + Ypitch + 1) = (Y(YUV01) + (Y(YUV11) << 1) + Y(YUV21)) >> 2;
699
 
      }
700
 
      else */
701
 
          { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
702
 
        *Yptr = Y(YUV00);
703
 
        *(Yptr + 1) = Y(YUV10);
704
 
        *(Yptr + Ypitch) = Y(YUV01);
705
 
        *(Yptr + Ypitch + 1) = Y(YUV11);
706
 
      }
 
666
      *Yptr =               (Y(YUV00)*pal_sharp + (Y(YUVm10) + Y(YUV10))*pal_blur) >> 8;
 
667
      *(Yptr + 1) =          (Y(YUV10)*pal_sharp + (Y(YUV00) + Y(YUV20))*pal_blur) >> 8;
 
668
      *(Yptr + Ypitch) =    (Y(YUV01)*pal_sharp + (Y(YUVm11) + Y(YUV11))*pal_blur) >> 8;
 
669
      *(Yptr + Ypitch + 1) = (Y(YUV11)*pal_sharp + (Y(YUV01) + Y(YUV21))*pal_blur) >> 8;
707
670
      Yptr += 2;
708
671
      *Uptr++ =
709
672
        (U(YUVm10) + U(YUV00) + U(YUV10) + U(YUV20) +
728
691
      YUV21 = src_color[*(src + src_pitch + 2)];
729
692
    }
730
693
    src += 2;
731
 
/*
732
 
    if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
733
 
      *Yptr =               (Y(YUVm10) + (Y(YUV00) << 1) + Y(YUV10)) >> 2;
734
 
      *(Yptr + 1) =          (Y(YUV00) + (Y(YUV10) << 1) + Y(YUV20)) >> 2;
735
 
      *(Yptr + Ypitch) =    (Y(YUVm11) + (Y(YUV01) << 1) + Y(YUV11)) >> 2;
736
 
      *(Yptr + Ypitch + 1) = (Y(YUV01) + (Y(YUV11) << 1) + Y(YUV21)) >> 2;
737
 
    }
738
 
    else */
739
 
        { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
740
 
      *Yptr = Y(YUV00);
741
 
      *(Yptr + 1) = Y(YUV10);
742
 
      *(Yptr + Ypitch) = Y(YUV01);
743
 
      *(Yptr + Ypitch + 1) = Y(YUV11);
744
 
    }
 
694
    *Yptr =               (Y(YUV00)*pal_sharp + (Y(YUVm10) + Y(YUV10))*pal_blur) >> 8;
 
695
    *(Yptr + 1) =          (Y(YUV10)*pal_sharp + (Y(YUV00) + Y(YUV20))*pal_blur) >> 8;
 
696
    *(Yptr + Ypitch) =    (Y(YUV01)*pal_sharp + (Y(YUVm11) + Y(YUV11))*pal_blur) >> 8;
 
697
    *(Yptr + Ypitch + 1) = (Y(YUV11)*pal_sharp + (Y(YUV01) + Y(YUV21))*pal_blur) >> 8;
745
698
    Yptr += 2;
746
699
    *Uptr++ =
747
700
      (U(YUVm10) + U(YUV00) + U(YUV10) + U(YUV20) +
767
720
                            int src_x, int src_y,
768
721
                            unsigned int src_w, unsigned int src_h,
769
722
                            int dest_x, int dest_y,
770
 
                            int pal_mode,
 
723
                            int pal_blur,
771
724
                            int double_scan, int pal_scanline_shade)
772
725
{
773
726
  unsigned int x, y;
781
734
  int Ypitch = image->pitches[plane_y];
782
735
  int Upitch = image->pitches[plane_u];
783
736
  int Vpitch = image->pitches[plane_v];
 
737
  int pal_sharp = 256 - (pal_blur << 1);
784
738
 
785
739
  /* No need to normalize to 2x2 blocks because of size doubling. */
786
740
 
868
822
    for (x = 0; x < src_w - 1; x++) {
869
823
      /* Read next pixel. */
870
824
      YUV1 = src_color[*++src];
871
 
/*
872
 
      if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
873
 
        line->Y0 = (Y(YUVm1) + (Y(YUV0) << 1) + Y(YUV1)) >> 2;
874
 
      }
875
 
      else */
876
 
          { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
877
 
        line->Y0 = Y(YUV0);
878
 
      }
 
825
      line->Y0 = (Y(YUV0)*pal_sharp + (Y(YUVm1) + Y(YUV1))*pal_blur) >> 8;
879
826
      line->U = U(YUVm2) + U(YUVm1) + U(YUV0) + U(YUV1);
880
827
      line->V = V(YUVm2) + V(YUVm1) + V(YUV0) + V(YUV1);
881
828
 
892
839
    else {
893
840
      YUV1 = src_color[*src++];
894
841
    }
895
 
/*
896
 
    if (pal_mode == VIDEO_RESOURCE_PAL_MODE_BLUR) {
897
 
      line->Y0 = (Y(YUVm1) + (Y(YUV0) << 1) + Y(YUV1)) >> 2;
898
 
    }
899
 
    else */
900
 
        { /* pal_mode == VIDEO_RESOURCE_PAL_MODE_SHARP */
901
 
      line->Y0 = Y(YUV0);
902
 
    }
 
842
    line->Y0 = (Y(YUV0)*pal_sharp + (Y(YUVm1) + Y(YUV1))*pal_blur) >> 8;
903
843
    line->U = U(YUVm2) + U(YUVm1) + U(YUV0) + U(YUV1);
904
844
    line->V = V(YUVm2) + V(YUVm1) + V(YUV0) + V(YUV1);
905
845
    src += src_pitch - src_w;
932
872
    linepre = yuv_lines[lineno];
933
873
  }
934
874
}
935