Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
TRANSCODING APPARATUS, TRANSCODING METHOD AND INTEGRATED CIRCUIT
Document Type and Number:
WIPO Patent Application WO/2007/086590
Kind Code:
A2
Abstract:
A transcoding apparatus includes: a decoding unit for decoding a first bit stream; a bit allocation unit for estimating a bit count that can be used during encoding; a quantization parameter calculating unit for calculating a candidate quantization parameter according to the estimated bit count; a quantization parameter adjuster for determining a second quantization parameter according to the value of the candidate quantization parameter and for determining a ratio of the second quantization parameter to a first quantization parameter; and a bit shifting unit for performing bit shifting of decoded data according to the ratio. The quantization parameter adjuster sets a first critical value, the size of which is equal to twice the first quantization parameter. When the candidate quantization parameter is not smaller than the first threshold value, the second quantization parameter is set to be the same as the first critical value. When the candidate quantization parameter is smaller than the first threshold value, the second quantization parameter is set to be the same as the first quantization parameter.

Inventors:
CHEN WEI-FU
PON HON-WEN
CHENG JU-YUN
Application Number:
PCT/JP2007/051533
Publication Date:
August 02, 2007
Filing Date:
January 24, 2007
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
MATSUSHITA ELECTRIC IND CO LTD (JP)
CHEN WEI-FU
PON HON-WEN
CHENG JU-YUN
International Classes:
H04N7/26; H04N7/50
Domestic Patent References:
WO2004088968A22004-10-14
Foreign References:
EP0627858A21994-12-07
US6208688B12001-03-27
US6590936B12003-07-08
Attorney, Agent or Firm:
TANAKA, Mitsuo et al. (IMP Building 3-7, Shiromi 1-chome, Chuo-ku, Osaka-sh, Osaka 01, JP)
Download PDF:
Claims:

CLAIMS

1. A transcoding method for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding method comprising the following steps:

(A) decoding the first bit stream;

(B) estimating a bit count that can be used by a subsequent input unit during encoding;

(C) calculating a candidate quantization parameter according to the estimated bit count;

(D) determining a second quantization parameter according to the value of the candidate quantization parameter, and determining a ratio of the second quantization parameter to the first quantization parameter, wherein the determination of the second quantization parameter includes the following sub-steps:

(D-1 ) setting a first critical value, the size of which is equal to twice the first quantization parameter, and dynamically determining a first threshold value according to the first critical value and actual use conditions; (D-2) determining whether the candidate quantization parameter is not smaller than the first threshold value, the flow going to sub- step (D-4) if affirmative and to sub-step (D-3) if otherwise;

(D-3) setting the value of the second quantization parameter to be the same as that of the first quantization parameter; and (D-4) setting the value of the second quantization parameter to be the same as the first critical value;

(E) performing bit shifting of data decoded in step (A) according to the ratio determined in step (D); and

(F) encoding data processed in step (E) to obtain the second bit stream.

2. The transcoding method as claimed in claim 1 , wherein, in sub-step (D-1 ), the first threshold value must not be larger than the first critical value but must be larger than the first quantization parameter.

3. The transcoding method as claimed in claim 2, wherein, in sub-step (D-1 ), the first threshold value is dynamically determined according to bit compression conditions, and numerical value of the first threshold value is downwards adjusted when the bit compression conditions have yet to reach expected conditions.

4. The transcoding method as claimed in claim 1 , wherein, in step (E), the decoded data is right-shifted by one bit if the ratio is 2, and does not undergo bit shifting if the ratio is 1.

5. The transcoding method as claimed in claim 1 , wherein, in step (B), the bit count that can be used by the subsequent input unit during encoding is estimated according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

6. A transcoding apparatus for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding apparatus comprising: a decoding unit for decoding the first bit stream; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit during encoding; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit;

a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for setting a first critical value, the size of which is equal to twice the first quantization parameter, and for dynamically determining a first threshold value according to the first critical value and actual use conditions, and a quantization parameter deciding unit electrically coupled to said quantization parameter calculating unit and said analyzing unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value, said quantization parameter deciding unit further determining a ratio of the second quantization parameter to the first quantization parameter; a bit shifting unit electrically coupled to said quantization parameter deciding unit and said decoding unit, said bit shifting unit performing bit shifting of data decoded by said decoding unit according to the ratio determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said bit shifting unit, said encoding unit encoding data processed by said bit shifting unit to obtain the second bit stream.

7. The transcoding apparatus as claimed in claim 6, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

8. The transcoding apparatus as claimed in claim 7, wherein said

analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions. 9. The transcoding apparatus as claimed in claim 6, wherein said bit shifting unit right-shifts the decoded data by one bit if the ratio is 2, and does not perform bit shifting if the ratio is 1.

10. The transcoding apparatus as claimed in claim 6, wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

1 1. A transcoding method for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding method comprising the following steps:

(A) decoding the first bit stream;

(B) estimating a bit count that can be used by a subsequent input unit during encoding; (C) calculating a candidate quantization parameter according to the estimated bit count;

(D) determining a second quantization parameter according to the value of the candidate quantization parameter, and determining a ratio of the second quantization parameter to the first quantization parameter, wherein the determination of the second quantization parameter includes the following sub-steps:

(D-1 ) setting a first critical value, the size of which is equal to twice the first quantization parameter, and dynamically determining a

first threshold value according to the first critical value and actual use conditions;

(D-2) determining whether the candidate quantization parameter is not smaller than the first threshold value, the flow going to sub- step (D-3) if affirmative and to sub-step (D-5) if otherwise;

(D-3) analyzing relation between bit ratio and quantization parameter, and determining if there is a second critical value larger than the first critical value, the flow going to sub-step (D-4) if affirmative and to sub-step (D-6) if otherwise, determination if there is a second critical value in sub-step (D-3) being conducted by determining if there is another level of bit ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present, there being a second critical value if affirmative; (D-4) setting size of the second critical value to be the same as four times the first quantization parameter, dynamically determining a second threshold value according to the second critical value and the actual use conditions, and determining if the value of the candidate quantization parameter is not smaller than the second threshold value, the flow going to sub-step (D-7) if affirmative and to sub-step (D-6) if otherwise;

(D-5) setting the value of the second quantization parameter to be the same as that of the first quantization parameter;

(D-6) setting the value of the second quantization parameter to be the same as the first critical value; and

(D-7) setting the value of the second quantization parameter to be the same as the second critical value; (E) performing bit shifting of data decoded in step (A) according to

the ratio determined in step (D); and

(F) encoding the bit-shifted data to obtain the second bit stream.

12. The transcoding method as claimed in claim 11 , wherein, in sub-step (D-1 ), the first threshold value must not be larger than the first critical value but must be larger than the first quantization parameter.

13. The transcoding method as claimed in claim 12, wherein, in sub-step (D-1 ), the first threshold value is dynamically determined according to bit compression conditions, and the numerical value of the first threshold value is downwards adjusted when the bit compression conditions have yet to reach expected conditions.

14. The transcoding method as claimed in claim 13, wherein, in sub-step (D-4), the second threshold value must not be larger than the second critical value and must not be smaller than the first critical value.

15. The transcoding method as claimed in claim 11 , wherein, in step (E), the decoded data is right-shifted by two bits if the ratio is 4, is right- shifted by one bit if the ratio is 2, and does not undergo bit shifting if the ratio is 1.

16. The transcoding method as claimed in claim 11 , wherein, in step (B), the bit count that can be used by the subsequent input unit during encoding is estimated according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

17. A transcoding apparatus for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding apparatus comprising: a decoding unit for decoding the first bit stream; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit;

a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for setting a first critical value, the size of which is equal to twice the first quantization parameter, for dynamically determining a first threshold value according to the first critical value and actual use conditions, for setting a second critical value, the size of which is equal to four times the first quantization parameter, and for dynamically determining a second threshold value according to the second critical value and the actual use conditions, and a quantization parameter deciding unit electrically coupled to said quantization parameter calculating unit and said analyzing unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the second critical value when the candidate quantization parameter is not smaller than the second threshold value, to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value and is smaller than the second threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value, said quantization parameter deciding unit further determining a ratio of the second quantization parameter to the first quantization parameter; a bit shifting unit electrically coupled to said quantization parameter deciding unit and said decoding unit, said bit shifting unit performing bit

