~ubuntu-branches/ubuntu/gutsy/vtk/gutsy

« back to all changes in this revision

Viewing changes to Utilities/vtkmpeg2encode/writepic.c

  • Committer: Bazaar Package Importer
  • Author(s): Michele Angrisano
  • Date: 2007-06-30 22:39:48 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070630223948-6tn51upaurwfrcz8
Tags: 5.0.3-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add export SHELL=/bin/bash in debian/rules.
  - Update maintainer in field debian/control.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* writepic.c, write reconstructed pictures                                 */
2
 
 
3
 
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
4
 
 
5
 
/*
6
 
 * Disclaimer of Warranty
7
 
 *
8
 
 * These software programs are available to the user without any license fee or
9
 
 * royalty on an "as is" basis.  The MPEG Software Simulation Group disclaims
10
 
 * any and all warranties, whether express, implied, or statuary, including any
11
 
 * implied warranties or merchantability or of fitness for a particular
12
 
 * purpose.  In no event shall the copyright-holder be liable for any
13
 
 * incidental, punitive, or consequential damages of any kind whatsoever
14
 
 * arising from the use of these programs.
15
 
 *
16
 
 * This disclaimer of warranty extends to the user of these programs and user's
17
 
 * customers, employees, agents, transferees, successors, and assigns.
18
 
 *
19
 
 * The MPEG Software Simulation Group does not represent or warrant that the
20
 
 * programs furnished hereunder are free of infringement of any third-party
21
 
 * patents.
22
 
 *
23
 
 * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
24
 
 * are subject to royalty fees to patent holders.  Many of these patents are
25
 
 * general enough such that they are unavoidable regardless of implementation
26
 
 * design.
27
 
 *
28
 
 */
29
 
 
30
 
#include <stdio.h>
31
 
#include <stdlib.h>
32
 
#include "mpeg2enc_config.h"
33
 
#include "mpeg2enc_global.h"
34
 
 
35
 
void MPEG2_writeframe(fname,frame,mpeg2_struct)
36
 
char *fname;
37
 
unsigned char *frame[];
38
 
struct MPEG2_structure *mpeg2_struct;
39
 
{
40
 
  int chrom_hsize, chrom_vsize;
41
 
  char name[128];
42
 
  FILE *fd;
43
 
 
44
 
  chrom_hsize = (mpeg2_struct->chroma_format==CHROMA444) ? mpeg2_struct->horizontal_size
45
 
                                           : mpeg2_struct->horizontal_size>>1;
46
 
 
47
 
  chrom_vsize = (mpeg2_struct->chroma_format!=CHROMA420) ? mpeg2_struct->vertical_size
48
 
                                           : mpeg2_struct->vertical_size>>1;
49
 
 
50
 
  if (fname[0]=='-')
51
 
    return;
52
 
 
53
 
  /* Y */
54
 
  sprintf(name,"%s.Y",fname);
55
 
  if (!(fd = fopen(name,"wb")))
56
 
  {
57
 
    sprintf(mpeg2_struct->errortext,"Couldn't create %s\n",name);
58
 
    (*(mpeg2_struct->report_error))(mpeg2_struct->errortext);
59
 
  }
60
 
  fwrite(frame[0],1,mpeg2_struct->horizontal_size*mpeg2_struct->vertical_size,fd);
61
 
  fclose(fd);
62
 
 
63
 
  /* Cb */
64
 
  sprintf(name,"%s.U",fname);
65
 
  if (!(fd = fopen(name,"wb")))
66
 
  {
67
 
    sprintf(mpeg2_struct->errortext,"Couldn't create %s\n",name);
68
 
    (*(mpeg2_struct->report_error))(mpeg2_struct->errortext);
69
 
  }
70
 
  fwrite(frame[1],1,chrom_hsize*chrom_vsize,fd);
71
 
  fclose(fd);
72
 
 
73
 
  /* Cr */
74
 
  sprintf(name,"%s.V",fname);
75
 
  if (!(fd = fopen(name,"wb")))
76
 
  {
77
 
    sprintf(mpeg2_struct->errortext,"Couldn't create %s\n",name);
78
 
    (*(mpeg2_struct->report_error))(mpeg2_struct->errortext);
79
 
  }
80
 
  fwrite(frame[2],1,chrom_hsize*chrom_vsize,fd);
81
 
  fclose(fd);
82
 
}