Patent Publication Number: US-2009237569-A1

Title: Transcoder

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a transcoder for decoding an input image into a decoded image and encoding the decoded image into an output image. 
     2. Description of the Background Art 
     Image compression techniques are widely used for reducing transmission load and storing load of image data. There are MPEG 2 and the like as conventional coding systems, and H.264 and the like as new coding systems. A transcoder executes system conversion between different coding systems for reducing transmission load and storing load of image data. 
     As a first stage, a transcoder inputs a compressed image by a first coding system to generate an extension image by the first coding system. As a second stage, the transcoder compresses the extension image by a second coding system to output a compressed image by the second coding system. 
     A transcoder can detect a scene change. For example, the transcoder can detect a fact that a moving image changes to a fine image from a flat image. When the transcoder detects a scene change, the transcoder can prevent deterioration of image quality at the time of the scene change while suppressing variation of an output code amount. For example, the transcoder can prevent deterioration of image quality at the time of a scene change while suppressing an increase in the output code amount along with the change of the moving image to a fine image from a flat image. 
     A coding apparatus compresses an input image to output a compressed image. A general coding apparatus can detect a scene change by previously reading an input image. A coding apparatus disclosed in Japanese Patent Application Laid Open Gazette No. 2001-251630 can detect a scene change by detecting variation of an output code amount. 
     A general coding apparatus detects a scene change by previously reading an input image. The coding apparatus cannot yet execute control for suppressing variation of an output code amount on an input image which is not previously read. The coding apparatus can manage to control for suppressing variation of the output code amount on a previously-read input image. The coding apparatus causes increase in circuit scale and delay in control process because the apparatus need to include a previously-read portion and a coding portion. 
     The coding apparatus disclosed in Japanese Patent Application Laid Open Gazette No. 2001-251630 can detect a scene change by detecting variation of an output code amount. The coding apparatus can no longer control for suppressing variation of the output code amount on a compressed image in which variation of the output code amount is detected. The coding apparatus can manage to control for suppressing variation of the output code amount on an input image subsequent to the compressed image in which variation of the output code amount is detected. Therefore, the coding apparatus cannot effectively prevent deterioration of image quality at the time of a scene change while effectively suppressing variation of the output code amount when the coding apparatus detects the scene change. 
     SUMMARY OF THE INVENTION 
     The present invention is directed to a transcoder for decoding an input image into a decoded image and encoding the decoded image into an output image. The transcoder according to the invention comprises a characteristic amount detection part which detects a characteristic amount of the input image, a scene change detection part which determines that when a differential value between a characteristic amount of a previous input image and a characteristic amount of a subsequent input image is larger than a predetermined characteristic amount differential value, a scene change occurs between the previous input image and the subsequent input image, a target code amount setting part which sets a target code amount of the output image based on the characteristic amount of the input image, and a target code amount correction part which corrects a target code amount of a subsequent output image by a correction code amount such that a variation from an output code amount of a previous output image corresponding to the previous input image to an output code amount of the subsequent output image corresponding to the subsequent input image when the scene change occurs. 
     According to the invention, increase in circuit scale and delay in control process can be prevented. 
     According to another aspect of the invention, the target code amount correction part includes a target code amount correction end part which ends correction of the target code amount of the output image after a first predetermined period of time since correction of the target code amount of the output image starts. 
     Deterioration of image quality at the time of the scene change of the output image can be effectively prevented while effectively suppressing variation of the output code amount, when the scene change is detected. 
     Therefore, an object of the invention is to provide a transcoder which does not cause increase in circuit scale and delay in control process. Further, another object of the invention is to provide a transcoder which effectively prevents deterioration of image quality at the time of the scene change of the output image while effectively suppressing variation of the output code amount when the scene change is detected. 
     These and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  is a block diagram showing components of a transcoder. 
         FIG. 2  is a flowchart showing a process flow of detecting a scene change. 
         FIG. 3  is a flowchart showing a process flow of setting a target code amount. 
         FIGS. 4A to 4C  are time charts showing a process flow by a transcoder. 
         FIGS. 5A to 5C  are time charts showing a process flow by a transcoder. 
         FIG. 6  is a drawing showing a picture used in detection of a scene change. 
         FIGS. 7A to 7F  are drawings showing pictures used in restart of detection of a scene change. 
     
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     {Components of a Transcoder} 
     Hereinafter, embodiments of the invention will be described with reference to drawings.  FIG. 1  is a block diagram showing components of a transcoder  1 . The transcoder  1  comprises a decoder  11 , an encoder  12 , an activity detection part  114  and the like. 
     The decoder  11  inputs an input image from an outside of the transcoder  1 . The input image is decoded into a decoded image by a coding system to which the decoder  11  handles. The decoder  11  outputs the decoded image to the encoder  12 . 
     The encoder  12  inputs the decoded image from the decoder  11 . The decoded image is encoded into an output image by a coding system to which the encoder  12  handles. The encoder  12  outputs the output image to the outside of the transcoder  1 . 
     The decoder  11  comprises a decoded image generation part  111 , a quantization step average value detection part  112 , an input image code amount detection part  113  and the like. The encoder  12  comprises a frequency conversion part  121 , a quantization part  122 , a coding part  123 , a scene change detection part  124 , a target code amount setting part  125 , a quantization step value setting part  126  and the like. 
     The decoded image generation part  111  generates a decoded image by executing decoding, inverse-quantization and inverse-frequency-conversion on the input image. 
     The quantization step average value detection part  112  detects a quantization step average value of the input image. The quantization step average value will be described later with reference to  FIG. 2 . 
     The input image code amount detection part  113  detects an input image code amount of the input image. The input image code amount will be described later with reference to  FIG. 2 . 
     The activity detection part  114  detects an activity of the decoded image. The activity will be described later with reference to  FIG. 2 . 
     The frequency conversion part  121  executes frequency conversion on the decoded image. The quantization part  122  executes quantization on the decoded image on which frequency conversion is executed, based on the quantization step value set by a quantization step value setting part  126  which will be described later. The coding part  123  executes encoding on the decoded image on which frequency conversion and quantization are executed. 
     The scene change detection part  124  detects a scene change based on the activity, the quantization step average value, and the input image code amount. For example, the scene change detection part  124  detects a fact that a moving image changes to a fine image from a flat image. 
     The target code amount setting part  125  sets a target code amount based on scene change information. For example, the target code amount setting part  125  executes reduction correction by a correction code amount on the target code amount previously set for suppressing an increase in the output code amount when the moving image changes to the fine image from the flat image. 
     The quantization step value setting part  126  sets a quantization step value based on the target code amount. For example, the quantization step value setting part  126  sets the quantization step value such that the quantization step value is not drastically small because the increase in the output code amount is suppressed when the moving image changes to the fine image from the flat image. 
     {Process Flow of Detection of Scene Change} 
       FIG. 2  is a flowchart showing a process flow of detecting a scene change. The scene change detection part  124  compares a fineness degree of a previous input image with that of a subsequent input image which is input subsequently to the previous input image. The scene change detection part  124  determines that the scene change occurs between the previous input image and the subsequent input image when the fineness degree of the subsequent input image largely changes from that of the previous input image. The scene change detection part  124  determines that a scene change does not occur between the previous input image and the subsequent input image when the fineness degree of the subsequent input image does not largely change from that of the previous input image. 
     The scene change detection part  124  repeats comparison of the fineness degree of the subsequent input image with that of the previous input image as successive first process and second process which will be described below. 
     In the first process, the scene change detection part  124  stores information showing a fineness degree of a first input image in advance. The scene change detection part  124  newly obtains information showing a fineness degree of a second input image which is a subsequent input image of the first input image. The scene change detection part  124  compares the fineness degree of the second input image with that of the first input image. 
     In the second process, the scene change detection part  124  stores information showing the fineness degree of the second input image in advance. The scene change detection part  124  newly obtains information showing a fineness degree of a third input image which is a subsequent input image of the second input image. The scene change detection part  124  compares the fineness degree of the third input image with that of the second input image. 
     The previous input image and the subsequent input image in the first process are the first input image and the second input image, respectively. The previous input image and the subsequent input image in the second process are the second input image and the third input image, respectively. When the successive first process and second process are compared with each other, it is found that the previous input image and the subsequent input image are momentarily updated. 
     The scene change detection part  124  obtains a quantization step average value from the quantization step average value detection part  112 . The scene change detection part  124  obtains an input image code amount from the input image code amount detection part  113 . The scene change detection part  124  calculates a multiplied value by multiplying the quantization step average value by the input image code amount (step S 1 ). The quantization step average value is obtained by averaging the quantization step value in each block of the input image for the total block number of the input image. The multiplied value is an amount representing the fineness degree of the input image. 
     The scene change detection part  124  obtains an activity from the activity detection part  114  (step S 2 ). The activity is a value obtained by dividing a value obtained by summing difference absolute values between pixel values of adjacent pixels of the decoded image for all adjacent pixels by the total block number of the decoded image. The activity is an amount representing the fineness degree of the input image. 
     The scene change detection part  124  subtracts the activity of the previous input image from the activity of the subsequent input image (step S 3 ). When the subtracted value at step S 3  is larger than a positive predetermined threshold value (YES at step S 3 ), the scene change detection part  124  determines that a first scene change occurs between the previous input image and the subsequent input image (step S 8 ). When the subtracted value at step S 3  is equal to or less than the positive predetermined threshold value (NO at step S 3 ), the scene change detection part  124  proceeds to step S 4 . 
     The scene change detection part  124  subtracts the multiplied value of the previous input image from the multiplied value of the subsequent input image (step S 4 ). When the subtracted value at step S 4  is larger than a positive predetermined threshold value (YES at step S 4 ), the scene change detection part  124  determines that the first scene change occurs between the previous input image and the subsequent input image (step S 8 ). When the subtracted value at step S 4  is equal to or less than the positive predetermined threshold value (NO at step S 4 ), the scene change detection part  124  proceeds to step S 5 . 
     In the first scene change, the fineness degree of the subsequent input image is significantly higher than that of the previous input image. The scene change detection part  124  can detect the first scene change based on both the activity and the multiplied value. 
     The scene change detection part  124  subtracts the activity of the subsequent input image from the activity of the previous input image (step S 5 ). When the subtracted value at step S 5  is larger than a positive predetermined threshold value (YES at step S 5 ), the scene change detection part  124  determines that a second scene change occurs between the previous input image and the subsequent input image (step S 9 ). When the subtracted value at step S 5  is equal to or less than the positive predetermined threshold value (NO at step S 5 ), the scene change detection part  124  proceeds to step S 6 . 
     The scene change detection part  124  subtracts the multiplied value of the subsequent input image from the multiplied value of the previous input image (step S 6 ). When the subtracted value at step S 6  is larger than a positive predetermined threshold value (YES at step S 6 ), the scene change detection part  124  determines that the second scene change occurs between the previous input image and the subsequent input image (step S 9 ). When the subtracted value at step S 6  is equal to or less than the positive predetermined threshold value (NO at step S 6 ), the scene change detection part  124  determines that neither of the first scene change nor the second scene change occurs between the previous input image and the subsequent input image (step S 7 ). 
     In the second scene change, the fineness degree of the subsequent input image is significantly lower than that of the previous input image. The scene change detection part  124  can detect the second scene change based on both the activity and the multiplied value. 
     At the start of transcoding, the scene change detection part  124  does not store information of the activity to be compared with the activity of the first input image. At the start of transcoding, the scene change detection part  124  does not store information of the multiplied value to be compared with the multiplied value of the first input image. 
     The scene change detection part  124  may start, upon input of an Nth input image, comparing the activity and the multiplied value of the subsequent input image with those of the previous input image. Here, N denotes a natural number of 2 or more. 
     The scene change detection part  124  may compare an intensity of movement of the subsequent input image with an intensity of movement of the previous input image. The scene change detection part  124  may determine that the scene change occurs between the previous input image and the subsequent input image when the intensity of movement of the subsequent input image largely changes from the intensity of movement of the previous input image. The scene change detection part  124  may determine that the scene change does not occur between the previous input image and the subsequent input image when the intensity of movement of the subsequent input image does not largely change from the intensity of movement of the previous input image. 
     The intensity of movement of the input image may be a value obtained by dividing a value obtained by summing code amounts or lengths of moving vectors in each block of the input image for all blocks of the input image by the total block number of the input image. 
     {Process Flow of Target Code Amount Setting} 
       FIG. 3  is a flowchart showing a process flow of setting a target code amount. The target code amount setting part  125  obtains scene change information from the scene change detection part  124  (step S 11 ). The target code amount setting part  125  executes correction by the correction code amount on the target code amount previously set when the fineness degree of the subsequent input image is largely different in comparison with that of the previous input image. The target code amount setting part  125  holds the target code amount previously set as it is when the fineness degree of the subsequent input image is not largely different in comparison with that of the previous input image. 
     A case where the first scene change or the second scene change does not occur is discussed (NO at step S 12 ). That is to say, a case where the fineness degree of the subsequent input image is not significantly higher or lower than that of the previous input image is discussed. The target code amount setting part  125  holds the target code amount previously set as it is (step S 13 ). 
     A case where the first scene change occurs is discussed (YES at step S 12  and “FIRST” at step S 14 ). That is to say, a case where the fineness degree of the subsequent input image is significantly higher than that of the previous input image is discussed. The target code amount setting part  125  forcibly executes reduction correction by the correction code amount on the target code amount previously set (step S 15 ). That is to say, the target code amount setting part  125  tries to suppress the increase in the output code amount. Then, the target code amount setting part  125  gradually releases the forcible reduction correction with an elapse of the time after the first scene change (step S 16 ). 
     A case where the second scene change occurs is discussed (YES at step S 12  and “SECOND” at step S 14 ). That is to say, a case where the fineness degree of the subsequent input image is significantly lower than that of the previous input image is discussed. The target code amount setting part  125  forcibly executes increase correction by the correction code amount on the target code amount previously set (step S 17 ). That is to say, the target code amount setting part  125  tries to suppress a decrease in the output code amount. Then, the target code amount setting part  125  gradually releases forcible increase correction with an elapse of the time after the second scene change (step S 18 ). 
     The correction code amount is set based on a difference in the fineness degree of the input image between before and after the scene change, or a difference in the intensity of movement of the input image between before and after the scene change. 
     An absolute value of the correction code amount may be set to be larger when the difference in the fineness degree of the input image between before and after the scene change is large, or may be set to be larger when the intensity of movement of the input image between before and after the scene change is large. 
     The absolute value of the correction code amount may be set to be smaller when the difference in the fineness degree of the input image between before and after the scene change is small, or may be set to be smaller when the intensity of movement of the input image between before and after the scene change is small. 
     {First Specific Example of Process Flow by the Transcoder  1 } 
       FIGS. 4A to 4C  are time charts showing a first specific example of process flow by the transcoder  1 . Also,  FIG. 4A  is a time chart showing a time change of the activity or the multiplied value.  FIG. 4B  is a time chart showing a time change of the target code amount.  FIG. 4C  is a time chart showing a time change of the output code amount. Four dashed lines passing through  FIGS. 4A to 4C  in the vertical direction represent times T 1 , T 2 , T 3 , and T 4  in the order from the left side to the right side. 
     The activity or the multiplied value varies momentarily. However, in  FIG. 4A , the activity or the multiplied value varies only at the times T 1 , T 2 , T 3 , and T 4  for convenience of explanation. 
     In the first specific example, the target code amount previously set at step S 13 , S 15 , and S 17  is the target code amount which is set for each predetermined unit based on the fineness degree of the input image included in the predetermined unit such as a GOP unit and is not corrected. 
     By the time T 1 , the activity or the multiplied value takes a value represented by a segment A 1 . The target code amount is set to be a value represented by a segment B 1  in accordance with the value represented by the segment A 1 . The output code amount takes a value represented by a segment C 1  in accordance with the value represented by the segment B 1 . 
     At the time T 1 , the activity or the multiplied value increases by a value represented by an arrow A 12 . The increase represented by the arrow A 12  is equal to or less than the positive predetermined threshold value (NO at step S 3 , S 4 , S 5 , and S 6 ). It is determined that the scene change does not occur around the time T 1  (step S 7 , NO at step S 12 ). 
     From the time T 1  to the time T 2 , the activity or the multiplied value takes a value represented by a segment A 2 . The target code amount is set to be a value represented by a segment B 2  previously set in accordance with the value represented by the segment A 2  as it is (step S 13 ). The output code amount takes a value represented by a segment C 2  in accordance with the value represented by the segment B 2 . 
     At the time T 2 , the activity or the multiplied value increases by a value represented by an arrow A 23 . The increase represented by the arrow A 23  is larger than the positive predetermined threshold value (YES at step S 3  and S 4 ). It is determined that the first scene change occurs around the time T 2  (step S 8 , YES at step S 12 , “FIRST” at step S 14 ). 
     From the time T 2  to the time T 3 , the activity or the multiplied value takes a value represented by a segment A 3 . At the time T 2 , the target code amount is set to be a value obtained by forcibly executing reduction correction by the correction code amount represented by an arrow B 23  on a value represented by a segment B 4  previously set in accordance with the value represented by the segment A 3  (step S 15 ). The target code amount is set so as to gradually increase to the value represented by the segment B 4  from the time T 2  until an elapse of the time TB 3 , as shown in a curve B 3  (step S 16 ). The target code amount is set to be a value represented by the segment B 4  after the elapse of the time TB 3 . 
     The output code amount, at the time T 2 , takes a value obtained by adding a value represented by an arrow C 23  to a value represented by a segment C 4  instead of taking the value represented by the segment C 4  in accordance with the value represented by the segment B 4 . The output code amount gradually decreases to the value represented by the segment C 4  from the time T 2  until an elapse of the time TC 3 , as shown in a curve C 3 . The output code amount takes the value represented by the segment C 4  after the elapse of the time TC 3 . 
     Although the activity or the multiplied value increases by the value represented by the arrow A 23 , the output code amount only increases to the value represented by the arrow C 23  from the value represented by the segment C 4 . That is to say, when the transcoder  1  detects a fact that the moving image changes to the fine image from the flat image, deterioration of image quality at the time of the scene change can be prevented while the increase in the output code amount is suppressed. 
     At the time T 3 , the activity or the multiplied value decreases by a value represented by an arrow A 34 . The decrease represented by the arrow A 34  is equal to or less than the positive predetermined threshold value (NO at step S 3 , S 4 , S 5 , and S 6 ). It is determined that the scene change does not occur at the time T 3  (step S 7 , NO at step S 12 ). 
     From the time T 3  to the time T 4 , the activity or the multiplied value takes a value represented by a segment A 4 . The target code amount is set to be a value represented by a segment B 5  previously set in accordance with the value represented by the segment A 4  as it is (step S 13 ). The output code amount takes a value represented by a segment C 5  in accordance with the value represented by the segment B 5 . 
     At the time T 4 , the activity or the multiplied value decreases by a value represented by an arrow A 45 . The decrease represented by the arrow A 45  is larger than the positive predetermined threshold value (NO at step S 3  and S 4 , YES at step S 5  and S 6 ). It is determined that the second scene change occurs at the time T 4  (step S 9 , YES at step S 12 , “SECOND” at step S 14 ). 
     From the time T 4 , the activity or the multiplied value takes a value represented by a segment A 5 . The target code amount is set to be a value obtained by forcibly executing increase correction by the correction code amount represented by an arrow B 67  on a value represented by a segment B 7  previously set in accordance with the value represented by the segment A 5  at the time T 4  (step S 17 ). The target code amount is set so as to gradually decrease to the value represented by the segment B 7  from the time T 4  until an elapse of the time TB 6 , as shown in a curve B 6  (step S 18 ). The target code amount is set to be the value represented by the segment B 7  after the elapse of the time TB 6 . 
     The output code amount, at the time T 4 , takes a value obtained by subtracting a value represented by an arrow C 67  from a value represented by a segment C 7  instead of taking the value represented by the segment C 7  in accordance with the value represented by the segment B 7 . The output code amount gradually increases to the value represented by the segment C 7  from the time T 4  until an elapse of the time TC 6 , as shown in a curve C 6 . The output code amount takes the value represented by the segment C 7  after elapse of the time TC 6 . 
     Although the activity or the multiplied value decreases by the value represented by the arrow A 45 , the output code amount only decreases to the value represented by the arrow C 67  from the value represented by the segment C 7 . That is to say, when the transcoder  1  detects a fact that the moving image changes to the flat image from the fine image, deterioration of image quality at the time of the scene change can be prevented while decrease in the output code amount is suppressed. 
     {Second Specific Example of Process Flow by the Transcoder  1 } 
       FIGS. 5A to 5C  are time charts showing a second specific example of process flow by the transcoder  1 . Also,  FIG. 5A  is a time chart showing a time change of the activity or the multiplied value.  FIG. 5B  is a time chart showing a time change of the target code amount.  FIG. 5C  is a time chart showing a time change of the output code amount. Four dashed lines passing through  FIGS. 5A to 5C  in the vertical direction represent the times T 1 , T 2 , T 3 , and T 4  in the order from the left side to the right side. 
     The activity or the multiplied value varies momentarily. However, in  FIG. 5A , the activity or the multiplied value varies only at the times T 1 , T 2 , T 3 , and T 4  for convenience of explanation. 
     In the second specific example, the target code amount preciously set at step S 13 , S 15 , and S 17  is the target code amount which is set for all streams not depending on the fineness degree of the input image included in the predetermined unit such as a GOP unit and based on the average fineness degree of the input image included in all streams and which is not corrected. 
     By the time T 1 , the activity or the multiplied value takes a value represented by a segment A 1 . The target code amount takes a value set for all streams, which is represented by a segment D 1 . The output code amount takes a value represented by a segment E 1  in accordance with the value represented by the segment D 1 . 
     It is determined that the scene change does not occur at the time T 1  in likewise  FIG. 4A  (step S 7 , NO at step S 12 ). 
     From the time T 1  to the time T 2 , the activity or the multiplied value takes a value represented by a segment A 2 . The target code amount keeps taking the value set for all streams, which is represented by the segment D 1  (step S 13 ). The output code amount keeps taking the value represented by the segment E 1  in accordance to the value represented by the segment D 1 . 
     It is determined that the first scene change occurs at the time T 2  in likewise  FIG. 4A  (step S 8 , YES at step S 12 , “FIRST” at step S 14 ). 
     From the time T 2  to the time T 3 , the activity or the multiplied value takes a value represented by a segment A 3 . At the time T 2 , the target code amount takes a value obtained by forcibly executing reduction correction by the correction code amount represented by an arrow D 12  on a value set for all streams, which is represented by a segment D 3  (step S 15 ). The target code amount gradually increases to a value represented by the segment D 3  from the time T 2  until an elapse of the time TD 2 , as shown in a curve D 2  (step S 16 ). The target code amount takes the value represented by the segment D 3  after the elapse of the time TD 2 . 
     At the time T 2 , the output code amount takes a value obtained by adding a value represented by an arrow E 12  to a value represented by a segment E 3  instead of taking the value represented by the segment E 3  in accordance with the value represented by the segment D 3 . The output code amount gradually decreases to the value represented by the segment E 3  from the time T 2  until an elapse of the time TE 2 , as shown in a curve E 2 . The output code amount takes the value represented by the segment E 3  after the elapse of the time TE 2 . 
     Although the activity or the multiplied value increases by a value represented by an arrow A 23 , the output code amount only increases to a value represented by an arrow E 12  from the value represented by the segment E 3 . That is to say, when the transcoder  1  detected a fact that the moving image changes to the fine image from the flat image, deterioration of image quality at the time of the scene change can be prevented while the increase in the output code amount is suppressed. 
     It is determined that the scene change does not occur at the time T 3  in likewise  FIG. 4A  (step S 7 , NO at step S 12 ). 
     From the time T 3  to the time T 4 , the activity or the multiplied value takes a value represented by a segment A 4 . The target code amount keeps taking the value set for all streams, which is represented by the segment D 3  (step S 13 ). The output code amount keeps taking the value represented by the segment E 3  in accordance to the value represented by the segment D 3 . 
     It is determined that the second scene change occurs at the time T 4  in likewise  FIG. 4A  (step S 9 , YES at step S 12 , “SECOND” at step S 14 ). 
     From the time T 4 , the activity or the multiplied value takes a value represented by a segment A 5 . The target code amount takes a value obtained by forcibly executing increase correction by the correction code amount represented by an arrow D 34  on a value set for all streams, which is represented by a segment D 5  at the time T 4  (step S 17 ). The target code amount gradually decreases to the value represented by the segment D 5  from the time T 4  until an elapse of the time TD 4 , as shown in a curve D 4  (step S 18 ). The target code amount takes the value represented by the segment D 5  after the elapse of the time TD 4 . 
     The output code amount takes a value obtained by subtracting a value represented by an arrow E 34  from a value represented by a segment E 5  instead of taking the value represented by the segment E 5  in accordance with the value represented by the segment D 5 . The output code amount gradually increases to the value represented by the segment E 5  from the time T 4  until an elapse of the time TE 4 , as shown in a curve E 4 . The output code amount takes the value represented by the segment E 5  after the elapse of the time TE 4 . 
     Although the activity or the multiplied value decreases by a value represented by an arrow A 45 , the output code amount only decreases to the value represented by the arrow E 34  from the value represented by the segment E 5 . That is to say, when the transcoder  1  detects a fact that the moving image changes to the flat image from the fine image, deterioration of image quality at the time of the scene change can be prevented while the decrease in the output code amount is suppressed. 
     {Selection Method of Previous Input Image and Subsequent Input Image} 
     The moving image comprises a GOP (Group of Pictures). The GOP comprises I picture, P picture, and B picture. Quantization step average values in each picture normally increase in the order of I picture, P picture, and B picture. Distributions of the code amount to each picture normally decrease in the order of I picture, P picture, and B picture. 
     Desirably, the scene change detection part  124  can accurately compare the fineness degree of the subsequent input image with that of the previous input image. Therefore, the scene change detection part  124  selects same kinds of picture as the previous input image and the subsequent input image. That is to say, when the scene change detection part  124  selects I picture, P picture, and B picture as the previous input image, the scene change detection part  124  selects I picture, P picture, and B picture as the subsequent input image, respectively. 
       FIG. 6  is a drawing showing a picture used in detection of the scene change. A picture P 1  to a picture P 15  are parts of a picture constituting a moving image. A picture P 4  to a picture P 12  are a picture constituting a GOP unit. Left side pictures are preceding pictures and right side pictures are subsequent pictures. 
     It is assumed that the scene change detection part  124  selects only I picture as the previous input image and the subsequent input image and does not select P picture and B picture. The scene change detection part  124  determines whether the scene change occurs between a picture P 4  and a picture P 13 . However, the scene change detection part  124  detects the scene change late when a true scene change occurs between the picture P 4  and the picture P 13 . 
     It is assumed that the scene change detection part  124  selects only I picture and P picture as the previous input image and the subsequent input image and does not select B picture. The scene change detection part  124  determines whether a scene change occurs between a picture P 7  and a picture P 10 . However, the scene change detection part  124  detects the scene change slightly late when the true scene change occurs between the picture P 7  and the picture P 10 . 
     Then, when the scene change detection part  124  selects I picture, P picture, and B picture as the previous input image, the scene change detection part  124  selects I picture, P picture, and B picture as the subsequent input image, respectively. The scene change detection part  124  can accurately compare the fineness degree of the subsequent input image with that of the previous input image and can detect the scene change in real time. 
     A predetermined threshold value of a subtracted value of the activity at step S 3  and S 5  and a predetermined threshold value of a subtracted value of the multiplied value at step S 4  and S 6  may be different or identical for each of I picture, P picture, and B picture. When they are different, the scene change detection part  124  can accurately compare the fineness degree of the subsequent input image with that of the previous input image. When they are identical, the scene change detection part  124  can easily compare the fineness degree of the subsequent input image with that of the previous input image. 
     Pictures compared at steps S 3  and S 5  may be selected from same or different kinds of pictures among I picture, P picture, and B picture. When the pictures are selected from same kinds of pictures, the scene change detection part  124  can accurately compare the fineness degree of the subsequent input image with that of the previous input image. When the pictures are selected from different kinds of pictures, the scene change detection part  124  can easily compare the fineness degree of the subsequent input image with that of the previous input image. 
     {Method of Restarting Detection of Scene Change After Detection of Scene Change} 
     It is assumed that the scene change detection part  124  restarts detection of a scene change immediately after detection of the scene change. In this case, the scene change detection part  124  is more likely to erroneously detect the scene change as shown in  FIGS. 7A ,  7 C, and  7 E. 
     Then, the scene change detection part  124  does not restart detection of the scene change immediately after detection of the scene change as shown in  FIGS. 7B ,  7 D and  7 F. Therefore, the scene change detection part  124  is less likely to erroneously detect the scene change. 
       FIGS. 7A and 7B  are drawings showing a method of restarting detection of the scene change after detection of the scene change in the case where the scene change was detected when the scene change detection part  124  selected an I picture P 4  as the subsequent input image. The I picture P 4  is represented by sanded area. In  FIG. 7A , the scene change detection part  124  selects a B picture P 5  which is subsequent by one picture to the I picture P 4  as the subsequent input image. The scene change detection part  124  selects a B picture P 3  nearest from the B picture P 5  as the previous input image. 
     The B picture P 5  is a predicted image which refers to the I picture P 4  and a P picture P 7 . The B picture P 3  is a predicted image which refers to a P picture P 1  and the I picture P 4 . Here, the P picture P 1  to which the B picture P 3  refers is an input image before the scene change. Therefore, the scene change detection part  124  is more likely to erroneously detect the scene change although the scene change was just detected. 
     In  FIG. 7B , the scene change detection part  124  selects a B picture P 9  which is subsequent by five pictures to the I picture P 4  as the subsequent input image. The scene change detection part  124  selects a B picture P 8  nearest from the B picture P 9  as the previous input image. 
     The B picture P 9  is a predicted image which refers to the P picture P 7  and a P picture P 10 . The B picture P 8  is a predicted image which refers to the P picture P 7  and the P picture P 10 . Here, the P picture P 7  to which the B picture P 8  and the B picture P 9  refer is an input image after the scene change. The scene change detection part  124  is less likely to erroneously detect the scene change by selecting the previous input image such that the previous input image is to be an input image after detection of the scene change. Then, the scene change detection part  124  may restart detection of the scene change from a state shown in  FIG. 7B . 
       FIGS. 7C and 7D  are drawings showing a method of restarting detection of the scene change after the detection of the scene change in the case where the scene change was detected when the scene change detection part  124  selected the B picture P 5  as the subsequent input image. The B picture P 5  is represented by sanded area. 
     In  FIG. 7C , the scene change detection part  124  selects a B picture P 6  which is subsequent by one picture to the B picture P 5  as the subsequent input image. The scene change detection part  124  selects the B picture P 5  nearest from the B picture P 6  as the previous input image. 
     The B picture P 6  is a predicted image which refers to the I picture P 4  and the P picture P 7 . The B picture P 5  is a predicted image which refers to the I picture P 4  and the P picture P 7 . Here, the I picture P 4  to which the B picture P 5  and the B picture P 6  refer is an input image before the scene change. Therefore, the scene change detection part  124  is more likely to erroneously detect the scene change although the scene change was just detected. 
     In  FIG. 7D , the scene change detection part  124  selects the B picture P 9  which is subsequent by four pictures to the B picture P 5  as the subsequent input image. The scene change detection part  124  selects the B picture P 8  nearest from the B picture P 9  as the previous input image. 
     The B picture P 9  is a predicted image which refers to the P picture P 7  and the P picture P 10 . The B picture P 8  is a predicted image which refers to the P picture P 7  and the P picture P 10 . Here, the P picture P 7  to which the B picture P 8  and the B picture P 9  refer is an input image after the scene change. The scene change detection part  124  is less likely to erroneously detect the scene change by selecting the previous input image such that the previous input image is to be an input image after detection of the scene change. Then, the scene change detection part  124  may restart detection of the scene change from a state shown in  FIG. 7D . 
       FIGS. 7E and 7F  are drawings showing a method of restarting detection of the scene change after the detection of the scene change in the case where the scene change was detected when the scene change detection part  124  selected the P picture P 7  as the subsequent input image. The P picture P 7  is represented by sanded area. 
     In  FIG. 7E , the scene change detection part  124  selects the B picture P 8  which is subsequent by one picture to the P picture P 7  as the subsequent input image. The scene change detection part  124  selects the B picture P 6  nearest from the B picture P 8  as the previous input image. 
     The B picture P 8  is a predicted image which refers to the P picture P 7  and the P picture P 10 . The B picture P 6  is a predicted image which refers to the P picture P 4  and the P picture P 7 . Here, the I picture P 4  to which the B picture P 6  refers is an input image before the scene change. Therefore, the scene change detection part  124  is more likely to erroneously detect the scene change although the scene change was just detected. 
     In  FIG. 7F , the scene change detection part  124  selects a B picture P 12  which is subsequent by five pictures to the P picture P 7  as the subsequent input image. The scene change detection part  124  selects a B picture P 11  nearest from the B picture P 12  as the previous input image. 
     The B picture P 12  is a predicted image which refers to the P picture P 10  and a I picture P 13 . The B picture P 11  is a predicted image which refers to the P picture P 10  and the I picture P 13 . Here, the P picture P 10  to which the B picture P 11  and the B picture P 12  refer is an input image after the scene change. The scene change detection part  124  is less likely to erroneously detect the scene change by selecting the previous input image such that the previous input image is to be an input image after detection of the scene change. Then, the scene change detection part  124  may restart detection of the scene change from a state shown in  FIG. 7F . 
     In an example of  FIG. 7 , a GOP in which detection of the scene change is restarted is same as a GOP in which the scene change is detected. In another example, the GOP in which detection of the scene change is restarted may be a GOP immediately after the GOP in which the scene change is detected. It is understood that the scene change detection part  124  is less likely to erroneously detect the scene change in consideration that the moving image comprises a plurality of GOPs such that a predicted error does not broadly affect the direction of the time axis. 
     While the invention has been shown and described in detail, the foregoing description is in all aspects illustrative and not restrictive. It is therefore understood that numerous modifications and variations can be devised without departing from the scope of the invention.