shifting of data decoded by said decoding unit according to the ratio determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said bit shifting unit, said encoding unit encoding data processed by said bit shifting unit to obtain the second bit stream.

18. The transcoding apparatus as claimed in claim 17, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter. 19. The transcoding apparatus as claimed in claim 18, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions. 20. The transcoding apparatus as claimed in claim 19, wherein, when said analyzing unit determines the second threshold value, the second threshold value is limited to be not larger than the second critical value and not smaller than the first critical value.

21. The transcoding apparatus as claimed in claim 17, wherein said bit shifting unit right-shifts the decoded data by two bits if the ratio is 4, right-shifts the decoded data by one bit if the ratio is 2, and does not perform bit shifting if the ratio is 1.

22. The transcoding apparatus as claimed in claim 17, wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

23. A transcoding method for transforming a first bit stream into a second

bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding method comprising the following steps:

(A) decoding the first bit stream; (B) performing inverse quantization processing upon the decoded data;

(C) estimating a bit count that can be used by a subsequent input unit during encoding;

(D) calculating a candidate quantization parameter according to the estimated bit count;

(E) determining a second quantization parameter according to the value of the candidate quantization parameter, wherein the determination of the second quantization parameter includes the following sub-steps:

(E-1 ) analyzing relation between bit ratio and quantization parameter, determining a first critical value, and dynamically determining a first threshold value according to the first critical value and actual use conditions, wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter;

(E-2) determining whether the candidate quantization parameter is not smaller than the first threshold value, the flow going to sub- step (E-4) if affirmative and to sub-step (E-3) if otherwise;

(E-3) setting the value of the second quantization parameter to be the same as that of the first quantization parameter; and

(E-4) setting the value of the second quantization parameter to be the same as the first critical value;

(F) performing quantization processing upon the inverse quantized data using the second quantization parameter; and (G) encoding the quantized data to obtain the second bit stream.

24. The transcoding method as claimed in claim 23, wherein, in sub-step (E-1 ), the first threshold value must not be larger than the first critical value but must be larger than the first quantization parameter.

25. The transcoding method as claimed in claim 24, wherein, in sub-step (E-1 ), the first threshold value is dynamically determined according to bit compression conditions, and the numerical value of the first threshold value is downwards adjusted when the bit compression conditions have yet to reach expected conditions.

26. The transcoding method as claimed in claim 23, wherein, in step (C), the bit count that can be used by the subsequent input unit during encoding is estimated according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

27. A transcoding apparatus for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding apparatus comprising: a decoding unit for decoding the first bit stream; an inverse quantization unit electrically coupled to said decoding unit, said inverse quantization unit performing inverse quantization using the first quantization parameter upon data decoded by said decoding unit; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said

bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for analyzing relation between bit ratio and quantization parameter, for determining a first critical value, and for determining a first threshold value according to actual use conditions and the first critical value, wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter, and a quantization parameter deciding unit electrically coupled to said analyzing unit and said quantization parameter calculating unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value; a quantization unit electrically coupled to said quantization parameter deciding unit and said inverse quantization unit, said quantization unit performing quantization upon inverse quantized data from said inverse quantization unit according to the second quantization parameter determined by said quantization parameter deciding unit; and

an encoding unit electrically coupled to said quantization unit, said encoding unit encoding quantized data from said quantization unit to obtain the second bit stream.

28. The transcoding apparatus as claimed in claim 27, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

29. The transcoding apparatus as claimed in claim 28, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

30. The transcoding apparatus as claimed in claim 27, wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

31. A transcoding method for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding method comprising the following steps:

(A) decoding the first bit stream;

(B) performing inverse quantization processing upon the decoded data; (C) estimating a bit count that can be used by a subsequent input unit during encoding;

(D) calculating a candidate quantization parameter according to the estimated bit count;

(E) determining a second quantization parameter according to the value of the candidate quantization parameter, wherein the determination of the second quantization parameter includes the following sub-steps:

(E-1 ) analyzing relation between bit ratio and quantization parameter, determining a first critical value, and dynamically determining a first threshold value according to the first critical value and actual use conditions, wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter;

(E-2) determining whether the candidate quantization parameter is not smaller than the first threshold value, the flow going to sub- step (E-3) if affirmative and to sub-step (E-5) if otherwise;

(E-3) analyzing the relation between bit ratio and quantization parameter, and determining if there is a second critical value larger than the first critical value, the flow going to sub-step (E-4) if affirmative and to sub-step (E-6) if otherwise, wherein determination if there is a second critical value in sub-step (E-3) is conducted by determining if there is another level of bit ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present, there being a second critical value if affirmative, and the second critical value being set to be the same as the quantization parameter with the smallest value in the lower level of bit ratio;

(E-4) determining whether the value of the candidate

quantization parameter is not smaller than a second threshold value, the flow going to sub-step (E-7) if affirmative and to sub-step (E-6) if otherwise, the second threshold value being dynamically determined according to the second critical value and the actual use conditions; (E-5) setting the value of the second quantization parameter to be the same as that of the first quantization parameter;

(E-6) setting the value of the second quantization parameter to be the same as the first critical value; and

(E-7) setting the value of the second quantization parameter to be the same as the second critical value;

(F) performing quantization processing upon the inverse quantized data using the second quantization parameter; and

(G) encoding the quantized data to obtain the second bit stream.

32. The transcoding method as claimed in claim 31 , wherein, in sub-step (E-1 ), the first threshold value must not be larger than the first critical value but must be larger than the first quantization parameter.

33. The transcoding method as claimed in claim 32, wherein, in sub-step (E-1 ), the first threshold value is dynamically determined according to bit compression conditions, and the numerical value of the first threshold value is downwards adjusted when the bit compression conditions have yet to reach expected conditions.

34. The transcoding method as claimed in claim 33, wherein, in sub-step (E-4), the second threshold value must not be larger than the second critical value and must not be smaller than the first critical value. 35. The transcoding method as claimed in claim 31 , wherein, in step (C), the bit count that can be used by the subsequent input unit during encoding is estimated according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit

stream.

36. A transcoding apparatus for transforming a first bit stream into a second bit stream, the first bit stream being encoded according to a first quantization parameter, said transcoding apparatus comprising: a decoding unit for decoding the first bit stream; an inverse quantization unit electrically coupled to said decoding unit, said inverse quantization unit performing inverse quantization using the first quantization parameter upon data decoded by said decoding unit; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for analyzing relation between bit ratio and quantization parameter, for determining a first critical value and a second critical value, and for determining a first threshold value and a second threshold value according to actual use conditions and the first critical value and the second critical value respectively; wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter; and wherein determination if there is the

second critical value is conducted by determining if there is another level of bit ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present, there being the second critical value if affirmative, and the second critical value being set to be the same as the quantization parameter with the smallest value in the lower level of bit ratio; and a quantization parameter deciding unit electrically coupled to said analyzing unit and said quantization parameter calculating unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value and is smaller than the second threshold value, to be the same as the second critical value when the candidate quantization parameter is larger than the second threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value; a quantization unit electrically coupled to said quantization parameter deciding unit and said inverse quantization unit, said quantization unit performing quantization upon inverse quantized data from said inverse quantization unit according to the second quantization parameter determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said quantization unit, said encoding unit encoding quantized data from said quantization unit to obtain the second bit stream.

37. The transcoding apparatus as claimed in claim 36, wherein, when said analyzing unit determines the first threshold value, the first

threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

38. The transcoding apparatus as claimed in claim 37, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

39. The transcoding apparatus as claimed in claim 38, wherein, when said analyzing unit determines the second threshold value, the second threshold value is limited to be not larger than the second critical value and not smaller than the first critical value.

40. The transcoding apparatus as claimed in claim 36, wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

41. An integrated circuit for receiving a first bit stream and for transforming the first bit stream into a second bit stream for output, the first bit stream being encoded according to a first quantization parameter, said integrated circuit comprising: a decoding unit for decoding the first bit stream; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including

an analyzing unit for receiving the value of the first quantization parameter, for setting a first critical value, the size of which is equal to twice the first quantization parameter, and for dynamically determining a first threshold value according to the first critical value and actual use conditions, and a quantization parameter deciding unit electrically coupled to said quantization parameter calculating unit and said analyzing unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value, said quantization parameter deciding unit further determining a ratio of the second quantization parameter to the first quantization parameter; a bit shifting unit electrically coupled to said quantization parameter deciding unit and said decoding unit, said bit shifting unit performing bit shifting of data decoded by said decoding unit according to the ratio determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said bit shifting unit, said encoding unit encoding data processed by said bit shifting unit to obtain the second bit stream.

42. The integrated circuit as claimed in claim 41 , wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

43. The integrated circuit as claimed in claim 42, wherein said analyzing unit dynamically determines the first threshold value according to bit

compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

44. The integrated circuit as claimed in claim 41 , wherein said bit shifting unit right-shifts the decoded data by one bit if the ratio is 2, and does not perform bit shifting if the ratio is 1.

45. The integrated circuit as claimed in claim 41 , wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

46. An integrated circuit for receiving decoded data of a first bit stream, the first bit stream being encoded according to a first quantization parameter, said integrated circuit comprising: a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; and a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for setting a first critical value, the size of which is equal to twice the first quantization parameter, and for dynamically determining a first threshold value according to the first critical value and actual use conditions, and a quantization parameter deciding unit electrically coupled to said quantization parameter calculating unit and said analyzing unit,

said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value, said quantization parameter deciding unit further determining a ratio of the second quantization parameter to the first quantization parameter.

47. The integrated circuit as claimed in claim 46, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

48. The integrated circuit as claimed in claim 47, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

49. The integrated circuit as claimed in claim 46, further comprising a bit shifting unit electrically coupled to said quantization parameter deciding unit, said bit shifting unit performing bit shifting of the received decoded data according to the ratio determined by said quantization parameter deciding unit.

50. The integrated circuit as claimed in claim 49, wherein said bit shifting unit right-shifts the decoded data by one bit if the ratio is 2, and does not perform bit shifting if the ratio is 1.

51. An integrated circuit for receiving a first bit stream and for transforming the first bit stream into a second bit stream for output, the first bit stream being encoded according to a first quantization parameter,

said integrated circuit comprising: a decoding unit for decoding the first bit stream; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for setting a first critical value, the size of which is equal to twice the first quantization parameter, for dynamically determining a first threshold value according to the first critical value and actual use conditions, for setting a second critical value, the size of which is equal to four times the first quantization parameter, and for dynamically determining a second threshold value according to the second critical value and the actual use conditions, and a quantization parameter deciding unit electrically coupled to said quantization parameter calculating unit and said analyzing unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the second critical value when the candidate quantization parameter is not smaller than the second threshold value, to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value and is smaller than the second threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value, said quantization parameter deciding unit further

determining a ratio of the second quantization parameter to the first quantization parameter; a bit shifting unit electrically coupled to said quantization parameter deciding unit and said decoding unit, said bit shifting unit performing bit shifting of data decoded by said decoding unit according to the ratio determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said bit shifting unit, said encoding unit encoding data processed by said bit shifting unit to obtain the second bit stream. 52. The integrated circuit as claimed in claim 51 , wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

53. The integrated circuit as claimed in claim 52, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

54. The integrated circuit as claimed in claim 53, wherein, when said analyzing unit determines the second threshold value, the second threshold value is limited to be not larger than the second critical value and not smaller than the first critical value.

55. The integrated circuit as claimed in claim 51 , wherein said bit shifting unit right-shifts the decoded data by two bits if the ratio is 4, right-shifts the decoded data by one bit if the ratio is 2, and does not perform bit shifting if the ratio is 1.

56. The integrated circuit as claimed in claim 51 , wherein said bit allocation unit estimates the bit count that can be used by the

subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

57. An integrated circuit for receiving decoded data of a first bit stream, the first bit stream being encoded according to a first quantization parameter, said integrated circuit comprising: a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; and a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for setting a first critical value, the size of which is equal to twice the first quantization parameter, for dynamically determining a first threshold value according to the first critical value and actual use conditions, for setting a second critical value, the size of which is equal to four times the first quantization parameter, and for dynamically determining a second threshold value according to the second critical value and the actual use conditions, and a quantization parameter deciding unit electrically coupled to said quantization parameter calculating unit and said analyzing unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the second critical value when the candidate quantization parameter is not smaller than the second threshold value, to be the same as the first critical value when the candidate quantization parameter is not smaller than the

first threshold value and is smaller than the second threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value, said quantization parameter deciding unit further determining a ratio of the second quantization parameter to the first quantization parameter.

58. The integrated circuit as claimed in claim 57, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

59. The integrated circuit as claimed in claim 58, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

60. The integrated circuit as claimed in claim 59, wherein, when said analyzing unit determines the second threshold value, the second threshold value is limited to be not larger than the second critical value and not smaller than the first critical value. 61. The integrated circuit as claimed in claim 57, further comprising a bit shifting unit electrically coupled to said quantization parameter deciding unit, said bit shifting unit performing bit shifting of the received decoded data according to the ratio determined by said quantization parameter deciding unit. 62. The integrated circuit as claimed in claim 61 , wherein said bit shifting unit right-shifts the decoded data by two bits if the ratio is 4, right-shifts the decoded data by one bit if the ratio is 2, and does not perform bit shifting if the ratio is 1.

63. An integrated circuit for receiving a first bit stream and for transforming the first bit stream into a second bit stream for output, the first bit stream being encoded according to a first quantization parameter, said integrated circuit comprising: a decoding unit for decoding the first bit stream; an inverse quantization unit electrically coupled to said decoding unit, said inverse quantization unit performing inverse quantization using the first quantization parameter upon data decoded by said decoding unit; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for analyzing relation between bit ratio and quantization parameter, for determining a first critical value, and for determining a first threshold value according to actual use conditions and the first critical value, wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter, and a quantization parameter deciding unit electrically coupled to said analyzing unit and said quantization parameter calculating unit,

said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value; a quantization unit electrically coupled to said quantization parameter deciding unit and said inverse quantization unit, said quantization unit performing quantization upon inverse quantized data from said inverse quantization unit according to the second quantization parameter determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said quantization unit, said encoding unit encoding quantized data from said quantization unit to obtain the second bit stream. 64. The integrated circuit as claimed in claim 63, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

65. The integrated circuit as claimed in claim 64, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

66. The integrated circuit as claimed in claim 63, wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

67. An integrated circuit for receiving decoded data of a first bit stream, the first bit stream being encoded according to a first quantization parameter, said integrated circuit comprising: a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; and a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for analyzing relation between bit ratio and quantization parameter, for determining a first critical value, and for determining a first threshold value according to actual use conditions and the first critical value, wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter, and a quantization parameter deciding unit electrically coupled to said analyzing unit and said quantization parameter calculating unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter

is smaller than the first threshold value.

68. The integrated circuit as claimed in claim 67, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

69. The integrated circuit as claimed in claim 68, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

70. An integrated circuit for receiving a first bit stream and for transforming the first bit stream into a second bit stream for output, the first bit stream being encoded according to a first quantization parameter, said integrated circuit comprising: a decoding unit for decoding the first bit stream; an inverse quantization unit electrically coupled to said decoding unit, said inverse quantization unit performing inverse quantization using the first quantization parameter upon data decoded by said decoding unit; a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for analyzing relation between bit ratio and quantization parameter, for determining a first critical value and a second critical

value, and for determining a first threshold value and a second threshold value according to actual use conditions and the first critical value and the second critical value respectively; wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter; and wherein determination if there is the second critical value is conducted by determining if there is another level of bit ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present, there being the second critical value if affirmative, and the second critical value being set to be the same as the quantization parameter with the smallest value in the lower level of bit ratio; and a quantization parameter deciding unit electrically coupled to said analyzing unit and said quantization parameter calculating unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value and is smaller than the second threshold value, to be the same as the second critical value when the candidate quantization parameter is larger than the second threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value;

a quantization unit electrically coupled to said quantization parameter deciding unit and said inverse quantization unit, said quantization unit performing quantization upon inverse quantized data from said inverse quantization unit according to the second quantization parameter determined by said quantization parameter deciding unit; and an encoding unit electrically coupled to said quantization unit, said encoding unit encoding quantized data from said quantization unit to obtain the second bit stream.

71. The integrated circuit as claimed in claim 70, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

72. The integrated circuit as claimed in claim 71 , wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

73. The integrated circuit as claimed in claim 72, wherein, when said analyzing unit determines the second threshold value, the second threshold value is limited to be not larger than the second critical value and not smaller than the first critical value.

74. The integrated circuit as claimed in claim 70, wherein said bit allocation unit estimates the bit count that can be used by the subsequent input unit during encoding according to target bit rate, input unit size to be processed, and the original bit rate and frame rate included in the first bit stream.

75. An integrated circuit for receiving decoded data of a first bit stream, the first bit stream being encoded according to a first quantization

parameter, said integrated circuit comprising: a bit allocation unit for estimating a bit count that can be used by a subsequent input unit; a quantization parameter calculating unit electrically coupled to said bit allocation unit, said quantization parameter calculating unit calculating a candidate quantization parameter according to the bit count estimated by said bit allocation unit; and a quantization parameter adjuster including an analyzing unit for receiving the value of the first quantization parameter, for analyzing relation between bit ratio and quantization parameter, for determining a first critical value and a second critical value, and for determining a first threshold value and a second threshold value according to actual use conditions and the first critical value and the second critical value respectively; wherein the determination of the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio, and wherein if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter; and wherein determination if there is the second critical value is conducted by determining if there is another level of bit ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present, there being the second critical value if affirmative, and the second critical value being set to be the same as the quantization parameter with the smallest value in the lower level of bit ratio; and

a quantization parameter deciding unit electrically coupled to said analyzing unit and said quantization parameter calculating unit, said quantization parameter deciding unit setting the value of a second quantization parameter to be the same as the first critical value when the candidate quantization parameter is not smaller than the first threshold value and is smaller than the second threshold value, to be the same as the second critical value when the candidate quantization parameter is larger than the second threshold value, and to be the same as that of the first quantization parameter when the candidate quantization parameter is smaller than the first threshold value.

76. The integrated circuit as claimed in claim 75, wherein, when said analyzing unit determines the first threshold value, the first threshold value is limited to be not larger than the first critical value but larger than the first quantization parameter.

77. The integrated circuit as claimed in claim 76, wherein said analyzing unit dynamically determines the first threshold value according to bit compression conditions, and downwards adjusts the numerical value of the first threshold value when the bit compression conditions have yet to reach expected conditions.

78. The integrated circuit as claimed in claim 77, wherein, when said analyzing unit determines the second threshold value, the second threshold value is limited to be not larger than the second critical value and not smaller than the first critical value.

Description:

DESCRIPTION

TRANSCODING APPARATUS, TRANSCODING METHOD AND INTEGRATED CIRCUIT

Technical Field

The invention relates to a transcoding apparatus and method, and more particularly to a transcoding apparatus and method capable of reducing quantization error.

Background Art

When images must be stored in different devices, or are required to be transmitted to and reproduced by different devices, a transcoder is needed to transform compressed image data to a different format so as to comply with the specifications or bandwidth of different devices, such as conversion of MPEG 2 format encoded data to MPEG 4 format.

Referring to Figures 1 and 2, a conventional transcoder 10 disclosed in U.S. Patent No. 6,590,936 B1 includes a decoding unit (Da1 ) and an encoding unit (Ea1 ).

The decoding unit (Da1 ) includes a variable length decoding unit 100, an inverse quantization unit (101a), an inverse discrete cosine transform unit 102, an adder 103, and a frame memory 104.

The encoding unit (Ea1 ) includes a subtracter 105, a discrete cosine transform unit 106, a quantization unit 152, an inverse quantization unit

108, an inverse discrete cosine transform unit 109, an adder 110, a frame memory 111 , a variable length encoding unit 112, and a rate control unit 113.

The quantization unit 152 of the encoding unit (Ea1 ) includes a candidate quantization parameter derivation unit 250, a quantization parameter derivation unit 252, and a quantizer 201. The quantization parameter is indicated as quantization P. in the drawings. Encoded data (Eg1 ) is inputted into the variable length decoding unit

100 of the decoding unit (Da1 ), where the encoded data (Eg1 ) was encoded according to a first quantization parameter (Qs1 ).

The variable length decoding unit 100 decodes the received data (Eg1 ) to generate corresponding decoded data (Vg). After the data (Vg) has undergone inverse quantization computations executed by the inverse quantization unit (101 a), processed data (IQg) is sent to the inverse discrete cosine transform unit 102. The inverse quantization unit (101 a) also sends the first quantization parameter (Qs1 ) to the quantization unit 152. The inverse discrete cosine transform unit 102 converts the received data (IQg) in the frequency domain into data (ITg) in the space domain. The adder 103 adds the data (ITg) and its prediction data (Mg1 ), and the addition result (Rg1 ) is sent to the encoding unit (Ea1 ) as decoded data, and is also sent to the frame memory 104. The frame memory 104 stores the data (Rg1 ) outputted from the adder 103 as the prediction data (Mg1 ).

The subtracter 105 of the encoding unit (Ea1) calculates a difference

(Dg) between the data (Rg1 ) and the prediction data (Mg1 ), and the discrete cosine transform unit 106 converts the difference (Dg) in the space domain into frequency domain data (Tg). According to a quantization control signal (Cq) and the first quantization parameter (Qs1 ), the quantization unit 152 quantizes the frequency domain data (Tg) using a second quantization parameter (Qs2), thereby obtaining quantized data (Qg).

The quantized data (Qg) undergoes inverse quantization executed by the inverse quantization unit 108 according to the second quantization parameter (Qs2), and the inverse quantized data (IQg2) is sent to the inverse discrete cosine transform unit 109 for processing to obtain data (ITg2). The data (ITg2) is added to its prediction data (Mg2) by the adder 1 10, and the added data (Rg2) is sent to the frame memory 1 1 1 for storage.

The quantized data (Qg) by the quantization unit 152 is encoded by the variable length encoding unit 1 12 to obtain final encoded data (Eg2). The format of the encoded data (Eg2) is different from the format of the encoded data (Eg1 ) inputted into the transcoder 10. According to the encoding condition of the encoded data (Eg2), the rate control unit 1 13 calculates a target number of bits for generating a corresponding quantization control signal (Cq). It is worthwhile to note that the quantization unit 152 undergoes a series of operations when executing quantization, details of which are as follows. According to the quantization control signal (Cq), the candidate quantization parameter derivation unit 250 of the quantization unit 152 determines a candidate quantization parameter (Qsb). The quantization parameter derivation unit 252 determines the second quantization parameter (Qs2) according to the candidate quantization parameter (Qsb) and the first quantization parameter (Qs1 ). The quantizer 201 then quantizes the data (Tg) according to the second quantization parameter (Qs2) derived by the quantization parameter derivation unit 252. Referring to Figures 2 and 3, the quantization parameter derivation unit 252 determines the second quantization parameter (Qs2) according to the candidate quantization parameter (Qsb) and the first quantization parameter (Qs1 ) by comparing the candidate quantization parameter

(Qsb) with a threshold quantization parameter (Qth, equal to 1.5xQs1 ) and a constant multiple quantization parameter (Qmu, equal to 2xQs1 ). When the candidate quantization parameter (Qsb) is smaller than the threshold quantization parameter (Qth) (i.e., Qsb<Qth), the value of the second quantization parameter (Qs2) is set to be the same as that of the first quantization parameter (Qs1 ). When QthDQsbDQmu, the value of the second quantization parameter (Qs2) is set to the constant multiple quantization parameter (Qmu, equal to 2xQs1 ). When the candidate quantization parameter (Qsb) is larger than the constant multiple quantization parameter (Qmu) (i.e., Qsb>Qmu), the value of the second quantization parameter (Qs2) is set to that of the candidate quantization parameter (Qsb).

The reason why the conventional quantization derivation unit 252 derives the second quantization parameter (Qs2) according to the method of Figure 3, is because the bit rate and the inverse of the quantization error (1 /quantization error) have the relation shown in Figure 4. The solid line in Figure 4 represents the inverse of the quantization error generated for different bit rates when image data undergoes direct coding according to a quantization parameter (QPi). On the other hand, the dotted line in Figure 4 represents the inverse of the quantization error generated for different bit rates when data encoded using the quantization parameter (QPi) is inverse quantized using the quantization parameter (QPi), followed by a transcoding processing using a quantization parameter (QPr). It is apparent from the solid line in Figure 4 that, in general, the function of the bit rate and the inverse of the quantization error is substantially linear in case of direct coding with the quantization parameter as a parameter. However, from the dotted line in Figure 4, the

function of the bit rate and the inverse of the quantization error is nonlinear in case of transcoding with the quantization parameter as a parameter. It is worth noting that, when QPi<QPr<2xQPi, the errors between the solid line and the dotted line is largest. On the other hand, when QPiDQPr or QPrD2xQPi, the difference between the solid line and the dotted line is very small, where the two lines virtually overlap. It is especially noted that, when QPr=2xQPi, the difference between the solid line and the dotted line is very small.

According to the statistical characteristics of Figure 4, the conventional transcoder 10 sets the value of the second quantization parameter (Qs2) to Qs1 or 2xQs1 when the candidate quantization parameter (Qsb) is smaller than twice the first quantization parameter (i.e., 2xQs1 ). On the other hand, when the candidate quantization parameter (Qsb) is not smaller than 2xQs1 , no adjustment is conducted, and the value of the second quantization parameter (Qs2) is set to be equal to that of the candidate quantization parameter (Qsb). The result shown in Figure 3 is thus obtained.

However, the conventional transcoder 10 does not consider the relation between bit ratio and quantization parameter. As described in another patent, i.e., U.S. Patent No. 6,208,688 B1 , under normal circumstances, the statistical characteristic relation of the bit ratio and the quantization parameter will have the relation of Figure 5. Figure 5 shows the change in the bit ratio when the candidate quantization parameter (Qsb) varies while the first quantization parameter (Qs1 ) is equal to 8. It is apparent from Figure 5 that, for the different candidate quantization parameters (Qsb), the bit ratios can be generally grouped into two levels. Between these two different levels, there is a sloped section where the bit ratio changes quickly. As for the candidate

quantization parameters (Qsb) in the same level, the bit ratios thereof are substantially similar.

The following is an example to describe the relation in Figure 5. To facilitate description, Figure 5 is simplified into the schematic diagram of Figure 6. As mentioned hereinbefore, when the candidate quantization parameter (Qsb) is larger than 2xQs1 , the conventional transcoder 10 directly sets the value of the second quantization parameter (Qs2) to be the same as that of the candidate quantization parameter (Qsb). However, in general, since candidate quantization parameters (Qsb) that are 2xQs1 (the circular dot in Figure 6) or larger than 2xQs1 (the triangular dot in Figure 6) are actually located in the same level of bit ratio, if the condition of Figure 4 is to be simultaneously satisfied, the value of the candidate quantization parameter (Qsb) should be selected to be 2xQs1 , which results in a smaller second quantization parameter (Qs2) than that selected by the conventional transcoder 10 so as to obtain a smaller quantization error.

The statistical relation between bit ratio and quantization parameter can also be such as that shown in Figure 7. In Figure 7, there are two sloped sections where there are quick changes in the bit ratios, thereby grouping the bit ratios into three different levels. To facilitate description, the lowest points of the two sloped sections are indicated as (Qd ) and (Qc2), respectively. It can be appreciated from the statistical relation that, in general, 2xQs1 is located between (Qd ) and (Qc2). If Qd DQsb<Qc2, because Qsb and Qd have similar bit ratios, and the condition of Figure 4 is to be simultaneously satisfied, the value of the second quantization parameter (Qs2) that should be selected is 2xQs1 , and not Qs2=Qsb as selected in the prior art, in order to achieve reduced quantization parameter without seriously affecting the bit ratio. Moreover, when

Qsb>Qc2, because Qsb and Qc2 have similar bit ratios, and because the bit ratio of Qc2 is smaller than that of 2xQs1 , the second quantization parameter (Qs2) should be selected to be equal to Qc2, and not like that in the prior art where the second quantization parameter (Qs2) is selected to be equal to Qsb.

Hence, because the conventional transcoder 10 only considers the relation between quantization parameter and quantization error and fails to consider the relation between quantization parameter and bit ratio, further reduction in the quantization error is not possible.

Disclosure of Invention

Therefore, one object of the present invention is to provide a transcoding method that can determine an appropriate second quantization parameter. Another object of the present invention is to provide a transcoding apparatus that can reduce quantization error.

A further object of the present invention is to provide an integrated circuit that can reduce quantization error during transcoding.

According to one aspect of the present invention, there is provided a transcoding apparatus for transforming a first bit stream into a second bit stream. The first bit stream is encoded according to a first quantization parameter. The transcoding apparatus comprises a quantization parameter adjuster, a decoding unit, an encoding unit, a quantization parameter calculating unit, a bit shifting unit, and a bit allocation unit. The quantization parameter adjuster includes an analyzing unit and a quantization parameter deciding unit.

A transcoding method performed by the transcoding apparatus comprises the following steps:

(A) The decoding unit decodes the first bit stream.

(B) The bit allocation unit estimates a bit count that can be used by a subsequent input unit during encoding.

(C) The quantization parameter calculating unit calculates a candidate quantization parameter according to the estimated bit count.

(D) The quantization parameter adjuster determines a second quantization parameter according to the value of the candidate quantization parameter, and determines a ratio of the second quantization parameter to the first quantization parameter. Determination of the second quantization parameter includes the following sub-steps:

(D-1 ) The analyzing unit sets a first critical value, the size of which is equal to twice the first quantization parameter. The analyzing unit also dynamically determines a first threshold value according to the first critical value and actual use conditions. (D-2) The quantization parameter deciding unit determines whether the candidate quantization parameter is not smaller than the first threshold value. If affirmative, the flow goes to sub-step (D-4). Otherwise, the flow goes to sub-step (D-3).

(D-3) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as that of the first quantization parameter.

(D-4) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as the first critical value.

(E) The bit shifting unit performs bit shifting of data decoded in step (A) according to the ratio obtained in step (D).

(F) The encoding unit encodes bit shifted data to generate the second bit stream.

Step (D) of the aforementioned transcoding method can alternatively

include the following sub-steps:

(D-1 ) The analyzing unit sets a first critical value, the size of which is equal to twice the first quantization parameter. The analyzing unit also dynamically determines a first threshold value according to the first critical value and actual use conditions.

(D-2) The quantization parameter deciding unit determines whether the candidate quantization parameter is not smaller than the first threshold value. If affirmative, the flow goes to sub-step (D-3). Otherwise, the flow goes to sub-step (D-5). (D-3) The analyzing unit analyzes the relation between bit ratio and quantization parameter, and determines if there is a second critical value larger than the first critical value. If affirmative, the flow goes to sub-step (D-4). Otherwise, the flow goes to sub-step (D-6).

In sub-step (D-3), the method of determining if there is a second critical value is conducted by determining if there is another level of bit ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present. If affirmative, this means that there is a second critical value. (D-4) The analyzing unit sets the size of the second critical value to be the same as four times the first quantization parameter, and dynamically determines a second threshold value according to the second critical value and actual use conditions. The quantization parameter deciding unit then determines if the value of the candidate quantization parameter is not smaller than the second threshold value. If affirmative, the flow goes to sub-step (D-7). Otherwise, the flow goes to sub-step (D-6).

(D-5) The quantization parameter deciding unit sets the value of the

second quantization parameter to be the same as that of the first quantization parameter.

(D-6) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as the first critical value. (D-7) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as the second critical value.

According to another aspect of the present invention, an integrated circuit includes the aforementioned decoding unit, bit allocation unit, quantization parameter calculating unit, quantization parameter adjuster, bit shifting unit, and encoding unit. The integrated circuit receives the first bit stream and transforms the first bit stream into the second bit stream for output.

According to still another aspect of the present invention, an integrated circuit includes the aforementioned bit allocation unit, quantization parameter calculating unit, and quantization parameter adjuster. The integrated circuit receives decoded data of the first bit stream.

According to yet another aspect of the present invention, a transcoding apparatus comprises a quantization parameter adjuster, a decoding unit, an encoding unit, a quantization parameter calculating unit, an inverse quantization unit, a quantization unit, and a bit allocation unit. The quantization parameter adjuster includes an analyzing unit and a quantization parameter deciding unit. A transcoding method performed by the transcoding apparatus comprises the following steps:

(a) The decoding unit decodes the first bit stream.

(b) The inverse quantization unit performs inverse quantization upon

the decoded data.

(c) The bit allocation unit estimates a bit count that can be used by a subsequent input unit during encoding.

(d) The quantization parameter calculating unit calculates a candidate quantization parameter according to the estimated bit count.

(e) The quantization parameter adjuster determines a second quantization parameter according to the value of the candidate quantization parameter. Determination of the second quantization parameter includes the following sub-steps: (e-1 ) The analyzing unit analyzes the relation between bit ratio and quantization parameter, and determines a first critical value. The analyzing unit also dynamically determines a first threshold value according to the first critical value and actual use conditions. The method of determining the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio. However, if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter.

(e-2) The quantization parameter deciding unit determines whether the candidate quantization parameter is not smaller than the first threshold value. If affirmative, the flow goes to sub-step (e-4). Otherwise, the flow goes to sub-step (e-3). (e-3) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as that of the first quantization parameter.

(e-4) The quantization parameter deciding unit sets the value of the

second quantization parameter to be the same as the first critical value.

(f) The quantization unit performs quantization processing upon the inverse quantized data using the second quantization parameter.

(g) The encoding unit encodes the quantized data to generate the second bit stream.

Step (e) of the aforementioned transcoding method can alternatively include the following sub-steps:

(e-1 ) The analyzing unit analyzes the relation between bit ratio and quantization parameter, and determines a first critical value. The analyzing unit also dynamically determines a first threshold value according to the first critical value and actual use conditions. The method of determining the first critical value involves setting the numerical value of the first critical value to be the same as the quantization parameter with the smallest value in the second largest level of bit ratio. However, if the first critical value set as such is smaller than twice the first quantization parameter, setting of the first critical value is directly revised to be the same as twice the value of the first quantization parameter.

(e-2) The quantization parameter deciding unit determines whether the candidate quantization parameter is not smaller than the first threshold value. If affirmative, the flow goes to sub-step (e-3). Otherwise, the flow goes to sub-step (e-5).

(e-3) The analyzing unit analyzes the relation between bit ratio and quantization parameter, and determines if there is a second critical value larger than the first critical value. If affirmative, the flow goes to sub-step (e-4). Otherwise, the flow goes to sub-step (e-6).

In sub-step (e-3), the method of determining if there is a second critical value is conducted by determining if there is another level of bit

ratio in the relation between bit ratio and quantization parameter, and if said another level of bit ratio is smaller than the level where the first critical value is present. If affirmative, this means that there is a second critical value, and the second critical value is set to be the same as the quantization parameter with the smallest value in the smaller level of bit ratio.

(e-4) The quantization parameter deciding unit determines whether the value of the candidate quantization parameter is not smaller than a second threshold value. If affirmative, the flow goes to sub-step (e-7). Otherwise, the flow goes to sub-step (e-6). The second threshold value is dynamically determined by the analyzing unit according to the second critical value and actual use conditions.

(e-5) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as that of the first quantization parameter.

(e-6) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as the first critical value.

(e-7) The quantization parameter deciding unit sets the value of the second quantization parameter to be the same as the second critical value.

According to a further aspect of the present invention, an integrated circuit includes the aforementioned quantization parameter adjuster, decoding unit, encoding unit, quantization parameter calculating unit, inverse quantization unit, quantization unit, and bit allocation unit. The integrated circuit receives the first bit stream and transforms the first bit stream into the second bit stream for output.

According to another further aspect of the present invention, an integrated circuit includes the aforementioned bit allocation unit,

quantization parameter calculating unit, and quantization parameter adjuster. The integrated circuit receives decoded data of the first bit stream.

Brief Description of Drawings

Other features and advantages of the present invention will become apparent in the following detailed description of the preferred embodiments with reference to the accompanying drawings, of which:

Figure 1 is a circuit block diagram of a conventional transcoder; Figure 2 is a circuit block diagram of a quantization unit of the conventional transcoder;

Figure 3 is a schematic diagram to illustrate the relation between a candidate quantization parameter and a second quantization parameter;

Figure 4 is a schematic diagram to illustrate the relation between bit rate and inverse of quantization error;

Figure 5 is a schematic diagram to illustrate the relation between bit ratio and candidate quantization parameter;

Figure 6 is another schematic diagram to illustrate the relation between bit ratio and candidate quantization parameter; Figure 7 is yet another schematic diagram to illustrate the relation between bit ratio and candidate quantization parameter;

Figure 8 is a circuit block diagram of the first preferred embodiment of a transcoding apparatus according to the present invention;

Figure 9 is a flowchart of the first preferred embodiment of a transcoding method according to the present invention;

Figure 10 is a circuit diagram of a quantization parameter adjuster of the first preferred embodiment of the transcoding apparatus;

Figure 1 1 is a detailed flowchart of step 24 of the first preferred

embodiment of the transcoding method;

Figure 12 is a schematic diagram to illustrate the relation between bit ratio and candidate quantization parameter;

Figure 13 is a schematic diagram to illustrate the relation between candidate quantization parameter and second quantization parameter in the presence and absence of a second critical value;

Figure 14 is an example to illustrate the result of executing the method of the first preferred embodiment;

Figure 15 is another example to illustrate the result of executing the method of the first preferred embodiment;

Figure 16 is a circuit block diagram of the second preferred embodiment of a transcoding apparatus according to the present invention;

Figure 17 is a flowchart of the second preferred embodiment of a transcoding method according to the present invention; and

Figure 18 is a detailed flowchart of step 34 of the second preferred embodiment of the transcoding method.

Best Mode for Carrying Out the Invention Before the present invention is described in greater detail, it should be noted herein that similar elements are denoted by the same reference numerals throughout the following description.

Referring to Figure 8, the first preferred embodiment of a transcoding apparatus according to the present invention comprises a quantization parameter adjuster 1 1 , a decoding unit 12, an encoding unit

13, a quantization parameter calculating unit 14, an inverse quantization unit 15, a quantization unit 16, and a bit allocation unit 17.

The operations of the units 11 to 17 will be described with reference

to the method flow of Figure 9 respectively.

Referring to Figures 8 and 9, the transcoding method performed by the transcoding apparatus of the first preferred embodiment includes the following steps: In step 21 , the decoding unit 12 receives an encoded first bit stream

(the first bit stream is encoded according to a first quantization parameter Qs1 ), and decodes the first bit stream. In this embodiment, the decoding unit 12 adopts a variable length decoding scheme, such as Huffman code. The decoding unit 12 sends the decoded data to the inverse quantization unit 15.

In step 22, the inverse quantization unit 15 performs inverse quantization upon the received data according to the first quantization parameter (Qs1 ), and sends the inverse quantized data to the quantization unit 16. In step 22, the bit allocation unit 17 estimates a bit count that can be used by a subsequent input unit, such as a macroblock, during encoding, according to received pre-information, such as target bit rate, unit size to be processed (such as the size of next input macroblock or next frame), and information included in the first bit stream, such as the original bit rate, frame rate, etc. The result of such estimation is sent to the quantization parameter calculating unit 14. Because the estimation scheme employed by the bit allocation unit 17 is known in the art, further details thereof are omitted herein.

In step 23, the quantization parameter calculating unit 14 calculates a candidate quantization parameter (Qsb) according to the bit count estimated by the bit allocation unit 17. Because the calculation scheme employed by the quantization parameter calculating unit 14 is known in the art, further details thereof are omitted herein.

In step 24, the quantization parameter adjuster 1 1 obtains an appropriate second quantization parameter (Qs2) according to the candidate quantization parameter (Qsb) obtained in step 23 and the first quantization parameter (Qs1 ). Detailed steps of the adjustment will be described in greater detail hereinafter.

In step 25, the quantization unit 16 performs quantization processing upon data processed by the inverse quantization unit 15 according to the second quantization parameter (Qs2) obtained in step 24.

In step 26, the encoding unit 13 performs encoding of quantized data from the quantization unit 16 to obtain a second bit stream. In this embodiment, encoding is conducted according to a variable length coding scheme.

Referring to Figure 10, the quantization parameter adjuster 1 1 includes an analyzing unit 1 1 1 and a quantization parameter deciding unit 1 12. The operations of these two units 1 1 1 , 1 12 will now be described with reference to the method flow in Figure 11.

Referring to Figures 10 and 11 , the method of determining the second quantization parameter (Qs2) in step 24 includes the following sub-steps: In sub-step 240, the analyzing unit 1 1 1 receives the value of the first quantization parameter (Qs1 ), analyzes the relation between bit ratio and quantization parameter, determines a first critical value (Qd ), and simultaneously determines a first threshold value (Qth1 ).

The method of determining the first critical value (Qd ) by the analyzing unit 1 11 is as follows. According to the statistical relation between bit ratio and quantization parameter, for different candidate quantization parameters (Qsb), there are at least two different levels of bit ratios. The values of the bit ratios for the candidate quantization

parameters (Qsb) that are located in the same level are similar. The numerical value of the first critical value (Qd ) is set to be the same as that of the quantization parameter with the smallest value in the second largest level of bit ratio. However, it should be noted that, if the first critical value (Qd ) is smaller than twice the first quantization parameter (Qs1) according to such setting, in order to satisfy the condition of Figure 4, the setting of the first critical value (Qd ) is directly revised to be the same as the value of twice the first quantization parameter (2xQs1 ). Thus, in practice, the first critical value (Qd ) can be possibly larger than or equal to twice the first quantization parameter (Qs1 ).

After determining the first critical value (Qd ) 1 the analyzing unit 111 further dynamically determines a first threshold value (Qth1 ) according to the first critical value (Qd ) and actual use conditions (such as bit compression conditions). For example, when the bit compression conditions have yet to reach the expected conditions, the numerical value of the first threshold value (Qth1) can be downwards adjusted. However, it should be noted that the first threshold value (Qth1 ) should not be larger than the first critical value (Qd ) and should be larger than the first quantization parameter (Qs1 ).

In sub-step 241 , the quantization parameter deciding unit 112 receives the candidate quantization parameter (Qsb) from the quantization parameter calculating unit 14, and determines whether the candidate quantization parameter (Qsb) is not smaller than the first threshold value (QtM ). If affirmative, the flow goes to sub-step 242. Otherwise, the flow goes to sub-step 244.

In sub-step 242, the analyzing unit 111 analyzes the relation between bit ratio and quantization parameter, and determines whether

there is a second critical value (Qc2) larger than the first critical value (Qd ). If affirmative, the flow goes to sub-step 243. Otherwise, the flow goes to sub-step 245.

Referring to Figures 10 to 12, the method of determining whether there is a second critical value (Qc2) by the analyzing unit 111 includes determining from the relation between bit ratio and quantization parameter if there is another level of bit ratios for the different candidate quantization parameters (Qsb), and if said another level of bit ratios is smaller than the level where the first critical value (Qd ) is present. If affirmative, this indicates that there is a second critical value (Qc2), and the numerical value of the second critical value (Qc2) is set to be the same as that of the quantization parameter with the smallest value in the smaller level of bit ratio.

In sub-step 243, the quantization parameter deciding unit 112 determines whether the value of the candidate quantization parameter (Qsb) is not smaller than a second threshold value (Qth2). If affirmative, the flow goes to sub-step 246. Otherwise, the flow goes to sub-step 245. The second threshold value (Qth2) is dynamically determined according to the second critical value (Qc2) and actual use conditions (such as the bit compression conditions). It is noted herein that the second threshold value (Qth2) should not be larger than the second critical value (Qc2) and should not be smaller than the first critical value (Qd ).

In sub-step 244, the quantization parameter deciding unit 112 sets the value of the second quantization parameter (Qs2) to be the same as the value of the first quantization parameter (Qs1 ).

In sub-step 245, the quantization parameter deciding unit 112 sets the value of the second quantization parameter (Qs2) to be the same as the first critical value (Qd ).

In sub-step 246, the quantization parameter deciding unit 1 12 sets the value of the second quantization parameter (Qs2) to be the same as the second critical value (Qc2).

It should be noted herein that, in sub-step 242, it is possible to first establish a relation table or relation graph (see Figure 12) of quantization parameter and bit ratio, so that in sub-step 243, the quantization parameter deciding unit 112 makes its determination directly through table searching or graph searching.

In the aforementioned flow, the object of establishing the first threshold value (Qth1 ) is to facilitate determining whether the second quantization parameter (Qs2) should be set to be equal to the first critical value (Qd ) or the value of the first quantization parameter (Qs1 ). The object of establishing the second threshold value (Qth2) is to facilitate determining whether the second quantization parameter (Qs2) should be set to be equal to the first critical value (Qd ) or the second critical value (Qc2).

Moreover, it should be noted herein that the method of dynamic adjustment of the size of the first threshold value (Qth1 ) is as follows. When bit compression conditions have yet to reach expected conditions, the numerical value of the first threshold value (Qth1 ) can be downwards adjusted. Accordingly, the likelihood that the second quantization parameter (Qs2) will be set to be the same as the first critical value (Qd ) will be increased as compared to being set to be the same as the first quantization parameter (Qs1 ), thereby causing the second quantization parameter (Qs2) to be larger than the first quantization parameter (Qs1 ) to achieve a higher bit compression ratio. Likewise, the same principles can be followed to adjust the second threshold value (Qth2).

Based on the foregoing, for different candidate quantization parameters (Qsb), values of the second quantization parameter (Qs2) are arranged as shown in Figure 13. The left half portion of Figure 13 is the condition when there is a second critical value (Qc2), which illustrates the cases when Qsb<Qth1 , Qs2=Qs1 , when Qth1 DQsb<Qth2, Qs2=Qc1 and when QsbDQth2, Qs2=Qc2. The right half portion of Figure 13 is the condition when there is no second critical value (Qc2), which illustrates the cases when Qsb<Qth1 , Qs2=Qs1 and when Qthi DQsb, Qs2=Qc1. In addition, the following simple examples are provided to help illustrate the aforementioned flow. Referring to Figure 14, assuming that a candidate quantization parameter (Qsb) (the triangular dot in Figure 14) is larger than the first threshold value (Qth1 ), and if there is no second critical value (Qc2), the result of executing the aforementioned sub-steps 240,241 ,242 and 245 in sequence is to set the value of the second quantization parameter (Qs2) to the first critical value (Qd ) (the solid circular dot in Figure 14), i.e., the triangular dot in Figure 14 is shifted to the solid circular dot in Figure 14. In the example shown in Figure 15, assuming that there is a second critical value (Qc2), and assuming that the candidate quantization parameter (Qsb) is the diamond dot in Figure 15, the result of executing sub-steps 240-243 and 245 in sequence is to set the value of the second quantization parameter (Qs2) to the first critical value (Qd ), i.e., the diamond dot is shifted to the solid circular dot. However, if the candidate quantization parameter (Qsb) is the triangular dot in Figure 15, the result of executing sub-steps 240-243 and 246 in sequence is to set the value of the second quantization parameter (Qs2) to the second critical value (Qc2), i.e., the triangular dot is shifted to the hollow circular dot.

The analyzing unit 111 , the quantization parameter deciding unit 112, the decoding unit 12, the encoding unit 13, the quantization parameter calculating unit 14, the inverse quantization unit 15, the quantization unit 16 and the bit allocation unit 17 of Figures 8 and 10 all execute computations in units of a macroblock. However, the invention should not be limited to this aspect, and such computations can also be in units of a frame or a slice. It is noted that, when a first inputted macroblock has undergone in sequence the steps of Figure 11 , sizes of numerical values for the first critical value (Qd ), the second critical value (Qc2), the first threshold value (Qth1 ) and the second threshold value (Qth2) are decided. Then, for each subsequently inputted macroblock, when the flow of Figure 11 is repeatedly executed, it is not necessary to recalculate the corresponding first critical value (Qd ), second critical value (Qc2), first threshold value (Qth1 ) and second threshold value (Qth2). The values first calculated can be continuously used to gain a faster computational speed. In the same manner, when the transcoding apparatus or transcoding method of the present invention has calculated appropriate first and second critical values (Qd , Qc2) and first and second threshold values (Qth1 , Qth2) for a first inputted bit stream, the previously calculated values can also be used for a subsequently inputted bit stream.

Since the first preferred embodiment is a fast transcoding apparatus, it does not include components like the inverse discrete cosine transform units 102, 109 and the discrete cosine transform unit 106 of the conventional transcoder 10. However, it should be noted that these conventional components, such as the inverse discrete cosine transform units 102, 109, the discrete cosine transform unit 106, and a motion compensating unit commonly used in commercially available transcoders,

can be added into the transcoding apparatus of the first preferred embodiment to further improve the effectiveness of the transcoding apparatus of the present invention. Because the improvement of this invention is not directed to these conventional components, further details of the same are omitted herein.

An integrated circuit of the present invention is used to receive the first bit stream, and to transform the first bit stream into the second bit stream for output. The integrated circuit comprises the abovementioned decoding unit 12, inverse quantization unit 15, bit allocation unit 17, quantization parameter calculating unit 14, quantization parameter adjuster 11 , quantization unit 16, and encoding unit 13 of the first preferred embodiment.

Furthermore, an integrated circuit of the present invention can also only include the abovementioned bit allocation unit 17, quantization parameter calculating unit 14, and quantization parameter adjuster 11 of the first preferred embodiment, and receives decoded data of the first bit stream.

It is noted that, in order to further improve the speed of the transcoding apparatus of the first preferred embodiment and to facilitate product realization, it is possible to directly set the first critical value (Qd ) of the first preferred embodiment to 2xQs1 , and, when there is a second critical value (Qc2), to directly set the second critical value (Qc2) to 4xQs1. Under these conditions, the transcoding apparatus of the first preferred embodiment can be simplified and obtain the results of the second preferred embodiment to be described hereinafter.

Referring to Figure 16, the second preferred embodiment of a transcoding apparatus according to the present invention comprises a quantization parameter adjuster 11 , a decoding unit 12, an encoding unit

13, a quantization parameter calculating unit 14, a bit allocation unit 17, and a bit shifting unit 18.

Because the decoding unit 12, the encoding unit 13, the quantization parameter calculating unit 14 and the bit allocation unit 17 are similar to those of the first preferred embodiment, they will not be described further. Referring to Figures 10 and 16, the quantization parameter adjuster 1 1 of the second preferred embodiment differs from that of the first preferred embodiment in that, aside from determining the value of the second quantization parameter (Qs2), the quantization parameter deciding unit 1 12 of the second preferred embodiment further obtains a ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1 ).

Referring to Figures 16 and 17, the transcoding method performed by the transcoding apparatus of the second preferred embodiment includes the following steps.

In step 31 , the decoding unit 12 receives an encoded first bit stream (the first bit stream is encoded according to a first quantization parameter Qs1 ), decodes the first bit stream, and sends decoded data (i.e., discrete cosine transform coefficients) to the bit shifting unit 18. In step 32, the bit allocation unit 17 estimates a bit count that can be used by a subsequent input unit during encoding according to received pre-information and information included in the first bit stream, and sends the result of the estimation to the quantization parameter calculating unit 14. In step 33, the quantization parameter calculating unit 14 calculates a candidate quantization parameter (Qsb) according to the bit count estimated by the bit allocation unit 17.

In step 34, the quantization parameter adjuster 1 1 analyzes an

appropriate second quantization parameter (Qs2), and obtains the ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1 ). The ratio (e.g., 1 or 2 or 4) is sent to the bit shifting unit 18. Detailed process of step 34 will be described in greater detail hereinafter.

In step 35, according to the ratio sent from the quantization parameter adjuster 1 1 , the bit shifting unit 18 performs bit shifting of the discrete cosine transform coefficients, which were decoded in step 31 in binary form. That is, if the ratio is 2 (i.e., the second quantization parameter (Qs2) is twice the first quantization parameter (QsI )), the discrete cosine transform coefficients in binary form are right-shifted by one bit. If the ratio is 4 (i.e., the second quantization parameter (Qs2) is four times the first quantization parameter (QsI )), the discrete cosine transform coefficients in binary form are right-shifted by two bits. However, if the ratio is 1 (i.e., the second quantization parameter (Qs2) is equal to the first quantization parameter (QsI )), the bit shifting unit 18 does not perform any processing, and the original discrete cosine transform coefficients that were received are sent directly to the encoding unit 13. In step 36, the encoding unit 13 performs encoding of data sent from the bit shifting unit 18 to obtain a second bit stream.

Referring to Figures 10 and 18, the method of determining the ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1 ) in step 34 includes the following sub-steps. In sub-step 340, the analyzing unit 1 1 1 sets a first critical value

(Qd ), the size of which is equal to twice the first quantization parameter (Qs1 ), and dynamically determines a first threshold value (QtM ) according to the first critical value (Qd ) and actual use conditions.

In sub-step 341 , according to the candidate quantization parameter (Qsb) sent from the quantization parameter calculating unit 14, the quantization parameter deciding unit 1 12 determines whether the candidate quantization parameter (Qsb) is not smaller than the first threshold value (Qth1 ). If affirmative, the flow goes to sub-step 342. Otherwise, the flow goes to sub-step 344.

In sub-step 342, the analyzing unit 111 analyzes the relation between bit ratio and quantization parameter, and determines whether there is a second critical value (Qc2) according to that described in step 242 of the first preferred embodiment. If affirmative, the flow goes to sub-step 343. Otherwise, the flow goes to sub-step 345.

In sub-step 343, unlike that in the first preferred embodiment, the analyzing unit 111 sets the second critical value (Qc2) to be four times the first quantization parameter (4xQs1 ). In sub-step 343, the analyzing unit 111 further dynamically determines a second threshold value (Qth2) according to the second critical value (Qc2) and actual use conditions. The quantization parameter deciding unit 112 then determines whether the value of the candidate quantization parameter (Qsb) is not smaller than the second threshold value (Qth2). If affirmative, the flow goes to sub-step 346. Otherwise, the flow goes to sub-step 345. It should be noted that the second threshold value (Qth2) must not be larger than the second critical value (Qc2), and must not be smaller than the first critical value (Qd ).

In sub-step 344, the quantization parameter deciding unit 112 sets the value of the second quantization parameter (Qs2) to be the same as that of the first quantization parameter (Qs1 ), and obtains the ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1 ), which is 1.

In sub-step 345, the quantization parameter deciding unit 112 sets the value of the second quantization parameter (Qs2) to be the same as the first critical value (Qd ) (which is equal to 2xQs1 ), and obtains the ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1), which is 2.

In sub-step 346, the quantization parameter deciding unit 112 sets the value of the second quantization parameter (Qs2) to be the same as the second critical value (Qc2) (which is equal to 4xQs1 ), and obtains the ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1 ), which is 4.

It is noted that, like the first preferred embodiment, when a first inputted macroblock has undergone in sequence the steps of Figure 18, sizes of numerical values for the first threshold value (Qth1 ) and the second threshold value (Qth2) are decided. Then, for each subsequently inputted macroblock, when the flow of Figure 18 is repeatedly executed, it is not necessary to recalculate the corresponding first threshold value (QtM ) and second threshold value (Qth2). The values first calculated can be continuously used to gain a faster computational speed. In the same manner, when the transcoding apparatus or transcoding method of the present invention has calculated appropriate first and second threshold values (Qth1 , Qth2) for a first inputted bit stream, the previously calculated values can also be used for a subsequently inputted bit stream.

An integrated circuit of the present invention can include the aforementioned decoding unit 12, bit allocation unit 17, quantization parameter calculating unit 14, quantization parameter adjuster 11 , bit shifting unit 18, and encoding unit 13 of the second preferred embodiment.

Moreover, an integrated circuit of the present invention can also only include the aforementioned bit allocation unit 17, quantization parameter calculating unit 14, and quantization parameter adjuster 1 1 of the second preferred embodiment, and receives decoded data of the first bit stream. Furthermore, it is noted that the quantization parameter adjuster 1 1 of the present invention is not limited to application to a transcoding apparatus, and can be applied as long as there is a need to execute quantization processing. In the same manner, the quantization parameter adjusting method of the present invention is not limited to use in a transcoding flow.

In sum, in the first and second preferred embodiments of the transcoding apparatus having the quantization parameter adjuster 11 according to the present invention, aside from considering the relation between bit rate and quantization error, the factor of bit ratio is further taken into consideration so that the quantization error is smaller as compared to that of the prior art. In the second preferred embodiment, since the first critical value (Qd ) and the second critical value (Qc2) are set as 2xQs1 and 4xQs1 , respectively, the ratio of the second quantization parameter (Qs2) to the first quantization parameter (Qs1 ) is always a multiple of two. As a result, it is only required to use a bit shifting unit 18 instead of the inverse quantization unit 15 and the quantization unit 16 of the first preferred embodiment, thereby dispensing with the need to perform inverse quantization followed by quantization of decoded data. While the present invention has been described in connection with what are considered the most practical and preferred embodiments, it is understood that this invention is not limited to the disclosed embodiments but is intended to cover various arrangements included

within the spirit and scope of the broadest interpretation so as to encompass all such modifications and equivalent arrangements.

Industrial Applicability The present invention can be applied to a transcoding apparatus, a transcoding method and an integrated circuit therefor.